Learn R Programming

BayesTools (version 0.3.0)

transform_scale_samples: Transform standardized posterior samples back to original scale

Description

Transforms posterior samples from standardized continuous predictors back to the original scale. This function is used when predictors were standardized during model fitting via the formula_scale parameter.

Usage

transform_scale_samples(fit, formula_scale = NULL)

Value

transform_scale_samples returns posterior samples transformed back to the original predictor scale.

Arguments

fit

a fitted model object with formula_scale attribute, or a matrix of posterior samples

formula_scale

nested list containing standardization information keyed by parameter name. Each parameter entry contains scaling info (mean and sd) for each standardized predictor, e.g., list(mu = list(mu_x1 = list(mean = 0, sd = 1))). If fit is provided and has a formula_scale attribute, this will be used automatically.

Details

The function transforms regression coefficients and intercepts to account for predictor standardization using a combinatorial approach that correctly handles interactions of any order.

For a k-way interaction between standardized predictors, the expansion of \(\prod_{i} (x_i - \mu_i)/\sigma_i\) contributes to all lower-order terms. The contribution to a target term T from a source term S (where T is a subset of S's scaled components) is: $$(-1)^{|extra|} \cdot \prod_{i \in extra} \mu_i / \prod_{i \in S_{scaled}} \sigma_i$$ where \(extra = S_{scaled} \setminus T_{scaled}\).

See Also

JAGS_formula() JAGS_fit()