bimixt.model: bimixt.model

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

View source: R/r23.R

Description

Estimates mixture model components based on model type.

Usage

1
bimixt.model(case, control, type = "binorm", start.vals=NULL)

Arguments

case

a numeric vector of case values. NA's will be omitted.

control

a numeric vector of control values. NA's will be omitted.

type

a string specifying the mixture model to be used to fit the data. Valid types are "binorm", "2cc", "2cu", or "4c". These correspond to binormal, two component constrained, two component unconstrained, and four component models respectively. Defaults to "binorm".

start.vals

an (optional) list of starting values for the EM algorithm used in the "2cc", "2cu", and "4c" models. If not specified by the user, starting values are estimated from the data using kmeans clustering. The format of the lists are described in the details section.

Details

Starting values for the EM algorithm can be provided by the user. The starting values must be given as lists. Each element in the list is a named numeric vector of length 2 containing starting estimates for the model parameters. Names must match the names given below exactly (See examples section for "4c" model example).

For "2cc" start.vals is a list of 3 named vectors:

mu Starting estimates for component means
sig Starting estimates for component standard deviations
pi Starting estimates for component proportions. Must sum to 1.

For "2cu", start.vals is a list of length 4:

mu Starting estimates for component means.
sig Starting estimates for component standard deviations.
pi.cs Starting estimates for case component proportions. Must sum to 1.
pi.ctrl Starting estimates for control component proportions. Must sum to 1.

For "4c", start.vals is a list of length 6:

mu.cs Starting estimates for case component means.
mu.ctrl Starting estimates for control component means.
sig.cs Starting estimates for case component standard deviations.
sig.ctrl Starting estimates for control component standard deviations.
pi.cs Starting estimates for component proportions for cases. Must sum to 1.
pi.ctrl Starting estimates for component proportions for controls. Must sum to 1.

Value

Returns an object of type model with parameters specified by bc.binorm, bc.twocomp, or bc.fourcomp.

Author(s)

Michelle Winerip, Garrick Wallstrom, Joshua LaBaer

See Also

plot.model print.model summary.model

Examples

1
2
3
4
5
6
7
8
case=rmix(50,10,1.2,15,1,.7) 
control=rmix(50,10,1.2,15,1,.95) 
model1=bimixt.model(case=case, control=control, type="4c", start.vals=list(mu.cs=c(10,15), 

mu.ctrl=c(10,15),sig.cs=c(1.2,1),sig.ctrl=c(1.2,1),pi.cs=c(.7,.3),pi.ctrl=c(.95,.05))) 
model2=bimixt.model(case=case, control=control, type="2cu")  
model3=bimixt.model(case=case, control=control, type="2cc") 
model4=bimixt.model(case=case, control=control, type="binorm") 

bimixt documentation built on May 2, 2019, 3:31 p.m.