Apologies if this is not the right place to post but new to forum and stan. I have tried to install stan and run the vignettes but encounter the following warnings when I try to fit the model (which is in the working directory as 8schools.stan and schools.stan, the two versions which are provided):
fit ← stan(file = ‘8schools.stan’, data = schools_dat, iter = 1000, chains = 4)
PARSER EXPECTED: whitespace to end of file.
FOUND AT line 1:
{\rtf1\ansi\ansicpg1252\cocoartf1504\cocoasubrtf830
{\fonttbl\f0\fmodern\fcharset0 Courier;}
{\colortbl;\red255\green255\blue255;\red0\green0\blue0;}
{*\expandedcolortbl;;\cssrgb\c0\c0\c0;}
\paperw11900\paperh16840\margl1440\margr1440\vieww10800\viewh8400\viewkind0
\deftab720
\pard\pardeftab720\sl280\partightenfactor0
\f0\fs24 \cf2 \expnd0\expndtw0\kerning0
\outl0\strokewidth0 \strokec2 // saved as 8schools.stan
data {
int<lower=0> J; // number of schools
real y[J]; // estimated treatment effects
real<lower=0> sigma[J]; // s.e. of effect estimates
}
parameters {
real mu;
real<lower=0> tau;
real eta[J];
}
transformed parameters {
real theta[J];
for (j in 1:J)
theta[j] = mu + tau * eta[j];
}
model {
target += normal_lpdf(eta | 0, 1);
target += normal_lpdf(y | theta, sigma);
}
}
Error in stanc(file = file, model_code = model_code, model_name = model_name, :
failed to parse Stan model ‘8schools’ due to the above error.
In addition: Warning message:
In readLines(file, warn = TRUE) :
incomplete final line found on ‘/Users/djamesw/Rprojects/8schools.stan’
sessionInfo()
R version 3.4.1 (2017-06-30)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS Sierra 10.12.6
Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.4/Resources/lib/libRlapack.dylib
locale:
[1] en_AU.UTF-8/en_AU.UTF-8/en_AU.UTF-8/C/en_AU.UTF-8/en_AU.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] rstan_2.16.2 StanHeaders_2.16.0-1 ggplot2_2.2.1
loaded via a namespace (and not attached):
[1] Rcpp_0.12.12 withr_2.0.0 digest_0.6.12 grid_3.4.1
[5] plyr_1.8.4 gtable_0.2.0 stats4_3.4.1 scales_0.4.1
[9] rlang_0.1.1 lazyeval_0.2.0 devtools_1.13.3 tools_3.4.1
[13] munsell_0.4.3 parallel_3.4.1 compiler_3.4.1 inline_0.3.14
[17] colorspace_1.3-2 memoise_1.1.0 gridExtra_2.2.1 tibble_1.3.3
writeLines(readLines(file.path(Sys.getenv(“HOME”), “.R/Makevars”)))
CXXFLAGS=-O3 -mtune=native -march=native -Wno-unused-variable -Wno-unused-function
devtools::session_info(“rstan”)
Session info -----------------------------------------------------------------------
setting value
version R version 3.4.1 (2017-06-30)
system x86_64, darwin15.6.0
ui RStudio (1.0.153)
language (EN)
collate en_AU.UTF-8
tz Australia/Brisbane
date 2017-08-06
Packages ---------------------------------------------------------------------------
package * version date source
BH 1.62.0-1 2016-11-19 CRAN (R 3.4.0)
colorspace 1.3-2 2016-12-14 CRAN (R 3.4.0)
dichromat 2.0-0 2013-01-24 CRAN (R 3.4.0)
digest 0.6.12 2017-01-27 CRAN (R 3.4.0)
ggplot2 * 2.2.1 2016-12-30 CRAN (R 3.4.0)
graphics * 3.4.1 2017-07-07 local
grDevices * 3.4.1 2017-07-07 local
grid 3.4.1 2017-07-07 local
gridExtra 2.2.1 2016-02-29 CRAN (R 3.4.0)
gtable 0.2.0 2016-02-26 CRAN (R 3.4.0)
inline 0.3.14 2015-04-13 CRAN (R 3.4.0)
labeling 0.3 2014-08-23 CRAN (R 3.4.0)
lattice 0.20-35 2017-03-25 CRAN (R 3.4.1)
lazyeval 0.2.0 2016-06-12 CRAN (R 3.4.0)
magrittr 1.5 2014-11-22 CRAN (R 3.4.0)
MASS 7.3-47 2017-02-26 CRAN (R 3.4.1)
Matrix 1.2-10 2017-05-03 CRAN (R 3.4.1)
methods * 3.4.1 2017-07-07 local
munsell 0.4.3 2016-02-13 CRAN (R 3.4.0)
plyr 1.8.4 2016-06-08 CRAN (R 3.4.0)
RColorBrewer 1.1-2 2014-12-07 CRAN (R 3.4.0)
Rcpp 0.12.12 2017-07-15 CRAN (R 3.4.1)
RcppEigen 0.3.3.3.0 2017-05-01 CRAN (R 3.4.0)
reshape2 1.4.2 2016-10-22 CRAN (R 3.4.0)
rlang 0.1.1 2017-05-18 CRAN (R 3.4.0)
rstan * 2.16.2 2017-07-03 CRAN (R 3.4.1)
scales 0.4.1 2016-11-09 CRAN (R 3.4.0)
StanHeaders * 2.16.0-1 2017-07-03 CRAN (R 3.4.1)
stats * 3.4.1 2017-07-07 local
stats4 3.4.1 2017-07-07 local
stringi 1.1.5 2017-04-07 CRAN (R 3.4.0)
stringr 1.2.0 2017-02-18 CRAN (R 3.4.0)
tibble 1.3.3 2017-05-28 CRAN (R 3.4.0)
tools 3.4.1 2017-07-07 local
utils * 3.4.1 2017-07-07 local
Mac OS Sierra version 10.12.6
I am aware that there may be problems with the latest version of R (according to a post by Bob Carpenter) but I don’t know if my problem is the same.
I would be grateful for any suggestions.