arviz.from_cmdstan#
- arviz.from_cmdstan(posterior=None, *, posterior_predictive=None, predictions=None, prior=None, prior_predictive=None, observed_data=None, observed_data_var=None, constant_data=None, constant_data_var=None, predictions_constant_data=None, predictions_constant_data_var=None, log_likelihood=None, index_origin=None, coords=None, dims=None, disable_glob=False, save_warmup=None, dtypes=None)[source]#
Convert CmdStan data into an InferenceData object.
For a usage example read the Creating InferenceData section on from_cmdstan
- Parameters
- posterior
str
orlist
ofstr
, optional List of paths to output.csv files.
- posterior_predictive
str
orlist
ofstr
, optional Posterior predictive samples for the fit. If endswith “.csv” assumes file.
- predictions
str
orlist
ofstr
, optional Out of sample predictions samples for the fit. If endswith “.csv” assumes file.
- prior
str
orlist
ofstr
, optional List of paths to output.csv files
- prior_predictive
str
orlist
ofstr
, optional Prior predictive samples for the fit. If endswith “.csv” assumes file.
- observed_data
str
, optional Observed data used in the sampling. Path to data file in Rdump or JSON format.
- observed_data_var
str
orlist
ofstr
, optional Variable(s) used for slicing observed_data. If not defined, all data variables are imported.
- constant_data
str
, optional Constant data used in the sampling. Path to data file in Rdump or JSON format.
- constant_data_var
str
orlist
ofstr
, optional Variable(s) used for slicing constant_data. If not defined, all data variables are imported.
- predictions_constant_data
str
, optional Constant data for predictions used in the sampling. Path to data file in Rdump or JSON format.
- predictions_constant_data_var
str
orlist
ofstr
, optional Variable(s) used for slicing predictions_constant_data. If not defined, all data variables are imported.
- log_likelihood
dict
of {str:str
},list
ofstr
orstr
, optional Pointwise log_likelihood for the data. log_likelihood is extracted from the posterior. It is recommended to use this argument as a dictionary whose keys are observed variable names and its values are the variables storing log likelihood arrays in the Stan code. In other cases, a dictionary with keys equal to its values is used. By default, if a variable
log_lik
is present in the Stan model, it will be retrieved as pointwise log likelihood values. UseFalse
to avoid this behaviour.- index_origin
int
, optional Starting value of integer coordinate values. Defaults to the value in rcParam
data.index_origin
.- coords
dict
of {str: array_like}, optional A dictionary containing the values that are used as index. The key is the name of the dimension, the values are the index values.
- dims
dict
of {str:list
ofstr
}, optional A mapping from variables to a list of coordinate names for the variable.
- disable_globbool
Don’t use glob for string input. This means that all string input is assumed to be variable names (samples) or a path (data).
- save_warmupbool
Save warmup iterations into InferenceData object, if found in the input files. If not defined, use default defined by the rcParams.
- dtypes
dict
orstr
A dictionary containing dtype information (int, float) for parameters. If input is a string, it is assumed to be a model code or path to model code file.
- posterior
- Returns