fit.2g: fit.2g

Description Usage Arguments Details Value Author(s) Examples

View source: R/fit.3g.R

Description

Fit a specific one-dimensional Gaussian mixture distribution to weighted SNP data

Usage

1
2
fit.2g(Z, pars = c(0.5, 1), weights = rep(1, length(Z)), C = 1, sgm = 0,
  ...)

Arguments

Z

a vector of length n

pars

vector containing initial values of pi0, s.

weights

SNP weights to adjust for LD; output from LDAK procedure

C

a term C log(pi0*1-pi0) is added to the likelihood so the model is specified.

sgm

force s ≥ sgm

...

other parameters passed to R's optim function

Details

Z_a,Z_d ~ pi0 N(0,1) + (1-pi0) N(0,s^2)

The model is characterised by the vector pars=(pi0,s). Under the null hypothesis that all SNPs are null, pi0=0.5, s=1.

This function finds the maximum pseudo-likelihood estimators for the paramaters of these three Gaussians, and the mixing parameters representing the proportion of SNPs in each category.

Value

a list of three objects: pars is the vector of fitted parameters under H1, h1value is the pseudo-likelihood under H1, h0value is the pseudolikelihood under H0.

Author(s)

Chris Wallace and James Liley

Examples

1
2
3
4
nn=100000
Z=c(rnorm(0.8*nn), rnorm(0.2*nn,sd=3)); weights=runif(nn)
yy=fit.2g(Z,pars=c(0.5,1),weights=weights)
yy$pars

jamesliley/subtest documentation built on May 18, 2019, 11:21 a.m.