Hi there,
I am new to Stan, and trying to use its Stata interface. I am getting a number of error messages when trying to run the Bernoulli example (see below for code and errors). The issue seems to derive from a faulty installation on my Mac, OS Sierra 10.12.5.
First issue: when I list the files and directories in the cmdstan-2.16.0 folder, I am missing the doc' directory. After building stan using the make command, and after the
stan built’ confirmation, no bin folder is created and the executables stanc and stansummary are nowhere to be found.
Can anybody tell me what I am doing wrong? And how can I build stan from scratch? Any help would be much appreciated!
Ferdinand
CODE and ERROR MESSAGE:
.
. // make the data
. clear
. set obs 10
number of observations (_N) was 0, now 10
. gen y=0
. replace y=1 in 2
(1 real change made)
. replace y=1 in 10
(1 real change made)
. count
10
. global N=r(N)
.
. // write the model from Stata into a plain text file
. tempname writemodel
. file open `writemodel’ using “mystanmodel.stan”, write replace
. #delimit ;
delimiter now ;
. foreach line in
"data { " " int<lower=0> N; " " int<lower=0,upper=1> y[N];" "} " "parameters {" " real<lower=0,upper=1> theta;" "} " "model {" " theta ~ beta(1,1);" " for (n in 1:N) " " y[n] ~ bernoulli(theta);" "}"
{;
-
#delimit cr
delimiter now cr
. file write writemodel' "
line’" _n
3. }
. file close `writemodel’
.
. // call Stan
. stan y, modelfile(“mystanmodel.stan”) cmd(“$cmdstandir”) globals(“N”) load mode
/bin/bash: /bin/stanc: No such file or directory
StataStan version: 1.2.3
CmdStan version:
cp: /mystanmodel.stan: Permission denied
cp: /mystanmodel.stan: Permission denied
/Users/nando
###############################
Output from compiling
###############################
make: *** No rule to make target `mystanmodel’. Stop.
##############################
Output from sampling
##############################
/bin/bash: ./mystanmodel: No such file or directory
/bin/bash: bin/stansummary: No such file or directory
#############################################
Output from optimizing to find mode
#############################################
/bin/bash: /mystanmodel: No such file or directory
(1 var, 0 obs)
lp__ not found
r(111);
end of do-file
r(111);
.