Is there a CmdSTAN equivalent to rstanarm’s posterior_predict() function? I am trying to get the median predicted value per-observation without assuming it to be a function of linear predictors. Thanks!
You would have to do the posterior prediction in the generated quantities block of the (or a in 2.19) Stan program.
Thanks! I want to make sure the predictions account for true variance in the outcome. If I add a line like:
real l_pred = b_Intercept + dot_product(means_X, b);
am I properly doing so, or is that just going to give me the linear prediction?
That is just the linear predictor. Add a draw from the normal distribution with standard deviation
sigma too that (assuming you are using a normal likelihood) to get a draw from the posterior predictive distribution.
Thank you! So would this be what I’m looking for?
real l_pred; l_pred = normal_rng(beta + beta * varA + beta * varB + beta * varC, sigma);
Yeah. You can just do
real l_pred = ...;. You don’t have to declare things separately from their definitions.
Awesome. Thanks again!