Rstan Help

Hello, I’m a university student taking a Bayesian Statistics module. As part of the coursework I’m required to use RStan.
I followed the instructions on and installed RTools4. I then installed rstan and stan headers from source using the command,


When I try and fit a model I get the following error,

olsStan ← stan(“OLS.stan”, data=simpleStanData, chains = 2, iter = 2000)

Error in file(fname, “rt”) : cannot open the connection
In addition: Warning messages:
1: In normalizePath(path.expand(path), winslash, mustWork) :
path[1]=“OLS.stan”: The system cannot find the file specified
2: In file(fname, “rt”) :
cannot open file ‘C:\Users\ollie\OneDrive\Documents\OLS.stan’: No such file or directory
Error in get_model_strcode(file, model_code) :
cannot open model file “C:\Users\ollie\OneDrive\Documents\OLS.stan”

Does anyone have any suggestions on ways to solve this :)

It’s saying there is no file named “OLS.stan” in “C:\Users\ollie\OneDrive\Documents”.
Is that where you put the .stan file?
If not, either move the .stan file there, or change your working directory to where the file is.