bebi103.hmc.extract_variable
- bebi103.hmc.extract_variable(samples, variable, inc_warmup=False)
Extracts sample of a variable as a Numpy array.
- Parameters:
samples (dict or cmdstanpy.CmdStanMCMC instance) – MCMC samples as either a dictionary where each entry is a 2D Numpy array or a cmdstanpy.CmdStanMCMC instance
variable (string) – The name of the variable to extract
inc_warmup (bool, default False) – If True, include warmup when extracting from a cmdstanpy.CmdStanMCMC instance. Ignored if samples is a dict.
- Returns:
output – The first dimension of the output is the chain. The second is the draw. If the variable is scalar, the result is two- dimensional. If the variable is vector-valued, the third dimension is the index of the dimension of the vector. If the variable is matrix-valued, the third and fourth dimensions are the matrix indices. And so on.
- Return type:
Numpy array of at least two dimensions