The function trains a predictive model of a given mediator and then predicts the genetically regulated intensity of it in the training set via cross-validation.

trainMediator(
  medInt,
  pheno = NULL,
  mediator,
  medLocs,
  snps,
  snpLocs,
  covariates,
  seed,
  k,
  cisDist = 5e+05,
  prune = T,
  windowSize = 50,
  numSNPShift = 5,
  ldThresh = 0.5,
  snpAnnot = NULL
)

Arguments

medInt

character, identifier for mediator of interest

mediator

data frame, mediator intensities

medLocs

data frame, MatrixEQTL locations for mediators

snps

data frame, SNP dosages

snpLocs

data frame, MatrixEQTL locations for SNPs

covariates

data frame, covariates

seed

integer, random seed for splitting

k

integer, number of training-test splits

prune

logical, TRUE/FALSE to LD prune the genotypes

windowSize

integer, window size for PLINK pruning

numSNPShift

integer, shifting window for PLINK pruning

ldThresh

numeric, LD threshold for PLINK pruning

parallel

logical, TRUE/FALSE to run glmnet in parallel

cores

integer, number of parallel cores

Value

final model for mediator along with CV R2 and predicted values