Package 'emg'

Title: Exponentially Modified Gaussian (EMG) Distribution
Description: Provides basic distribution functions for a mixture model of a Gaussian and exponential distribution.
Authors: Shawn Garbett, Mark Kozdoba
Maintainer: Shawn Garbett <[email protected]>
License: GPL-2 | file LICENSE
Version: 1.0.9
Built: 2025-03-01 05:21:09 UTC
Source: https://github.com/spgarbet/emg

Help Index


Exponentially Modified Gaussian (EMG) Distribution

Description

Provide basic functions for a mixture of gaussian and exponential distributions.

Details

Package: emg
Type: Package
Date: 2012-01-03
License: GPL 2.0
LazyLoad: yes

Provides basic distribution functions for the EMG model, pemg, demg, qemg and remg. As well as an MLE estimation routine emg.mle.

Author(s)

Shawn Garbett, Mark Kozdoba, Maintainer: Shawn Garbett <[email protected]>

References

Gladney H.M., B.F. Dowden, J.D. Swalen. Computer-Assisted Gas-Liquid Chromatography. Anal. Chem., 1969, 41(7):883-8.

Golubev A. Exponentially modified Gaussian (EMG) relevance to distributions related to cell proliferation and differentiation. J Theor Biol. 2010 Jan 21;262(2):257-66.

Grushka E. Charaterization of Exponentially Modified Peaks in Chromatography. Anal. Chem., 1972, 44(11):1733-38.

See Also

EMG emg.mle Normal Exponential

Examples

y <- remg(200)
  hist(y, freq=FALSE, ylim=c(0, 0.35), breaks=20)
  x <- 1:100/100 * 11 - 3
  lines(x, demg(x))
  m <- emg.mle(y)
  sqrt(diag(m@vcov)) # Show stderr in estimate
  ks.test(y, "pemg", 0, 1, 1)

The Exponential Modified Gaussian (EMG) Distribution

Description

Density, distribution function, quantile function and random generation for the EMG distribution with three parameters, mu, sigma, lambda. The distribution is a mixture of an exponential and gaussian (normal) distribution.

Usage

demg(x, mu = 0, sigma = 1, lambda = 1, log = FALSE)
pemg(q, mu = 0, sigma = 1, lambda = 1, lower.tail = TRUE, log.p = FALSE)
qemg(p, mu = 0, sigma = 1, lambda = 1, lower.tail = TRUE, log.p = FALSE)
remg(n, mu = 0, sigma = 1, lambda = 1)

Arguments

x, q

vector of quantiles.

p

vector of probabilities.

n

number of observations. If length(n) > 1, the length is taken to be the number required.

mu

mu value, the mean of the normal component. Note: this is not the mean of the distribution. The mean is mu+1/lambda

sigma

sigma value, the deviation of the normal component. Note: this is not the deviation of the distribution

lambda

lambda value (1/kappa), the rate of the exponential component.

log, log.p

logical; if TRUE, probabilities p are given as log(p).

lower.tail

logical; if TRUE(default), probabilities are P[X <= x] otherwise, P[X > x].

Details

If mean or sd are not specified they assume the default values of 0 and 1, respectively.

The EMG distribution has density

f(x)=12λeλ2(2μ+λσ22x)erfc((μ+λσσx)/(2σ))f(x) = \frac{1}{2} \lambda e^{\frac{\lambda}{2} (2 \mu + \lambda \sigma^2 - 2 x)} erfc((\mu + \lambda \sigma \sigma - x) / (\sqrt{2} \sigma))

where μ\mu is the mean of the normal distribution, σ\sigma the standard deviation of the normal and λ\lambda rate of the exponential. Note μ\mu does not represent the mean of the distribution. The mean is μ+1/λ\mu + 1/\lambda

Value

demg gives the density, pemg gives the distribution function, qemg gives the quantile function, and remg generates random deviates.

References

Golubev. Exponentially modified Gaussian (EMG) relevance to distributions related to cell proliferation and differentiation. J Theor Biol. 2010 Jan 21;262(2):257-66. Epub 2009 Oct 13.

Examples

plot(demg, -2, 5)

Maximum Likelihood estimate of parameters

Description

Compute the maximum likelihood model for the parameters given a set of observations. Returns a model with estimates for mu, sigma, and lambda.

Usage

emg.mle(x, lower=NULL, upper=NULL, start=NULL, ...)

Arguments

x

vector of observations to estimate parameters for.

lower

list of lower bounds for parameters.

upper

list of upper bounds for parameters.

start

list of starting parameters for search.

...

optional parameters to pass to 'mle'.

Value

An object of class mle-class.

Author(s)

Shawn Garbett

See Also

EMG emg.nllik

Examples

emg.mle(remg(200))
  
  ## a example involving fitting
  data(pc9_3um_erlotinib)

  intermitotic.time <- subset(pc9_3um_erlotinib, end.of.movie=='N' & died=='N')$observed

  hist(intermitotic.time, freq=FALSE, main="PC9 in 3um erlotinib", xlab='intermitotic time (hours)')

  fit <- emg.mle(intermitotic.time)
  pdf <- function(x) demg(x, coef(fit)['mu'], coef(fit)['sigma'], coef(fit)['lambda'])
  curve(pdf, from=0, to=170, add=TRUE, col='red')

Negative Log Likelihood for EMG

Description

Negative log likelihood function for EMG

Usage

emg.nllik(x, mu, sigma, lambda)

Arguments

x

vector of observations

mu

mu of normal

sigma

sigma of normal

lambda

lambda of exponential

Value

A single real value of the negative log likelihood that the given parameters explain the observations.

Author(s)

Shawn Garbett

See Also

emg.mle

Examples

y <- remg(200)
  emg.nllik(y, 0, 1, 1)

PC9 cancer cell observations with 3 micro-molar erlotinib at time 0.

Description

PC9 cancer cell observations with 3um erlotinib applied at time 0. Experiment was performed on 2011/9/9 (F07) in the Vito Quaranta laboratory at Vanderbilt University Cancer Biology Center by Darren Tyson. Cells were tracked by nuclear labeling with histone H2B and imaged on a BD Pathway 855 for several days. All numerical values are in hours. Funding was provided by the National Cancer Institute (NCI).

This data set was specifically chosen to give the emg.mle function something difficult to work on.

Usage

data(pc9_3um_erlotinib)

Value

A data frame of lifespan PC9 observations.

Author(s)

Darren Tyson, Shawn Garbett

Examples

data(pc9_3um_erlotinib)