vbdmR: fit a discrete mixture model (R implementation)

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/vbdmR.R

Description

Fits a discrete mixture model for rare variant association analysis. Uses an approximate variational Bayes coordinate ascent algorithm for a computationally efficient solution. This is the slow but well documented R implementation.

Usage

1
2
vbdmR(y, G, X=NULL, tol=1e-4, thres=0.05, scaling=TRUE, 
      hyper=c(2,2))

Arguments

y

A vector of continuous phenotypes.

G

A matrix of genotypes or variables of interest.

X

An optional matrix of covariates.

tol

The tolerance for convergence based on the change in the lower bound on the marginal log likelihood in the vbdm algorithm.

thres

If the matrix is of genotypes, then this specifies a minor allele frequency threshold. Variants with a MAF greater than this threshold are excluded from the analysis.

scaling

Whether or not to scale the genotypes to have mean 0 and variance 1.

hyper

The hyperparameters for the prior defined over the mixing probability parameter. The first hyperparameter is the alpha parameter, and the second is the beta parameter.

Details

This function contains the much slower, but well documented R implementation of the vbdm algorithm. This function does not have all of the sanity checks that vbdm has, and should therefore only be used for diagnostic purposes.

Value

y

The phenotype vector passed to vbdmR.

G

The genotype matrix passed to vbdmR. Note that any variables that were dropped will be dropped from this matrix.

X

The covariate matrix passed to vbdmR. Will include intercept term if it was added earlier.

keep

A vector of indices of the kept variables in G (if any were excluded based on thres)

pvec

The vector of estimated posterior probabilities for each variable in G.

gamma

A vector of additive covariate effect estimates.

theta

The estimated effect of the variables in G.

sigma

The estimated error variance.

prob

The estimated mixing parameter.

lb

The lower bound of the marginal log likelihood.

lbnull

The lower bound of the marginal log likelihood under the null model.

lrt

The approximate likelihood ratio test based on the lower bounds.

p.value

A p-value computed based on lrt with the assumption that lrt~chi^2_1

Author(s)

Benjamin A. Logsdon (blogsdon@uw.edu)

References

Logsdon, B.A., et al. (2014) A Variational Bayes Discrete Mixture Test for Rare Variant Association., Genetic Epidemiology, Vol. 38(1), 21-30 2014

See Also

vbdm, burdenPlot

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
#generate some test data
library(vbdm)
set.seed(3)
n <- 1000
m <- 20
G <- matrix(rbinom(n*m,2,.01),n,m);
beta1 <- rbinom(m,1,.2)
y <- G%*%beta1+rnorm(n,0,1.3)

#compare implementations
res1 <- vbdm(y=y,G=G);
res2 <- vbdmR(y=y,G=G);
T5 <- summary(lm(y~rowSums(scale(G))))$coef[2,4];
cat('vbdm p-value:',res1$p.value,
  '\nvbdmR p-value:',res2$p.value,
  '\nT5 p-value:',T5,'\n')
#vbdm p-value: 0.001345869 
#vbdmR p-value: 0.001345869 
#T5 p-value: 0.9481797 

vbdm documentation built on May 2, 2019, 2:37 a.m.

Related to vbdmR in vbdm...