Skip to contents

Shows which parameters are estimated, fixed, or constrained; their resolved priors and initial values; and the mapping from term names to formula terms. Returns editable prior, starting-value, and tuning templates without running the sampler.

Usage

magCompSettings(object)

Arguments

object

A prepared or fitted magComp model.

Details

Prepare a model with magComp() and control = magCompControl(run_sampler = FALSE). Inspect magCompSettings(model), edit the returned priors and/or starting lists, and pass them to a new magComp() call with the same formulas and data.

The returned prior template explicitly records resolved block/term settings. Editing a global default does not override an explicit block/term entry; edit the relevant entry or remove it to inherit a default. The initial values shown for fitted objects are their original starts, not posterior summaries. Use magCompStarting(fit, use = "last") or use = "mean" to extract starts from a previous fit.

Constraints on factor scales and loadings, fixed smoothing variances, and the magnitude-size estimation restriction are displayed. Priors and starts can be overridden selectively. Unsupported names and dimensions are rejected.

Value

A magCompSettings object containing parameters (a data frame of parameter settings, including a manuscript symbol column in ASCII), terms (formula term names and labels), priors (a resolved magCompPriors object), and starting (a complete initial-value template), plus tuning (initial covariance proposal standard deviations). Printing shows the two tables.

See also

magCompNotation for mathematical symbols and software names.

Examples

rows <- expand.grid(plot = paste0("p", 1:8), cls = c("a", "b"))
rows$count <- rep(1:8, 2)
rows$area <- 1
rows$stand <- rep(rep(c("s1", "s2"), each = 4), 2)
dat <- magCompData(rows, unit = plot, category = cls,
                   tree_count = count, design = fixedArea(area))
model <- magComp(dat, magnitude = ~ iid(stand, name = "stand"),
                 control = magCompControl(run_sampler = FALSE))
settings <- magCompSettings(model)
settings
settings$priors$magnitude$terms$stand$variance <- c(shape = 3, scale = 1)
settings$starting$magnitude$terms$stand$variance <- 0.5
fit <- magComp(dat, magnitude = ~ iid(stand, name = "stand"),
                priors = settings$priors, starting = settings$starting,
                control = magCompControl(n_samples = 10, n_burn = 5,
                  chain_seeds = 7, verbose = FALSE))
magCompStarting(fit, use = "last")