MFKMO_Null_Model: Optimal KM for Quantitative Traits in Multivariate Family...

Description Usage Arguments Value

View source: R/MFKMO_Null_Model.R

Description

This function (MFKMO) is used to perform optimal KM analysis for quantitative traits in GWAS multivariate family data.
# It takes familial correlation as a kinship matrix

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
MFKMO_Null_Model(
  phenotype,
  trait,
  yid,
  gid,
  fa,
  mo,
  covariates = NULL,
  Ninitial = 10,
  method = "Nelder-Mead",
  LL.output = NULL,
  cor = NULL,
  eq.cov.effect = F
)

Arguments

phenotype

A vector of quantitative trait in the analysis (class: vector). The order should match the vector yid. Subjects with missing phenotypes are only used for kinship calculation.

trait

A vector of multivariate traits (class: vector). The order should match the vector yid. No missing.

yid

A vector of id (class: vector). Although it doesn't have to be sorted, observations from the same subject have to be connected with each other. The repeated id numbers indicate multiple time points for one subject. Make sure it is not a factor. No missing.

gid

A vector of id mapping to samples in genotype file (class: vector). So the order of samples in gid must be the same as the order in genotypes. Make sure it is not a factor. Although gid doesn't have to be in the same order as yid, it is suggested to make them sorted in the same order in order to make all files easily to be tracked. No missing.

fa

A vector of father id (class: vector). The father id indicates the father of each subject. If this subject has no father in this data, the value is set to "NA". Make sure it is not factor.

mo

A vector of mother id (class: vector). The mother id indicates the mother of each subject. If this subject has no mother in this data, the value is set to "NA". Make sure it is not factor.

covariates

A matrix of covariates (class: data.frame). The order of rows should match the vector yid. Default NULL. Subjects with missing covariates are only used for kinship calculation.

Ninitial

The number of times to try initial values. The default is 10 times. If Ninitial=1, the initial value "cor" is always equal to correlation(trait1|covariates, trait2|covariates). One should try multiple initial values in order to find max log-likelihood. This could be time consuming, depends on the sample size. The good thing is that null model only needs to be fitted once for the whole genome, so it's worth trying many initial values.

method

The optimization method used in null model. The default method is an implementation of that of Nelder and Mead (1965), that uses only function values and is robust but relatively slow. Method "L-BFGS-B" is that of Byrd et. al. (1995) which allows box constraints, that is each variable can be given a lower and/or upper bound.

LL.output

Output all tried initial values and corresponding log-likelihoods. The initial value with max log-likelihood is used in the algorithm and it can be used for replication. The output file can be renamed.

cor

Initial value. By default, it's not given, the program tries to find the best initial value. Once it's given, the program uses it as the only initial value. This is useful when one already knows the initial value corresponding to max log-likelihood.

eq.cov.effect

Whether assume equal covariates effects on different traits (Default=False).

Value

output: object as input for MFKMO


KMgene documentation built on July 8, 2020, 6:09 p.m.