I got error messages like below.
In system(paste(CXX, ARGS), ignore.stdout = TRUE, ignore.stderr = TRUE) :
'-E' not found
Few months ago it works very well and clearly, but stan does not work anymore.
I searched some posts and try several commands like
file.edit("~/.R/Makevars.win") # erase -march=native
file.edit("~/.R/Makevars") # it is blank.....Do I need to fill up with some commands?
install.packages(
"https://artifacts.r-hub.io/StanHeaders_2.21.0-6.tar.gz-d74e0af7c9e06cba7d975cd8d3dbcf87/StanHeaders_2.21.0-6.zip",
repos = NULL, type = "win.binary")
install.packages(
"https://artifacts.r-hub.io/rstan_2.21.2.tar.gz-639222303bb62625e2349320b5adb986/rstan_2.21.2.zip",
repos = NULL, type = "win.binary")
but error remains…
Error in withr::set_makevars(new, path, state, assignment = assignment) :
Multiple results for CXX14FLAGS found, something is wrong.FALSE
Warnings:
In system(paste(CXX, ARGS), ignore.stdout = TRUE, ignore.stderr = TRUE) :
'C:/RBUILD~1/4.0/usr/mingw_/bin/g++' not found
Here is my code.
library(tidyverse)
library(rstan)
library(ggmcmc)
set.seed(20191030)
N <- 10^3
X <- rnorm(N, 0, 5)
ex1 <- '
data{
int<lower = 0> N;
real X[N];
real theta0;
real<lower = 0> tau0;
real<lower = 0> alpha;
real<lower = 0> beta;
}
parameters{
real theta;
real<lower = 0> sigma2;
}
model{
for(n in 1:N){
X[n] ~ normal(theta, sqrt(sigma2));
}
theta ~ normal(theta0, tau0);
sigma2 ~ inv_gamma(alpha, beta);
}
'
fit <- stan(model_code = ex1,
data = list(N = length(X), X = X, 'theta0' = mean(X),
'tau0' = sd(X), 'alpha' = 5, 'beta' = 5),
iter = 5000, warmup = 500)
My laptop OS and version of software.
Operating System: Windows 10
Interface Version: Stan: 2.21.0 / R: 4.0.3
Compiler/Toolkit: Rstudio