mlVAR_GC {mnet} | R Documentation |
Testing Group Differences in mlVAR
Description
Does inference on group differences in mlVAR models using a permutation test. The function is a wrapper around the function mlVAR()
from the mlVAR
package.
Usage
mlVAR_GC(data, vars, idvar, dayvar = NULL,
beepvar = NULL, groups, test = "permutation",
paired = FALSE, estimator, contemporaneous,
temporal, nCores = 1, nP = 500, saveModels = FALSE,
verbose = FALSE, pbar = TRUE)
Arguments
data |
The data.frame containing the data (rows=cases, columns=variables) including the variables to be modeled, a unique id per subject, and potentially additional variables about the measurement procedure (see |
vars |
A character vector with the column names of the variables that should be included in the mlVAR models. |
idvar |
The name of the column containing the unique subject id. |
dayvar |
Optional: The name of the column indicating assessment day. Adding this argument makes sure that the first measurement of a day is not regressed on the last measurement of the previous day. IMPORTANT: only add this if the data has multiple observations per day. See also |
beepvar |
Optional: The name of the column indicating measurement occasion per day. Adding this argument will cause non-consecutive beeps to be treated as missing! See also |
groups |
The name of the column indicating group membership. |
test |
The type of test used. Defaults to |
paired |
Indicates whether samples are paired or not (independent). If |
estimator |
The estimator to be used. |
contemporaneous |
How should the contemporaneous networks be estimated? These networks are always estimated post-hoc by investigating the residuals of the temporal models. |
temporal |
How should the temporal effects be estimated? |
nCores |
Number of cores to use in computation. See also |
nP |
Number of permutations used to create the sampling distribution under the null hypothesis for the permutation test. Defaults to |
saveModels |
If true, the pair of mlVAR objects for each permutations are saved in the output. Defaults to |
verbose |
If true, the the verbose option in foreach, which is used in side |
pbar |
If true, a progress bar is shown. Defaults to |
Details
The output consists of a list with the following entries:
Value
Returns a list with the following entries:
EmpDiffs |
A list containing five matrices with the empirically observed differences (Group 1 - Group 2) in the between-person network, the fixed and random effects variances of the temporal network, and the fixed and random effects variances of the contemporaneous network. |
Pval |
Same structure as |
SampDist |
A list of arrays, containing the sampling distributions for between-person network, the fixed and random effects variances of the temporal network, and the fixed and random effects variances of the contemporaneous network. |
Models |
If |
Runtime |
The runtime of the function in minutes. |
Author(s)
Jonas Haslbeck <jonashaslbeck@protonmail.com>
References
Epskamp, S., Waldorp, L. J., Mõttus, R., & Borsboom, D. (2018). The Gaussian graphical model in cross-sectional and time-series data. Multivariate behavioral research, 53(4), 453-480.
Examples
# Use simulated example data loaded with package
head(ExampleData)
# Call Permutation test
out <- mlVAR_GC(data = ExampleData,
vars = c("V1", "V2", "V3"),
idvar = "id",
groups = "group",
nCores = 2, # choose max cores possible on your machine
nP = 2) # Should be more in practice, see paper!
# P-values for the five parameter types:
out$Pval
# e.g., we see that there is a small p-value for
out$Pval$Phi_mean[1,2]
# which is a parameter with a true group difference
# (which we know since this is simulated data)
# The observed group differences (i.e., the test statistics)
# Can be found in:
out$EmpDiffs
# Specifically, the difference is: group 1 - group 2
# For example:
out$EmpDiffs$Phi_mean[1,2,]
# The true group difference was -0.4