Learn R Programming

posterior (version 1.6.0)

extract_variable_matrix: Extract matrix of a single variable

Description

Extract an iterations x chains matrix of draws of a single variable. This is primarily used for convergence diagnostic functions such as rhat().

Usage

extract_variable_matrix(x, variable, ...)

# S3 method for default extract_variable_matrix(x, variable, ...)

# S3 method for draws extract_variable_matrix(x, variable, ...)

# S3 method for draws_df extract_variable_matrix(x, variable, ...)

# S3 method for draws_list extract_variable_matrix(x, variable, ...)

# S3 method for draws_rvars extract_variable_matrix(x, variable, ...)

Value

A matrix with dimension iterations x chains.

Arguments

x

(draws) A draws object or another R object for which the method is defined.

variable

(string) The name of the variable to extract. Must include indices for array variables (e.g. "x[1]", "y[1,2]"). To extract all dimensions from variables with indices, use extract_variable_array().

...

Arguments passed to individual methods (if applicable).

See Also

Other variable extraction methods: extract_variable(), extract_variable_array()

Examples

Run this code
x <- example_draws()
mu <- extract_variable_matrix(x, variable = "mu")
dim(mu)
rhat(mu)

Run the code above in your browser using DataLab