Learn R Programming

umx (version 1.9.1)

umxACE_cov_fixed: Run a Cholesky with covariates ("fixed" / definition variables in the means style)

Description

Often, it is appropriate to include covariates in models. A simple method is to regress covariates from the data using lm. This is a 'fixed' effects approach. umx_residualize makes this easier, even on twin data, and with complex regression formulae.

Usage

umxACE_cov_fixed(name = "ACEcov", selDVs, selCovs = NULL, dzData, mzData,
  sep = NULL, dzAr = 0.5, dzCr = 1, addStd = TRUE, addCI = TRUE,
  boundDiag = 0, weightVar = NULL, equateMeans = TRUE, bVector = FALSE,
  thresholds = c("deviationBased", "WLS"), optimizer = NULL,
  autoRun = getOption("umx_auto_run"), suffix = NULL)

Arguments

name

The name of the model (defaults to"ACEcov").

selDVs

The variables to include from the data (do not include suffixes).

selCovs

The covariates to include from the data (do not include suffixes).

dzData

The DZ dataframe.

mzData

The MZ dataframe.

sep

Separator text between basename for twin variable names. Often "_T". Used to expand selDVs into full column names, i.e., "dep" --> c("dep_T1", "dep_T2").

dzAr

The DZ genetic correlation (defaults to .5, vary to examine assortative mating).

dzCr

The DZ "C" correlation (defaults to 1: set to .25 to make an ADE model).

addStd

Whether to add the algebras to compute a std model (defaults to TRUE).

addCI

Whether to add intervals to compute CIs (defaults to TRUE).

boundDiag

= Whether to bound the diagonal of the a, c, and e matrices.

weightVar

(optional) Variable containing the weights to apply to data.

equateMeans

Whether to equate the means across twins (defaults to TRUE).

bVector

Whether to compute row-wise likelihoods (defaults to FALSE).

thresholds

How to implement ordinal thresholds: c("deviationBased", "left_censored").

optimizer

(optionally) set the optimizer. Default (NULL) does nothing.

autoRun

Whether to run the model and return it, or just return it.

suffix

deprecated synonym for 'sep' (see above).

Value

- mxModel of subclass mxModel.ACEcov

Details

While these estimates are unbiased, modeling this regression in the means element of the twin model allows correct tests for significance. Also, if DVs are not continuous, the lm-based approach cannot be used.

For this reason, we have implemented umxACE_cov_fixed, which allows including covariates as definition variables. The following figure shows how the ACE model with fixed covariates appears as a path diagram:

On the plus side, there is no distributional assumption for this method. A downside of this approach is that all covariates must be non-NA, thus dropping any rows where one or more covariates are missing. This is wasteful of data, but often cannot be avoided (though see note below).

note: An alternative is the umxACEcov 'random' option. This model adds covariates to the expected covariance matrix, thus allowing all data to be preserved. The (BIG) downside is that this method has a strong assumption of multivariate normality. Covariates like age, which are perfectly correlated in twins cannot be used. Covariates like sex, which are ordinal, violate the normality assumption.

See Also

umx_residualize umxACE

Other Twin Modeling Functions: plot.MxModel, umxACESexLim, umxACEcov, umxACEv, umxACE, umxCF_SexLim, umxCP, umxGxE_window, umxGxE, umxIP, umxPlotACEcov, umxPlotCP, umxPlotGxE, umxPlotIP, umxReduceACE, umxSummaryACEcov, umxSummaryACEv, umxSummaryACE, umxSummaryCP, umxSummaryGxE, umxSummaryIP, umx_long2wide, umx_wide2long, umx, xmu_twin_check

Examples

Run this code
# NOT RUN {
require(umx)
data(twinData) # ?twinData from Australian twins.
# Pick the variables
selDVs  = "ht"
selCovs = "age"
mzData <- twinData[twinData$zygosity %in% "MZFF", ]
dzData <- twinData[twinData$zygosity %in% "DZFF", ]
m1 = umxACE_cov_fixed(selDVs = selDVs, selCovs = selCovs, 
	     dzData = dzData, mzData = mzData, sep = "")
m2 = umxACE(selDVs = selDVs, dzData = dzData, mzData = mzData, sep = "")
# =======================
# = lm-based equivalent =
# =======================
df_res = umx_residualize(ht ~ age, suffixes = c("1", "2"), data = twinData)
mzData <- df_res[df_res$zygosity %in% "MZFF", ]
dzData <- df_res[df_res$zygosity %in% "DZFF", ]
m3 = umxACE("lm_based", selDVs = selDVs, dzData = dzData, mzData = mzData, sep = "")
# ===============================
# = Example with two covariates =
# ===============================
selDVs  = "wt"
selCovs = c("age", "cohort")
twinData$cohort1 = twinData$cohort2 = as.numeric(as.factor(twinData$cohort))
mzData <- twinData[twinData$zygosity %in% "MZFF", ]
dzData <- twinData[twinData$zygosity %in% "DZFF", ]
m1 = umxACE_cov_fixed(selDVs = selDVs, selCovs = selCovs,
	     dzData = dzData, mzData = mzData, sep = "")
m1 = umxACE(selDVs = selDVs, dzData = dzData, mzData = mzData, sep = "")
# }

Run the code above in your browser using DataLab