Learn R Programming

AdaptGauss (version 1.6)

LikelihoodRatio4Mixtures: Likelihood Ratio for Gaussian Mixtures

Description

Computes the likelihood ratio for two Gaussian Mixture Models.

Usage

LikelihoodRatio4Mixtures(Data,NullMixture,OneMixture,PlotIt,LowerLimit,UpperLimit)

Value

List with

Pvalue

the error that we make, if we accept OneMixture as the better Model over the NullMixture

NullLogLikelihood

log likelihood of GMM Null

OneLogLikelihood

log likelihood of GMM One

Arguments

Data

Data points.

NullMixture

A Matrix: cbind(Means0,SDs0,Weights0) or cbind(Means0,SDs0,Weights0,IsLog0). The null model; usually with less Gaussians than the OneMixture

OneMixture

A Matrix: cbind(Means1,SDs1,Weights1) or cbind(Means1,SDs1,Weights1,IsLog1). The alternative model usually with more Gaussians than the OneMixture.

PlotIt

Optional: Boolean, if TRUE a Plot of the compared cdf's and the KS-test distribution (Diff) is shown

LowerLimit

Optional: test only for Data >= LowerLimit, Default = min(Data) i.e all Data.

UpperLimit

Optional: test only for Data <= UpperLimit, Default = max(Data) i.e all Data.

Author

Alfred Ultsch, Michael Thrun, Catharina Lippmann

Examples

Run this code

  
  data=c(rnorm(1000),rnorm(2000)+2,rnorm(1000)*2-1)
  if (FALSE) Vals=AdaptGauss(data,c(-1,0,2),c(2,1,1),c(0.25,0.25,0.5),0.3,-6,6)
  NullMixture=cbind(Vals$Means,Vals$SDs,Vals$Weights)
  
  if (FALSE) Vals2=AdaptGauss(data,c(-1,0,2,3),c(2,1,1,1),c(0.25,0.25,0.25,0.25),0.3,-6,6)
  OneMixture=cbind(Vals2$Means,Vals2$SDs,Vals2$Weights)
  
  if (FALSE) {
  res=LikelihoodRatio4Mixtures(data,NullMixture,OneMixture,T)
  }
 

Run the code above in your browser using DataLab