Learn R Programming

umx (version 1.4.0)

umxGxE_window: umxGxE_window

Description

Make a 2-group GxE (moderated ACE) model using LOSEM. In GxE interaction studies, typically, the hypothesis that the strength of genetic influence varies parametrically (usuaally linear effects on path estimates) across levels of environment. Of course, the function linking genetic influence and context is not necessarily linear, but may react more steeply at the extremes, or take other, unknown forms. To avoid obscuring the underlying shape of the interaction effect, local structural equation modeling (LOSEM) may be used, and GxE_window implements this. LOSEM is a non-parametric, estimating latent interaction effects across the range of a measured moderator using a windowing function which is walked along the context dimension, and which weights subjects near the centrre of the window highly relative to subjects far above or below the window centre. This allows detecting and visualizing arbitrary GxE (or CxE or ExE) interaction forms.

Usage

umxGxE_window(selDVs = NULL, moderator = NULL, mzData = mzData, dzData = dzData, suffix = NA, weightCov = FALSE, target = NULL, width = 1, plotWindow = FALSE, return = c("estimates", "last_model"))

Arguments

selDVs
The dependent variables for T1 and T2, e.g. c("bmi_T1", "bmi_T2")
moderator
The name of the moderator variable in the dataset e.g. "age", "SES" etc.
mzData
Dataframe containing the DV and moderator for MZ twins
dzData
Dataframe containing the DV and moderator for DZ twins
suffix
(optional) separator, e.g. "_T" which will be used expand base names into full variable names: e.g.: 'bmi' --> c("bmi_T1", "bmi_T2")
weightCov
Whether to use cov.wt matrices or FIML default = FALSE, i.e., FIML
target
A user-selected list of moderator values to test (default = NULL = explore the full range)
width
An option to widen or narrow the window from its default (of 1)
plotWindow
whether to plot what the window looks like
return
whether to return the last model (useful for specifiedTargets) or the list of estimates (default = "estimates")

Value

- Table of estimates of ACE along the moderator

References

- Hildebrandt, A., Wilhelm, O, & Robitzsch, A. (2009) Complementary and competing factor analytic approaches for the investigation of measurement invariance. Review of Psychology, 16, 87--107.

Briley, D.A., Harden, K.P., Bates, T.C., Tucker-Drob, E.M. (2015). Nonparametric Estimates of Gene x Environment Interaction Using Local Structural Equation Modeling. Behavior Genetics.

See Also

Other Twin Modeling Functions: plot.MxModel, umxACESexLim, umxACEcov, umxACE, umxCF_SexLim, umxCP, umxGxE, umxIP, umxPlotACEcov, umxPlotCP, umxPlotGxE, umxPlotIP, umxSummaryACEcov, umxSummaryACE, umxSummaryCP, umxSummaryGxE, umxSummaryIP, umx_make_TwinData, umx

Examples

Run this code
library(umx);
# ==============================
# = 1. Open and clean the data =
# ==============================
# umxGxE_window takes a dataframe consisting of a moderator and two DV columns: one for each twin
mod = "age" # The name of the moderator column in the dataset
selDVs = c("bmi1", "bmi2") # The DV for twin 1 and twin 2
data(twinData) # Dataset of Australian twins, built into OpenMx
# The twinData consist of two cohorts. First we label them
# TODO: Q for OpenMx team: can I add a cohort column to this dataset?
twinData$cohort = 1; twinData$cohort[twinData$zyg %in% 6:10] = 2
twinData$zyg[twinData$cohort == 2] = twinData$zyg[twinData$cohort == 2]-5
# And set a plain-English label
labList = c("MZFF", "MZMM", "DZFF", "DZMM", "DZOS")
twinData$ZYG = factor(twinData$zyg, levels = 1:5, labels = labList)
# The model also assumes two groups: MZ and DZ. Moderator can't be missing
# Delete missing moderator rows
twinData = twinData[!is.na(twinData[mod]),]
mzData = subset(twinData, ZYG == "MZFF", c(selDVs, mod))
dzData = subset(twinData, ZYG == "DZFF", c(selDVs, mod))

# ========================
# = 2. Run the analyses! =
# ========================
# Run and plot for specified windows (in this case just 1927)
umxGxE_window(selDVs = selDVs, moderator = mod, mzData = mzData, dzData = dzData, 
		target = 40, plotWindow = TRUE)

## Not run: 
# # Run with FIML (default) uses all information
# umxGxE_window(selDVs = selDVs, moderator = mod, mzData = mzData, dzData = dzData);
# 
# # Run creating weighted covariance matrices (excludes missing data)
# umxGxE_window(selDVs = selDVs, moderator = mod, mzData = mzData, dzData = dzData, 
# 		weightCov = TRUE); 
# ## End(Not run)

Run the code above in your browser using DataLab