Hi,
I just downloaded R 4.0.2 and rstan 2.21.2. I followed along with the Getting Started guide. I ran the following code in a .stan file
data {
int<lower=0> J; // number of schools
real y[J]; // estimated treatment effects
real<lower=0> sigma[J]; // standard error of effect estimates
}
parameters {
real mu; // population treatment effect
real<lower=0> tau; // standard deviation in treatment effects
vector[J] eta; // unscaled deviation from mu by school
}
transformed parameters {
vector[J] theta = mu + tau * eta; // school treatment effects
}
model {
target += normal_lpdf(eta | 0, 1); // prior log-density
target += normal_lpdf(y | theta, sigma); // log-likelihood
}
and the following code in a .R file
library(rstan)
options(mc.cores = parallel::detectCores())
rstan_options(auto_write = TRUE)
schools_dat <- list(J = 8,
y = c(28, 8, -3, 7, -1, 1, 18, 12),
sigma = c(15, 10, 16, 11, 9, 11, 10, 18))
fit <- stan(file = 'schools.stan', data = schools_dat)
The R console gives the following error after executing the fit line:
Error in file(fname, "rt") : cannot open the connection
In addition: Warning messages:
1: In normalizePath(path.expand(path), winslash, mustWork) :
path[1]="C:/users/graha/Desktop/schools.stan": The system cannot find the file specified
2: In file(fname, "rt") :
cannot open file 'C:\users\graha\Desktop\schools.stan': No such file or directory
Error in get_model_strcode(file, model_code) :
cannot open model file "C:\users\graha\Desktop\schools.stan"
Both the .stan and .R files are saved in the current working directory (desktop).
Here is my system environment
R version 4.0.2 (2020-06-22)
RStan 2.21.2
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 18363)
Any help would be much appreciated!