Extract parameters from fitted model for use as initial values
Source:R/extract_optim_parameters.R
extract_optim_parameters.galamm.Rd
This function extracts parameter values from a fitted model object in a form that can be directly provided as initial values for a new model fit.
Arguments
- object
Object of class
galamm
returned fromgalamm
.
Value
A list
object containing the following elements:
theta
Numerical vector of variance components, i.e., entries of the lower Cholesky form of the covariance matrix of random effects.beta
Fixed regression coefficients.lambda
Factor loadings.weights
Weights for heteroscedastic residuals.
See also
Other optimization functions:
galamm_control()
Examples
# Fit linear mixed model with heteroscedastic residuals
mod <- galamm(
formula = y ~ x + (1 | id),
weights = ~ (1 | item),
data = hsced
)
# Extract parameters
start <- extract_optim_parameters(mod)
# Fit again using the Nelder-Mead algorithm, using start as initial values:
mod_nm <- galamm(
formula = y ~ x + (1 | id),
weights = ~ (1 | item),
data = hsced,
start = start,
control = galamm_control(method = "Nelder-Mead")
)