# mixalg.VEM: VEM algorithm In CAMAN: Finite Mixture Models and Meta-Analysis Tools - Based on C.A.MAN

## Description

When fitting finite mixture models two cases must be distinguished. The flexible support size case, where no assumption about the number of components `k` is made in advance and the fixed support size case. For the flexible support size case the VEM-algorithm can be used.

The algorithm proceeds as follows:
Step 1: Define an approximating grid lambda[1], ..., lambda[L]
Step 2: Use the VEM algorithm to maximize `L(P)` in the simplex Ω and identify grid points with positive support.

## Usage

 ```1 2 3``` ```mixalg.VEM(mix = NULL, obs=NULL, weights=NULL, data=NULL, pop.at.risk=NULL, var.lnOR=NULL, family="gaussian", limit=0.01, acc=10^(-7), numiter=5000, startk=50) ```

## Arguments

 `mix` A CAMAN-object which quantifies a finite mixture model and the input data. `obs` observed / dependent variable. Vector or colname of `data`. Must be specified! `weights` weights of the data. Vector or colname of `data`. Default is `NULL`. `family` the underlying type density function as a character ("gaussian", "poisson" or "binomial")! `data` an optional data frame. `obs`, `weights`, `pop.at.risk` and `var.lnOR` can be specified as column name of the 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 `data`. Default is`NULL`. `var.lnOR` variances of the data: These variances might be given when working with meta analyses! Vector or colname of `data`. Default is `NULL`. `limit` parameter to control the limit of union several components. Default is 0.01. `acc` convergence criterion. VEM and EM loops stop when deltaLL

## Value

The function returns a `CAMAN.VEM.object` object.

## Author(s)

Peter Schlattmann and Johannes Hoehne

## Examples

 ```1 2 3 4``` ```data(vitA) m0<-mixalg.VEM(obs="logrr",var.lnOR="var",family="gaussian", data=vitA,startk=20) plot(m0@totalgrid[,2],m0@totalgrid[,3],type="l",xlab="parameter",ylab="gradient") m1<-mixalg.EM(obs="logrr",var.lnOR="var" ,family="gaussian",p=c(1),t=c(0),data=vitA) ```

### Example output

```Loading required package: sp