| starting_values | R Documentation |
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.
starting_values(
x,
covariance = c("auto", "drop", "keep"),
what = c("all", "measurement")
)
x |
A fitted |
covariance |
|
what |
|
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.
get_results() for the values as tidy tables.
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)
as.data.frame(starting_values(fit))
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.