Error with Stan

Operating System: Mac Yosemite
Interface Version: MatlabStan 2.7.0.0
Compiler/Toolkit:

Hello, everyone, I’m using MatlabStan but meet the following problem:

Error using StanModel/set.stan_home (line 303)
Can’t parse stan_home. Is it set correctly?
Error in StanModel (line 184)
self.stan_home = p.Results.stan_home;
Error in stan (line 108)
model = StanModel();

I’m puzzled, how to solve this problem? guys, I need your help. thx

This is probably happening because the path to your CmdStan installation has not been set properly. This should be edited in +mstan/stan_home.m to point to wherever your CmdStan installation lives.

More details here:

1 Like

Thanks Mr.Lau, it works. However, I met another problem:

Error using rng (line 95)
The current random number generator is the legacy
generator. This is because you have executed a
command such as rand(‘state’,0), which activates
MATLAB’s legacy random number behavior. You may not
use RNG to reseed the legacy random number
generator.

Use rng(‘default’) to reinitialize the random number
generator to its startup configuration, or call RNG
using a specific generator type, such as
rng(seed,‘twister’).
Error in mcmc/set.rng_state (line 90)
rng®;
Error in mcmc (line 35)
self.rng_state = seed;
Error in StanFit (line 92)
self.sim_ = mcmc(self.model.seed);
Error in StanModel/sampling (line 744)
fit =
StanFit(‘model’,copy(self),‘processes’,p,…
Error in stan (line 137)
fit = model.sampling(p.Unmatched);

Can you try running rng(‘default’) and then try your stan program again? It looks like your Matlab session is using a legacy random number generator. This should fix the problem, and I’ve opened an issue to avoid this error in the future

yes, it works. thank you!

Great. This error is also caught in the latest version of MatlabStan (v2.15.1.0).

More descriptive titles really help us reading this, as do tags like MatlabStan.