dmixture {ForestFit} | R Documentation |
Computing probability density function of the well-known mixture models
Description
Computes probability density function (pdf) of the mixture model. The general form for the pdf of the mixture model is given by
f(x,{\Theta}) = \sum_{j=1}^{K}\omega_j f_j(x,\theta_j),
where \Theta=(\theta_1,\dots,\theta_K)^T
, is the whole parameter vector, \theta_j
for j=1,\dots,K
is the parameter space of the j
-th component, i.e. \theta_j=(\alpha_j,\beta_j)^{T}
, f_j(.,\theta_j)
is the pdf of the j
-th component, and known constant K
is the number of components. The vector of mixing parameters is given by \omega=(\omega_1,\dots,\omega_K)^T
where \omega_j
s sum to one, i.e., \sum_{j=1}^{K}\omega_j=1
. Parameters \alpha_j
and \beta_j
are the shape and scale parameters of the j
-th component or both are the shape parameters. In the latter case, the parameters \alpha
and \beta
are called the first and second shape parameters, respectively. We note that the constants \omega_j
s sum to one, i.e. \sum_{j=1}^{K}\omega_j=1
. The families considered for each component include Birnbaum-Saunders, Burr type XII, Chen, F, Frechet, Gamma, Gompertz, Log-normal, Log-logistic, Lomax, skew-normal, and Weibull with pdf given by the following.
Birnbaum-Saunders
f(x,\theta)=\frac{\sqrt{\frac{x}{\beta}}+\sqrt{\frac{\beta}{x}}}{2\alpha x}\phi \Biggl( \frac{\sqrt{\frac{x}{\beta}}-\sqrt{\frac{\beta}{x}}}{\alpha}\Biggr),
Burr XII
f(x,\theta)=\alpha \beta x^{\alpha-1} \Bigl(1+x^{\alpha}\Bigr)^{-\beta-1},
Chen
f(x,\theta)=\alpha \beta x^{\alpha}\exp\bigl(x^\alpha\bigr) \exp\Bigl\{-\beta \exp\bigl(x^\alpha\bigr)+\beta\Bigr\},
F
f(x,\theta)=\frac{\Gamma\Bigl(\frac{\alpha+\beta}{2}\Bigl)}{\Gamma\bigl(\frac{\alpha}{2}\bigl) \Gamma\bigl(\frac{\beta}{2}\bigl)}\Bigl( \frac{\alpha}{\beta}\Bigl)^{\frac{\alpha}{2}} x^{\frac{\alpha}{2}-1}\Big(1+\frac{\alpha}{\beta}x\Big)^{-\frac{\alpha+\beta}{2}},
Frechet
f(x,\theta)=\frac{\alpha}{ \beta} \Bigl( \frac {x}{\beta}\Bigr) ^{-\alpha-1}\exp\Bigl\{ -\Bigl( \frac {x}{\beta}\Bigr)^{-\alpha} \Bigr\},
gamma
f(x,\theta)=\bigl[ \beta^\alpha \Gamma(\alpha)\bigr]^{-1} x^{\alpha-1} \exp\Bigl( -\frac {x}{\beta}\Bigr),
Gompertz
f(x,\theta)=\beta\exp\bigl(\alpha x\bigr) \exp\Biggl\{\frac{\beta \exp\bigl(\alpha x\bigr)-1}{\alpha} \Biggr\},
log-logistic
f(x,\theta)=\frac{ \alpha}{ \beta^{\alpha}} x^{\alpha-1} \left[ \Bigl( \frac {x}{\beta}\Bigr)^\alpha +1\right]^{-2},
log-normal
f(x,\theta)=\bigl(\sqrt{2\pi} \beta x \bigr)^{-1}\exp\biggl\{ -\frac {1}{2}\left( \frac {\log x-\alpha}{\beta}\right) ^2\biggr\},
Lomax
f(x,\theta)=\frac{\alpha \beta}{(1+\alpha x)^{\beta+1}},
skew-normal
f(x,\theta)=2\phi\Bigl(\frac{x-\alpha}{\beta}\Bigr)\Phi\Bigl(\lambda\frac{x-\alpha}{\beta}\Bigr),
Weibull
f(x,\theta)=\frac {\alpha}{\beta} \Bigl( \frac {x}{\beta} \Bigr)^{\alpha - 1}\exp\Bigl\{ -\Bigl( \frac {x}{\beta}\Bigr)^\alpha \Bigr\},
where \theta=(\alpha,\beta)
. In the skew-normal case, \phi(.)
and \Phi(.)
are the density and distribution functions of the standard normal distribution, respectively.
Usage
dmixture(data, g, K, param)
Arguments
data |
Vector of observations. |
g |
Name of the family including " |
K |
Number of components. |
param |
Vector of the |
Details
For the skew-normal case, \alpha
, \beta
, and \lambda
are the location, scale, and skewness parameters, respectively.
Value
A vector of the same length as data
, giving the pdf of the mixture model of families computed at data
.
Author(s)
Mahdi Teimouri
Examples
data<-seq(0,20,0.1)
K<-2
weight<-c(0.6,0.4)
alpha<-c(1,2)
beta<-c(2,1)
param<-c(weight,alpha,beta)
dmixture(data, "weibull", K, param)