| descriptives | R Documentation |
One row per variable, with the summaries you would look at before fitting and the one that decides whether a two-level model has anything to find: the intraclass correlation, the share of each variable's variance that lies between groups rather than within them.
descriptives(x, ...)
## S3 method for class 'data.frame'
descriptives(x, vars = NULL, id = NULL, by = NULL, ...)
## S3 method for class 'multilpa'
descriptives(x, by = NULL, ...)
## S3 method for class 'multilpa_transitions'
descriptives(x, by = NULL, ...)
## S3 method for class 'multilpa_covariates'
descriptives(x, by = NULL, ...)
x |
A data frame, or a fitted model of this package. A fit carries the
columns it was built from, so |
... |
Passed between methods. |
vars |
Character vector of column names to describe. Repeated names
are described once. For a data frame, defaults to every numeric column
that is not |
id |
Optional. The column identifying the groups rows are nested in.
Supplying it adds |
by |
Optional. |
An ICC near zero suggests little between-group mean variation in that variable. It does not rule out group classes that differ in other variables, profile prevalence, or other features of their distributions.
A base data.frame, one row per variable, or one row per variable
and by level, with the columns
variablecharacter: the column described.
ninteger: observations with a value.
n_missinginteger: observations without one.
mean,sd,min,maxnumeric, and NA_real_ for a variable
that is not numeric.
n_distinctinteger: distinct observed values, which is the useful summary where a mean is not.
n_groups,iccpresent only when id is known. icc is the
one-way random-effects estimate, and may be slightly negative when the
between-group mean square falls below the within-group one; that is the
estimator reporting no group structure, not an error. Rows with a
missing group ID do not contribute to either statistic.
A by column comes first, named after what it splits on and holding that
level's own value, NA for the stratum of rows whose stratifier is
missing. For every variable, n + n_missing summed over the strata equals
the number of input rows; that invariant is asserted before the table is
returned. Describing by a class the model assigned keeps that assignment
out of the described frame, so an indicator of the caller's own that is
named profile or group_class is summarized as itself, not replaced by
the assignment. A by whose name is one of the summary's own columns
cannot be told apart from them and raises latents_bad_data.
Bliese, P. D. (2000). Within-group agreement, non-independence, and reliability. In K. J. Klein & S. W. J. Kozlowski (Eds.), Multilevel theory, research, and methods in organizations.
multilpa() to fit, diagnostics() for the after-the-fit
counterpart.
descriptives(
course_engagement,
vars = c("browse", "lectures", "forum_read", "forum_post", "attendance"),
id = "student"
)
# A missing stratifier is a stratum of its own, not a silent loss and not
# missingness invented in a variable that has none.
descriptives(data.frame(cohort = c("A", "A", "B", NA), score = 1:4),
vars = "score", by = "cohort")
fit <- multilpa(
course_engagement,
vars = c("browse", "lectures", "forum_read", "forum_post", "attendance"),
id = "student", n_profiles = 2, n_group_classes = 2, n_starts = 4,
seed = 1
)
descriptives(fit)
descriptives(fit, by = "profile")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.