mixalg.EM | R Documentation |
In the fixed support size case the number of components k
is assumed to
be known. Here the unknown parameters are the mixing weights p[j]
and the
parameters lambda[j]
of the subpopulation.
Estimation of these models' parameters is usually achieved by application of the EM algorithm.
mixalg.EM (mix = NULL, p, t, obs = NULL, weights = NULL, family = "gaussian",
data = NULL, pop.at.risk = NULL, var.lnOR = NULL, limit = 0.01,
acc = 10^(-7), numiter = 5000)
mix |
A CAMAN-object which quantifies a finite mixture model and the input data. |
p |
vector containing the starting values for p |
t |
vector containing the starting values for the distribution specific parameters (poisson-> |
obs |
observed / dependent variable. Vector or colname of |
weights |
weights of the data. Vector or colname of |
family |
the underlying type density function as a character ("gaussian", "poisson" or "binomial")! |
data |
an optional data frame. |
pop.at.risk |
population at risk: These data could be used to determine a mixture model for Poisson data. Vector or colname of |
var.lnOR |
variances of the data: These variances might be given when working with meta analyses! Vector or colname of |
limit |
parameter to control the limit of union several components. Default is 0.01. |
acc |
convergence criterion. VEM and EM loops stop when deltaLL<acc. Default is 10^(-7). |
numiter |
parameter to control the maximal number of iterations in the VEM and EM loops. Default is 5000. |
The function returns a CAMAN.object
object, thus the same as mixalg!
Peter Schlattmann and Johannes Hoehne
data(vitA)
m1<-mixalg.EM(obs="logrr",var.lnOR="var" ,family="gaussian",
p=c(1),t=c(0),data=vitA)
m2<-mixalg.EM(obs="logrr",var.lnOR="var" ,family="gaussian",
p=c(0.5,0.5),t=c(-0.3,0.2),data=vitA)
# apply EM-algorithm on an existing CAMAN.object:
data(thai_cohort)
mix0 <- mixalg(obs="counts", weights="frequency", family="poisson",
data=thai_cohort, numiter=18000, acc=0.00001,startk=25)
em0<-mixalg.EM(mix0,p=c(1),t=c(1))
em1<-mixalg.EM(mix0,p=c(0.7,0.3),t=c(2,9))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.