gwsem (version 0.1.5)

setupCovariates: Set up model covariates

Description

In GWAS, including a number of the first principle components as covariates helps reduce false positives caused by population stratification. This function adds paths from covariates to manifest indicators. Covariates are always treated as continuous variables (not ordinal).

Usage

setupCovariates(model, covariates)

Arguments

model

an instance of MxModel

covariates

a character vector naming covariates available in the model data

Value

The given MxModel with paths added from covariates to manifest indicators.

Details

This is not the only way to adjust a model for covariates. For example, in a single factor model (e.g., buildOneFac), it would be more appropriate to adjust the latent factor instead of the manifest indicators. However, covariate adjustments to latent variables are only possible with a maximum likelihood fit function (mxFitFunctionML). For mxFitFunctionWLS, only manifest indicators can be adjusted for covariates. This function always adjusts manifest indicators regardless of the fit function.

You generally do not need to call this function directly because it is already called by buildOneFac and similar. This function is provided for advanced users who wish to write their own model building functions.

Examples

Run this code
# NOT RUN {
m1 <- mxModel("test", type="RAM",
             latentVars = "sex", manifestVars = "anxiety")
m1 <- setupCovariates(m1, 'sex')
# }

Run the code above in your browser using DataCamp Workspace