rhat: Display R-hat values for parameters of interest

Description Usage Arguments Value Details Examples

View source: R/post_estimation.R

Description

rhat calculates R-hat statistics for each specifide parameter of interest.

Usage

1
rhat(posterior, pars = NULL)

Arguments

posterior,

object of class rstan::stanfit.

pars

character vector, a vector of model parameter names e.g. c("theta", "zeta[1]", "alpha"). See Details below.

Value

Returns a named vector of R-hat values for the parameters specified by the pars argument.

Details

rhat is a helper function for users to quickly caluclate a common convergence statistic, R-hat, for each parameter. These statistics can be calculated for the following parameters inputted (alone or in combination) by the user: "theta", "theta_mu", "theta_sigma", "zeta", "alpha", "alpha_mu", "alpha_sigma", "gamma", "gamma_sigma", "omega_domain", "omega_user". Indexed variants of these parameter names can also be retrieved (e.g. c("theta[4]", "zeta[1]").

Examples

1
2
3
4
5
6
7
8
## Not run: 
simulated_data <- simulate_data()
posterior <- mediascores(Y = simulated_data$Y, group = simulated_data$group,
                         anchors = simulated_data$anchors,
                         variational = TRUE)
rhat(posterior, pars = c("theta", "zeta"))

## End(Not run)

SMAPPNYU/mediascores documentation built on May 18, 2019, 1:30 p.m.