buildItem: Build a model suitable for a single item genome-wide...

Description Usage Arguments Details Value WLS Technical Note See Also Examples

View source: R/model.R

Description

\lifecycle

maturing

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
buildItem(
  phenoData,
  depVar,
  covariates = NULL,
  ...,
  fitfun = c("WLS", "ML"),
  minMAF = 0.01,
  gxe = NULL,
  exogenous = NA,
  pred = "snp"
)

Arguments

phenoData

a data.table containing the phenotypic data. Can include more variables than those included in the analysis, but GW-SEM will only use the items/covariates that are specified in the model.

depVar

the name of items to predict

covariates

a character list of covariates that the latent variable will be regressed upon. The default vaule is NULL, but this is a silly value as typically analysts will include e.g. age, sex, and ancestry principle components in the analysis.

...

Not used. Forces remaining arguments to be specified by name.

fitfun

The fitfun argument specifies which fit function should be used in evaluating the GWAS model. Users may choose between the relatively rapid "WLS", or the slower but asymptotically optimal "ML". In many cases the the differences between the fit functions is trivial and the faster "WLS" option should be used, but in some situations the differences can be quite meaningful (such as when data are Missing at Random - MAR).

minMAF

The minimum valid minor allele frequency (MAF). Large differences between the variances of two variables in the same model can cause optimization failures that invalidate the model. Further, very small minor allele frequencies are more affected by outliers or influential observations. Accordingly, users can specify the minimum allowable MAF. The default value is MAF > .01. This option only works when the SNP is entered into the model as an observed variable. If you wish to filter out small MAF alleles for all models, use other software programs such as PLINK.

gxe

The observed variable name that will be used to moderate (interact with) the effect of the SNP on the phenotypes. For example, you may want to moderate the SNP regression by sex. In this situation, you would specify gxe = "sex" and add "snp_sex" to the list of covariates.

exogenous

This argument specifies how you would like to integrate the covariates into the analysis. If exogenous = T, each items will be directly regressed on each covariate. If exogenous = F, the latent factor(s) will be directly regressed on each covariate. Setting exogenous = T does not assume that the items are related to the covariates proportional to their factor loadings (which is probably preferable in most cases).

pred

character vector of variables that predict the phenotype(s). These predictors are always endogenous to the model (unaffected by the 'exogenous' option).

Details

You can pass the result of this function to GWAS to run a GWAS.

Ordinal indicator thresholds are setup by setupThresholds. You can plot the model using omxGraphviz.

Value

A MxModel

WLS Technical Note

When the depVar item is/are continuous, covariates are endogenous (the default), and the fit function is WLS then the cumulants method is used to create observed summary statistics (see mxFitFunctionWLS). In other cases, the marginals method is used. The cumulants method is more accurate than marginals. The difference in accuracy becomes vivid when comparing estimates against the ML fit function.

See Also

Other model builder: buildOneFacRes(), buildOneFac(), buildTwoFac()

Examples

1
2
3
pheno <- data.frame(anxiety=cut(rnorm(500), c(-Inf, -.5, .5, Inf),
                    ordered_result = TRUE))
m1 <- buildItem(pheno, 'anxiety')

gwsem documentation built on Jan. 18, 2022, 1:09 a.m.