I have successfully run my stan code and I am interested in extracting the posterior distribution of my model.
I am receiving the following error:
Error in extract(full_fit.global.inter, pars = “par1”) :
object of type ‘S4’ is not subsettable
However I can successfully extract them with:
junk <- as.data.frame(full_fit.reg.inter, pars=“par1”);
Does anyone have any ideas why I am running into the extract problem? Also Note: I was previously able to extract these values with no problem, but have since then modified my R code making changes which should have no impact running STAN section, just moving sections that occurred after my STAN run into new R codes to simplify my original code, and have also terminated Rstudio (which is my user interface) and restarted - rerun, and received the error when using extract.
I have the same issue with extract function, but it is not related to the source package. Any suggestion? Is this because this is a brm object?
rstan::extract(fit4)
Error in (function (classes, fdef, mtable) :
unable to find an inherited method for function ‘extract’ for signature ‘"brmsfit"’
Also, I don’t seem to be able to extract elements by fit4$chains or any other elements from the brm object. What is the best way to extract the elements of model results.