Returns the starting-value list multilpa() accepts, taken from a fitted
model or from any object that already carries the parameter blocks, such as a
retained reference solution. This exists so that callers never assemble the
list by hand, and so that starting values are validated where they are built
rather than deep inside the fitting loop.
Arguments
- x
A fitted
multilpamodel, or a list carryingprofile_probabilities,group_probabilities, and whichever measurement blocks the model uses:meanswithvariancesorcovariancesfor continuous indicators,response_probabilitiesfor categorical ones. An all-categorical model needs no Gaussian block. Any other elements are ignored.- covariance
"auto"keepscovarianceswhen the object carries them,"drop"always returns the diagonal parameterization, and"keep"requirescovariancesand fails when they are absent.- what
"all"returns the measurement and mixing blocks."measurement"omitsprofile_probabilitiesandgroup_probabilities, which are sized for the model that produced them and must not be carried into a staged fit that changes the number of group classes. Pass the result asstartalongsidefixedinmultilpa().
Value
An object of class multilpa_start: the list multilpa() accepts as
start, with elements means, variances, profile_probabilities, and
group_probabilities, plus covariances when the full-covariance
parameterization is returned and response_probabilities when the object
carries a categorical measurement model. what = "measurement" drops
profile_probabilities and group_probabilities. The Gaussian blocks are
unnamed and indexed by position, matching what multilpa() expects of
start; read them with as.data.frame(), which labels the positions,
rather than out of the list. response_probabilities is the exception: the
list keeps each indicator's name and each block keeps its category names,
because those labels are what lets multilpa() attach a block to the item
it was estimated for rather than to whichever item happens to sit in that
position. A fit that names its categorical indicators in another order, or
that has other categories, therefore refuses the start with
latents_bad_start instead of reporting a likelihood for a measurement
model it never held. The list payload is unchanged by the class, so a
multilpa_start can be passed straight back as start.
See also
get_results() for the values as tidy tables.
Examples
set.seed(7)
example_data <- data.frame(
school = rep(seq_len(12), each = 10),
score_a = rnorm(120), score_b = rnorm(120)
)
fit <- multilpa(example_data, c("score_a", "score_b"), "school",
n_profiles = 2, n_group_classes = 1, n_starts = 2, seed = 1)
starting_values(fit)
#> Starting values: 2 profile(s), 2 continuous indicator(s)
#> Residual covariance: diagonal
#> Categorical indicators: 0
#> Mixing blocks: 1 group class(es)
#> Pass this to multilpa(start = ) as it is.
as.data.frame(starting_values(fit))
#> profile indicator mean variance standard_deviation
#> 1 1 1 0.31636979 0.7483074 0.8650476
#> 2 1 2 -0.05291982 0.9149785 0.9565451
#> 3 2 1 -1.11359585 0.1018727 0.3191750
#> 4 2 2 0.79091589 0.2857973 0.5346002
refit <- multilpa(example_data, c("score_a", "score_b"), "school",
n_profiles = 2, n_group_classes = 1, n_starts = 1,
start = starting_values(fit))
logLik(refit)
#> 'log Lik.' -323.0197 (df=9)
