lmerVAR {modnets}R Documentation

Mixed-effects modeling for the GVAR in multilevel data

Description

Proper estimation of mixed-effects GVAR models. This is an alternative fitting procedure to that provided by the mlGVAR function. The key differences are that this function can take significantly longer to fit, and it may fail when trying to fit especially large models.

Usage

lmerVAR(
  data,
  m = NULL,
  temporal = "default",
  contemp = "default",
  idvar = "ID",
  intvars = NULL,
  center = TRUE,
  scale = TRUE,
  centerWithin = TRUE,
  scaleWithin = FALSE,
  exogenous = TRUE,
  covariates = NULL,
  fix = NULL,
  verbose = TRUE,
  beepno = NULL,
  dayno = NULL,
  deleteMissing = TRUE
)

Arguments

data

n x k dataframe or matrix.

m

Character vector or numeric vector indicating the moderator(s), if any. Can also specify "all" to make every variable serve as a moderator, or 0 to indicate that there are no moderators. If the length of m is k - 1 or longer, then it will not be possible to have the moderators as exogenous variables. Thus, exogenous will automatically become FALSE.

temporal

Only affects the model for the temporal network and between-subjects network (which is derived from the temporal network). Options are "default", "correlated", "orthogonal", "fixed", "intfixed". "correlated" makes it so that all random-effect terms are correlated, and "orthogonal" makes it so they are not. "fixed" makes it so that there is only a random intercept, but no other random-effect terms related to the individual predictors. "intfixed" essentially mimics "orthogonal", with the exception that no interaction terms have random slopes. "default" will automatically set the value to "correlated" if there are 6 or fewer nodes in the network, and "orthogonal" otherwise. The reason for this is that models with correlated random effects take substantially longer to fit than those with orthogonal effects. The "default" option is designed to strike a balance between comprehensiveness and efficiency for the average user. It is recommended to set this value manually in order to produce results according to one's individual specifications.

contemp

Options are "default", "correlated", "orthogonal". "correlated" makes it so that random-effect terms are correlated, and "orthogonal" makes it so they are not. "default" will automatically set the value to "correlated" if there are 6 or fewer nodes in the network, and "orthogonal" otherwise. The reason for this is that models with correlated random effects take substantially longer to fit than those with orthogonal effects. The "default" option is designed to strike a balance between comprehensiveness and efficiency for the average user. It is recommended to set this value manually in order to produce results according to one's individual specifications.

idvar

Character string to indicate which variable contains the participant identification numbers.

intvars

Character vector to indicate which interaction terms to include in the model. Not necessary, but useful to add significant customization and explicitly state which interactions to include in the model.

center

Logical. Determines whether to mean-center the variables.

scale

Logical. Determines whether to standardize the variables.

centerWithin

Following the application of center and scale, this determines whether to center variables within individual subjects to create subject-centered values.

scaleWithin

Following the application of center and scale, this determines whether to scale variables within individual subjects to create subject-standardized values.

exogenous

Logical. Indicates whether moderator variables should be treated as exogenous or not. If they are exogenous, they will not be modeled as outcomes/nodes in the network. If the number of moderators reaches k - 1 or k, then exogenous will automatically be FALSE.

covariates

See corresponding argument in fitNetwork function. Can supply a numeric value or vector to indicate which variables are covariates, or can supply a list containing the individual covariates separately from the dataset.

fix

Character vector to indicate which variables to only create fixed effects terms for.

verbose

Logical. Determines whether to output progress bars and messages in the console during the fitting process.

beepno

Character string or numeric value to indicate which variable (if any) encodes the survey number within a single day. Must be used in conjunction with dayno argument.

dayno

Character string or numeric value to indicate which variable (if any) encodes the survey number within a single day. Must be used in conjunction with beepno argument.

deleteMissing

Logical. Determines whether to automatically perform listwise deletion if there are any missing values in the dataset.

Details

In the process of adding further documentation. More details to come. The method is referred to as the "two-step multilevel VAR" (Epskamp et al., 2018).

Value

A lmerVAR mixed-effects model with corresponding networks.

References

Epskamp, S., Waldorp, L. J., Mottus, R., & Borsboom, B. (2018). The gaussian graphical model in cross-sectional and time-series data. Multivariate Behavioral Research. 53, 453-580.

See Also

compareVAR, mlGVAR, mlGVARsim

Examples


# The options were chosen so that the function would take less time to run
x <- lmerVAR(mlgvarDat, 'M', temporal = "fixed", contemp = "orthogonal")


[Package modnets version 0.9.0 Index]