r2mlm_long_manual: Compute R-squared values for longitudinal multilevel models,...

Description Usage Arguments Details Value See Also

View source: R/r2mlm_long_manual.R

Description

r2mlm_long_manual takes as input raw data and multilevel model (MLM) parameter estimates and outputs all relevant R-squared measures as well as an accompanying bar chart. This function extends the r2mlm_manual function by allowing researchers to input heteroscedastic variance estimates, and by providing level-specific measures for non-cluster-mean-centered models.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
r2mlm_long_manual(
  data,
  covs,
  random_covs,
  clusterID,
  gammas,
  Tau,
  sigma2,
  bargraph = TRUE
)

Arguments

data

Dataset with rows denoting observations and columns denoting variables

covs

list of predictors in the dataset that have fixed components of slopes included in the model (if none, set to NULL)

random_covs

list of predictors in the dataset that have random components of slopes included in the model (if none, set to NULL)

clusterID

variable name in dataset corresponding to cluster (e.g., person) identification

gammas

vector containing estimated fixed components of all slopes, listed in the order specified in covs (if none, set to NULL)

Tau

random effect covariance matrix; the first row and the first column denote the intercept variance and covariances and each subsequent row/column denotes a given random slope’s variance and covariances (to be entered in the order listed by random_covs)

sigma2

level-1 residual variance; can be entered as a single number, or as a set of numbers, for example corresponding to different residual variances at individual timepoints; if entered as a set of numbers, function will assume equal weights and take the raw average of these to estimate the expectation of the error variance

bargraph

Optional bar graph output, default is TRUE.

Details

This function reads in raw data as well as parameter estimates from the researcher’s previously fit longitudinal growth model (hence, any software program can have been used to fit the researcher’s longitudinal growth model prior to the use of this R function, so long as parameter estimates from the fitted model are recorded; note that this function accommodates non-longitudnal models as well). This function then outputs R-squared measures as well as variance decompositions and associated bar charts outlined in Rights & Sterba (2021). This function allows researchers to input heteroscedastic residual variance by including multiple estimates, for example, corresponding to individual timepoints. Users need not specify if predictors are person-mean-centered or not—the function will automatically output total, within-person, and between-person variance attributable to each potential source of explained variance (f1, f2, v1, v2, and m). Note, however, that the interpretations of these sources differ for person-mean-centered versus non-person-mean-centered models and that variance attributable to v2 will necessarily be 0 for person-mean-centered models.

Value

If the input is valid, then the output will be a list and associated graphical representation of R-squared decompositions. If the input is not valid, it will return an error.

See Also

Rights, J. D., & Sterba, S. K. (2021). Effect size measures for longitudinal growth analyses: Extending a framework of multilevel model R-squareds to accommodate heteroscedasticity, autocorrelation, nonlinearity, and alternative centering strategies. New Directions for Child and Adolescent Development, 2021, 65– 110. <doi:10.1002/cad.20387>

Other r2mlm single model functions: r2mlm3_manual(), r2mlm_manual(), r2mlm()


r2mlm documentation built on June 5, 2021, 1:05 a.m.