Description Usage Arguments Value Author(s) Examples
Fit a four-part mixture normal model to bivariate data. Assumes that data are distributed as one of N(0,1) x N(0,1) with probability pi0 N(0,s1^2) x N(0,1) with probability pi1 N(0,1) x N(0,t1^2) with probability pi2 N(0,s2^2) x N(0,t2^2) with probability 1-pi0-pi1-pi2 Fits the set of parameters (pi0,pi1,pi2,s1,s2,t1,t2) using an E-M algorithm
1 2 |
P |
matrix N x 2 of data points (Z scores or P-values) |
pars |
initial parameter values |
weights |
weights for points |
C |
include additive term C*log(pi0*pi1*pi2*(1-pi0-pi1-pi2)) in objective function to ensure identifiability of model |
maxit |
maximum number of iterations (supersedes tol) |
tol |
stop after increment in log-likelihood is smaller than this |
sgm |
force s1,s2,t1,t2 to be at least this value |
list with elements pars (fitted parameters), lhood (log likelihood) and hist (fitted parameters during algorithm
James Liley
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | pi0=0.5; pi1=0.15; pi2=0.25
s1=3; s2=2; t1=2; t2=3
true_pars=c(pi0,pi1,pi2,s1,s2,t1,t2)
n=100000; n0=round(pi0*n); n1=round(pi1*n); n2=round(pi2*n); n3=n-n0-n1-n2
zs=c(rnorm(n0,sd=1),rnorm(n1,sd=s1),rnorm(n2,sd=1),rnorm(n3,sd=s2))
zt=c(rnorm(n0,sd=1),rnorm(n1,sd=1),rnorm(n2,sd=t1),rnorm(n3,sd=t2))
Z=cbind(zs,zt)
f=fit.4g(Z)
f$pars
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.