Did you verify the installation? According to this page, the code is:
library(rstan)
example(stan_model, package = "rstan", run.dontrun = TRUE)
and it should be okay, in my case there is an error:
Compilation ERROR, function(s)/method(s) not created!
Error en compileCode(f, code, language = language, verbose = verbose):
tric.hpp:22:0: required from 'double stan::mcmc::dense_e_metric<Model, BaseRNG>::T(stan::mcmc::dense_e_point&) [with Model = modele64438b1918__namespace::modele64438b1918_; BaseRNG = boost::random::mixmax_engine<17, 36, 0>]'
22 | return 0.5 * z.p.transpose() * z.inv_e_metric_ * z.p;
C:/Users/rosgori/AppData/Local/R/win-library/4.5/StanHeaders/include/src/stan/mcmc/hmc/hamiltonians/dense_e_metric.hpp:21:0: required from here
21 | double T(dense_e_point& z) {
C:/Users/rosgori/AppData/Local/R/win-library/4.5/RcppEigen/include/Eigen/src/Core/DenseCoeffsBase.h:654:74: warning: ignoring attributes on template argument 'Eigen::internal::packet_traits<double>::type' {aka '__m128d'} [-Wignored-attributes]
654 | return internal::first_aligned<int(unpacket_traits<DefaultPacketType>::alignment),Derived>(m);
| ^~~~~~~~~
make: *** [C:/PROGRA~1/R/R-45~1.0/etc/x64/Makeconf:296: filee647de17426.o
According to this, I tried to install RStan by two methods:
- Windows β RStan β R-Universe
- Windows β RStan β Github (Source)
The first one shows that error; you could say that after the installation, there are errors within RStan and you cannot compile the Stan model. Nothing you can do here.
With the second method, there is another error!
package βStanHeadersβ successfully unpacked and MD5 sums checked
The downloaded binary packages are in
C:\Users\rosgori\AppData\Local\Temp\Rtmp4Wo5WQ\downloaded_packages
ββ R CMD build ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β checking for file 'C:\Users\rosgori\AppData\Local\Temp\Rtmp4Wo5WQ\remotes308817f82f8d\stan-dev-rstan-662ac20\rstan\rstan/DESCRIPTION' (487ms)
β preparing 'rstan': (4s)
β checking DESCRIPTION meta-information ...
β cleaning src
β checking for LF line-endings in source and make files and shell scripts (854ms)
β checking for empty or unneeded directories
β looking to see if a 'data/datalist' file should be added
β building 'rstan_2.36.0.9000.tar.gz' (1.5s)
Installing package into βC:/Users/rosgori/AppData/Local/R/win-library/4.5β
(as βlibβ is unspecified)
* installing *source* package 'rstan' ...
** this is package 'rstan' version '2.36.0.9000'
** using staged installation
** libs
Error: package 'StanHeaders' 2.32.10 was found, but >= 2.36.0 is required by 'rstan'
* removing 'C:/Users/rosgori/AppData/Local/R/win-library/4.5/rstan'
Aviso:
In i.p(...) :
installation of package βC:/Users/rosgori/AppData/Local/Temp/Rtmp4Wo5WQ/file3088759845d2/rstan_2.36.0.9000.tar.gzβ had non-zero exit status
The errors means the installer downloads StanHeaders 2.32.10 for RStan 2.36, but it needs StanHeaders >= 2.36.The last version of StanHeaders is 2.32.10 according to this page
I bet, just like me, you cannot use RStan because of those reasons, and unfortunately the installation for RStan is not working at this moment.
The other option is CmdStanR, but you said you were having problems with the installation.