View source: R/design_effect.R
design_effect | R Documentation |
The design effect quantifies the degree a sample deviates from a simple random sample. In the multilevel modeling context, this can be used to determine whether clustering will bias standard errors and whether the assumption of independence is held. Thus, it can help determine whether multilevel modeling is appropriate for a given data set. The calculations are based on (Hox et al., 2018) and uses the mlmhelpr:icc
function. A rule of thumb is that design effects smaller than 2 may indicate multilevel modeling is not necessary; however, this is dependent on cluster size and other factors (Lai et al., 2015).
Note: For models with random slopes, it is generally advised to interpret with caution. According to Kreft and De Leeuw (1998), "The concept of intra-class correlation is based on a model with a random intercept only. No unique intra-class correlation can be calculated when a random slope is present in the model" (p. 63). Since the intra-class correlation is part of the design effect calculation, caution is advised when interpreting models with random slopes.
design_effect(x, median = FALSE)
x |
model produced using the |
median |
Boolean argument (TRUE/FALSE) to use the median cluster size to compute the design effect. By default, the average cluster size is used. |
a data frame containing the cluster variable, number of clusters, average (or median) cluster size, intraclass correlation, and the design effect
hox2018mlmhelpr
\insertReflai2015mlmhelpr
\insertRefkreft1998mlmhelpr
fit <- lme4::lmer(mathach ~ 1 + ses + catholic + (1|id),
data=hsb, REML=TRUE)
design_effect(fit)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.