Installation problems on Mac--no bin folder created

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);"
    "}"

{;

  1.     #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);

.

I now managed to rebuild CmdStan from scratch, and the bin folder with the executables is there. The doc folder is still missing, though. Also, I continue getting the same error message when launching the example.

To build the doc, type:

make manual

I think this is the first version where the doc isn’t distributed as part of the downloadable package. Was there some doc that said you should have a doc/ folder?

Are you still having issues with your installation? I couldn’t tell from the last message.

Hi Daniel,

thank you for your reply. I have now created the doc using the command you
suggested. I thought somehow the doc was supposed to be there, given that
the installation manual listed it amongst the files I should seen, though
this is clearly not the issue.

I still get the same errors from the system. The exact errors seem to
depend on how I try to launch the example, but seem to come from some not
being properly specified on my Mac. Here is my code when I launch it the
Charles Opondo way, and the error I get
:

 // 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
(note: file mystanmodel.stan not found)

. #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);"
>         "}"
> {;
  2.         #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

@robertgrant knows about the Stata interface. Robert, mind chiming in? I don’t know how the interface connects to CmdStan.

It does still sound like it’s not finding the right file(s) in the Stan folders. StataStan is a relatively simple wrapper and the fact that it gets as far as printing the first version number but not the second one is indicative. Maybe you could run: set trace on then send me the extended output you get when you try it again? (You’ll want to send it to a log file ). One caveat is: if your data are sensitive, don’t do this because they will all sort in the trace output as they are written into Stan (R/S+) format.

Hi Robert,

thank you for your help. I attach the log file as you suggest. No sensitive
data, as this is just the standard Bernoulli example.

Best,

Ferdinand

I have now solved this problem–at least in part. That is, it works when I
write the program `the Charles Opondo way’. If I try to call the program
from examples/bernoulli directory, I still keep getting the error ~/output.csv
not found .

It seems like there was a concatenation of errors. First, I could not
manage to get the installation of cmdstan to work correctly when
downloading the file and following the instruction in the manual. What
finally worked was using git clone https://github.com/stan-dev/cmdstan.git,
following the instructions at:

Once I was sure that the bernoulli example worked when I launched it from
terminal, I needed to adjust some directory names in the Stata do-file,
following the slightly different naming of the folders, and voilà, it
worked.

Ferdinand

Sorry it was painful. Thanks for reporting back on what worked.