Function 'extract' for other package that build a 'stanfit' object


I would like use the function \mathtt{extract} for a \mathtt{stanfit} object. The model was created in \mathtt{TMB} (is not a bayesian software) but with the library \mathtt{tmbstan} I can obtain this type of object directly. When I want use this function appear the following error:

Error in UseMethod(“extract_”) :
no applicable method for ‘extract_’ applied to an object of class “stanfit”

but, my model is a \mathtt{stanfit} object:

[1] “stanfit”
[1] “rstan”

My question is, how works this function and how I could (eventually) connect it with \mathtt{tmbstan}?


1 Like

You may have to use rstan::extract to avoid namespace conflicts.

1 Like

Thanks @bgoodri!! this works perfectly