No plot?




I had to fix some things to convert from markdown to R code (add * to the stan code for multiplication and replace curly quotes to straight ones), but every single one of the plots worked for me. The only weirdness is that when 6 parameters are plotted on a 2 x 2 grid via a for-loop the first plot will immediately be replaced in the viewer with the next set of plots.

This does have a typo though. pairs should be pars, but this doesn’t break any plots.



This should just be

mu = beta0 * com + beta1 * pri + ...
rat ~ normal(mu, sigma);

You’ll need to make everything like com a vector.

I’d also recommend declaring beta as a vector, using beta ~ normal(0, 1) and then replacing beta0 with beta[1] and so on.

This can just be a one-liner

real<lower = 0> sigma = exp(-ln_sigma);

But then I wouldn’t call ln_sigma that as it’s really the negation of log sigma if I’m reading this right. I have no idea why you’d negate here as ln_sigma gets a normal(0, 1) prior, which is symmetric around zero, so it doesn’t do anything other than add a little drag and reverse signs.