Skip to contents

Builds a coefficient table for already standardized predictors. This helper only constructs independent normal priors; it does not fit a model, rescale data or establish calibrated intervals. The package default remains no prior.

Usage

fixed_effect_priors(
  link,
  intercepts = character(),
  slopes = character(),
  standardized = FALSE,
  intercept_scale = 1,
  slope_scale = 1,
  additional_variance = 0
)

Arguments

Either "logit" or "probit".

intercepts

Character vector of exact model-matrix column names for intercepts, including item intercepts such as "traita" in ~ 0 + trait.

slopes

Character vector of exact model-matrix column names for slopes. The two groups must be distinct. No coefficient role is inferred from a name.

standardized

Must be explicitly TRUE: continuous predictors have already been centered and scaled to SD 0.5; binary predictors use a declared zero/one coding. The helper does not inspect or change the data.

intercept_scale, slope_scale

Positive scalar multipliers of the latent reference SD, separately for intercept and slope coefficients.

additional_variance

Nonnegative scalar variance chosen before fitting. This is an explicit reference for additional random-effect variation, not an estimate from the data or a default GLLVM variance.

Value

A data frame with coefficient, zero mean, and actual sd columns. Attributes record the link, residual reference variance, additional variance, multipliers and predictor convention. Inspect sd before fitting.

Details

The returned SD is scale * sqrt(v + additional_variance), where v = pi^2 / 3 for logit and v = 1 for probit. With unit multipliers and no additional variance these are approximately 1.814 and 1 respectively. These are latent-variance reference normals, not exact equivalent priors across links and not a guarantee of a flat prior on outcome probabilities in a GLLVM. A GLLVM item's additional variance depends on its loadings and other random effects; it is not automatically one or the latent rank.

This is not the original Gelman scaled Cauchy recommendation (intercept scale 10, slope scale 2.5), nor the full covariance transformation returned by MCMCglmm::gelman.prior() for the supplied design. That transformation can induce intercept-slope correlations. Arbitrary independent normal SDs, including the SD 10 comparison benchmark, can instead be supplied directly in a coefficient table; SD 10 is not a general recommendation.

References

Hadfield, J. MCMCglmm gelman.prior documentation and source: https://github.com/jarrodhadfield/MCMCglmm/blob/master/R/gelman.prior.R.

Examples

fixed_effect_priors("logit", intercepts = c("traita", "traitb"),
                    slopes = c("traita:x", "traitb:x"),
                    standardized = TRUE, intercept_scale = 2,
                    slope_scale = 1)
#>   coefficient mean       sd
#> 1      traita    0 3.627599
#> 2      traitb    0 3.627599
#> 3    traita:x    0 1.813799
#> 4    traitb:x    0 1.813799