em.gauss: Estimating Ecoff by mixing Gaussians

Description Usage Arguments Details Value Examples

View source: R/EM_Gauss.R

Description

This function tries to find the Ecoff value of the input data, by aproximating the distribution by an mixing distribution of Gaussian distributions

Usage

1
2
em.gauss(y, mu, sigma2, pi, alpha, beta, epsilon = 1e-06,
  ecoff.quantile = 0.01, ecoff.comp = 0, max.iter = 1000)

Arguments

y

A data vector with observed values per bin.

mu

A vector with startvalues for mu

sigma2

A vector with startvalues for the variance

pi

A vector with startvalues for the mixing proportions

alpha

Shape parameter of inverse gamma distribution

beta

Scale parameter of inverse gamma distribution

epsilon

Convergence criterium

ecoff.quantile

Quantil which defines the ECOFF

ecoff.comp

Component which is used for calculating the ECOFF

max.iter

Maximum number of iterations

Details

The data vector y is defined as one row of the EUCAST Data of the Zone Diameter Data. The first value of y has to be the number of resistant observations. Then the following elements are the number of observations in bin 6 to 6+length(y)-1. A bin x includes all observations which had values form x-0.5 to x+0.5.

The function uses the EM Algorithm to fit a mixing distribution of Normals on the data. Based on the result of the converged mixing distribution the algorithm evaluates the ECOFF value. The ECOFF value is defined by default as the 0.01 quantile of the rightest distribution. The rightest density is defined as the distribution, where the sum of the pis firstly is greater than 0.3. Therefore, the distribution get ordered by their mean in ascending order and then the pis are commulated of the right.

Furthermore, to avoid, that one of the sigma2 converges to 0, the likelihood get penalized in dependence of sigma2. In detail, the penalization term follows a inverse gamma distribution with parameter alpha and beta.

Value

A list with components mu, var, pi, loglik and ecoff

Examples

1
2
3
4
5
6
7
8
y <- c(2, 4, 5,6,5,2,2, 1, 1, 2,  2, 1,6,7,8,7,6, 5, 2,1)
em.gauss(y = y,
         mu = c(8.36, 17.28),
         sigma2 = c(1.67,  8.4),
         pi = c(1/2, 1/2),
         alpha = 1,
         beta = 3,
         epsilon = 0.0001)

sp2019-antibiotics/emGauss documentation built on Nov. 5, 2019, 9:14 a.m.