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:
posteriorstr or list of str, optional

List of paths to output.csv files.

posterior_predictivestr or list of str, optional

Posterior predictive samples for the fit. If endswith “.csv” assumes file.

predictionsstr or list of str, optional

Out of sample predictions samples for the fit. If endswith “.csv” assumes file.

priorstr or list of str, optional

List of paths to output.csv files

prior_predictivestr or list of str, optional

Prior predictive samples for the fit. If endswith “.csv” assumes file.

observed_datastr, optional

Observed data used in the sampling. Path to data file in Rdump or JSON format.

observed_data_varstr or list of str, optional

Variable(s) used for slicing observed_data. If not defined, all data variables are imported.

constant_datastr, optional

Constant data used in the sampling. Path to data file in Rdump or JSON format.

constant_data_varstr or list of str, optional

Variable(s) used for slicing constant_data. If not defined, all data variables are imported.

predictions_constant_datastr, optional

Constant data for predictions used in the sampling. Path to data file in Rdump or JSON format.

predictions_constant_data_varstr or list of str, optional

Variable(s) used for slicing predictions_constant_data. If not defined, all data variables are imported.

log_likelihooddict of {str: str}, list of str or str, 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. Use False to avoid this behaviour.

index_originint, optional

Starting value of integer coordinate values. Defaults to the value in rcParam data.index_origin.

coordsdict 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.

dimsdict of {str: list of str}, 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.

dtypesdict or str

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.

Returns:
InferenceData object