mlGVAR {modnets}R Documentation

Fit GVAR models with multilevel data

Description

Fits a graphical vector autoregressive model to data containing multiple time points measured for multiple individuals.

Usage

mlGVAR(
  data,
  m = NULL,
  selectFUN = NULL,
  subjectNets = FALSE,
  idvar = "ID",
  exogenous = TRUE,
  center = TRUE,
  scale = TRUE,
  fixedType = "g",
  betweenType = "g",
  centerWithin = TRUE,
  scaleWithin = FALSE,
  rule = "OR",
  threshold = "none",
  verbose = TRUE,
  pcor = FALSE,
  fixedArgs = NULL,
  betweenArgs = NULL,
  bm = FALSE,
  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.

selectFUN

Choose a variable selection function. Can specify either "varSelect" or "resample" to use the corresponding functions. If you want to use the resample function though, then it is recommended to specify selectFUN as one of: "stability", "split", "bootstrap" in order to identify the specific method. If selectFUN = "resample", then it is recommended to add the sampMethod argument to the call to mlGVAR.

subjectNets

If TRUE, then subject-specific networks are fit for all subjects and returned in the final output. Otherwise, can specify a single value or a vector of values to represent which subjects to return individual networks for – specifically, the SUR network. One caveat is that variable selection methods are not applied to these subject-specific networks. Further modeling could be done using the output, however.

idvar

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

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.

center

Logical. Determines whether to mean-center the variables.

scale

Logical. Determines whether to standardize the variables.

fixedType

If logical, then any variable selection procedure specified by selectFUN will not be applied to the SUR network. Alternatively, a variable selection result, such as the output from either varSelect or modSelect, can be supplied to choose a specific constrained model in advance.

betweenType

If logical, then any variable selection procedure specified by selectFUN will not be applied to the SUR network. Alternatively, a variable selection result, such as the output from either varSelect or modSelect, can be supplied to choose a specific constrained model in advance.

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.

rule

Only applies to the between-subject network when a threshold is supplied. The "AND" rule will only preserve edges when both corresponding coefficients have p-values below the threshold, while the "OR" rule will preserve an edge so long as one of the two coefficients have a p-value below the supplied threshold.

threshold

Logical or numeric. If TRUE, then a default value of .05 will be set. Indicates whether a threshold should be placed on the models at each iteration of the sampling. A significant choice by the researcher.

verbose

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

pcor

See corresponding argument in the fitNetwork function

fixedArgs

A named list of arguments for the variable selection function can be provided here, specifically those that are meant to be applied to the SUR network estimation.

betweenArgs

A named list of arguments for the variable selection function can be provided for the between-subjects network.

bm

Logical. Determines whether the same moderators are applied in the between-subjects network. By default, the value of m only applies to the SUR network. This allows one to decide whether or not to apply those moderators in the between-subject network.

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 indiciate 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.

...

Additional arguments.

Details

Uses a pseudo-mixed effects approach, wherein fixed effects are estimated and random effects are approximated. See the work of Epskamp et al. (2018) for more details on how these types of effects are estimated.

Value

mlGVAR objects

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

mlGVARsim, lmerVAR, fitNetwork, varSelect, resample, net, netInts, plotNet

Examples


fit1 <- mlGVAR(mlgvarDat, 'M')

fit2 <- mlGVAR(mlgvarDat, 'M', bm = TRUE) # Fit the same moderator in the between-subjects network

fit3 <- mlGVAR(mlgvarDat, 'M', selectFUN = 'varSelect')


[Package modnets version 0.9.0 Index]