grad_logl: grad_logl

Description Usage Arguments Value Author(s) Examples

View source: R/fit.3g.R

Description

Compute gradient of pseudo-log likelihood for a dataset at given parameters

Usage

1
grad_logl(Z, pars, weights = rep(0, dim(Z)[1]), C = 1)

Arguments

Z

an n x 2 array; Z[i,1], Z[i,2] are the Z_d and Z_a scores respectively for the ith SNP

pars

vector containing initial values of (pi0,pi1,tau,sigma1,sigma2,rho).

weights

SNP weights to adjust for LD; output from LDAK procedure

C

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

Value

Vector of partial derivatives of pseudo-log-likelihood with respect to each of the parameters in pars

Author(s)

James Liley

Examples

1
2
3
4
5
nn=100000
Z=abs(rbind(rmnorm(0.8*nn,varcov=diag(2)), rmnorm(0.15*nn,varcov=rbind(c(1,0),c(0,2^2))), rmnorm(0.05*nn,varcov=rbind(c(3^2,2),c(2,4^2))))); weights=runif(nn)
grad(Z,pars=c(0.7,0.2,2.5,1.5,3,1),weights=weights,C=1)
yy$pars
plot(yy,rlim=2)

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