RStan: ADVI result in matrix from S4 class returned by vb method

Hi,

Right now I’m working on a project involving validating Stan’s ADVI method. This is a relatively junior question:

When I call the method

vb_result=vb(stanmodel, data, seed, …), the returned vb_result is a S4 class object in R. It contains the simulated values of each parameter from the ADVI result. Is there a way to easily extract the mean of these simulated values? In other words, how may I extract the ‘mean’ column of the result stored in vb_result on each parameter?

Thanks!

get_posterior_mean(vb_result)

1 Like

thanks @bgoodri!

Isn’t it the same kind of object as returned from sampling? If not, is there a way to pull out the draws and create a coda-like object (whatever that’s called in RStan) to deal with the intput in our usual diagnostics like ShinyStan, etc.?

Yes