http://rgm2.lab.nig.ac.jp/RGM_results/stats:SSlogis/SSlogis_001_big.png.

beta1 is the asymptote of the curve, beta2 is the midpoint and beta3 is a rate parameter. My thinking was I’d just have to add two more priors (beta3 and sig3), specify in the parameters block that the betas cannot be negative and then change the likelihood from

// Likelihood

for(n in 1:N)

y[n] ~ normal(beta[id[n],1]+beta[id[n],2] .* x[n], y_sig);

to

// Likelihood

for(n in 1:N)

y[n] ~ normal(beta[id[n],1]/(1+exp((beta[id[n],2] – x[n])/beta[id[n],3])), y_sig);

The model compiles but than once I get to the sampling step I get an error:

“Error in sampler$call_sampler(args.list[[i]]):

No acceptable small step size could be found. Perhaps the posterior is not continuous?”

Is there anything obviously wrong with my approach/model?

]]>Thanks for the catch. The code I was running was different from what I posted. duh. The blog is now updated with code that explicitly places bounds on the parameters. ]]>

parameters {

vector[2] beta[H]; // [H,2] dim matrix for b

real beta_mu[2]; // means for b

real beta_sig[2]; // var parameters for b

real y_sig; // regression variance

} ]]>

“If there are no user-supplied initial values, the unconstrained initial values are generated uniformly from the interval -2; 2 ”.

Does this mean it’s possible that an initial value for beta_sig could be negative? ]]>

COMPILING MODEL ‘Hierarchical Linear Model’ FROM Stan CODE TO C++ CODE NOW.

COMPILING THE C++ CODE FOR MODEL ‘Hierarchical Linear Model’ NOW.

SAMPLING FOR MODEL ‘Hierarchical Linear Model’ NOW (CHAIN 1).

Error in sampler$call_sampler(args.list[[i]]) :

Error in function stan::prob::normal_log(N4stan5agrad3varE): Scale parameter, sigma, is 0:0, but must be > 0!

Any idea what could be going wrong?

]]>