I have estimated a model using pystan
:
import pystan
stan_model = pystan.StanModel('stan_codes/stan_code_1.stan')
samples = stan_model.sampling(data = sdata, iter = 10, chains = 1, seed = 42)
model_results = {'mdata' : model_data, 'sdata': sdata, 'samples' : samples, 'model': stan_model}
Later I want to extract the "stuff" from the samples
into a dataframe
format. I am using
mdata, sdata, samples, model = [x for x in model_results.values()]
samples.extract().to_dataframe()
But I am getting an error:
AttributeError: 'collections.OrderedDict' object has no attribute 'to_dataframe'
According to the documentation the samples.extract()
should have an attribute to_dataframe()
, right ? Am i doing something wrong here ? I am using pystan version 2.18.0.0
Have you tried the extraction to DataFrame direct from the fit object
Something like ...