Learn R Programming

rebmix (version 2.6.1)

pfmix: Predictive Distribution Function Calculation

Description

pfmix returns (invisibly) the vector containing predictive distribution functions $F(\bm{x} | c, \bm{w}, \bm{\Theta})$, where $\bm{x}$ stands for a subvector of $\bm{y} = (y_{1}, \ldots, y_{d})^{\top}$.

Usage

pfmix(x = NULL, w = NULL, Theta = NULL, lower.tail = TRUE, log.p = FALSE, ...)

Arguments

x
a vector, a matrix or a data frame containing continuous or discrete vector observations $\bm{x}$.
w
a vector or a data frame containing $c$ component weights $w_{l}$ summing to 1.
Theta
a matrix or a data frame containing $c$ parametric family types pdfi. One of "normal", "lognormal", "Weibull", "gamma", "binomial", "Poisson" or "Dirac"
lower.tail
logical. If TRUE (default), probabilities are $P[X \leq x]$, otherwise, $P[X > x]$.
log.p
logical. if TRUE, probabilities $p$ are given as $\log(p)$.
...
currently not used.

References

M. Nagode and M. Fajdiga. The rebmix algorithm for the univariate finite mixture estimation. Communications in Statistics - Theory and Methods, 40(5):876-892, 2011a. http://dx.doi.org/10.1080/03610920903480890. M. Nagode and M. Fajdiga. The rebmix algorithm for the multivariate finite mixture estimation. Communications in Statistics - Theory and Methods, 40(11):2022-2034, 2011b. http://dx.doi.org/10.1080/03610921003725788.

Examples

Run this code
## Generate simulated dataset.

Theta <- rbind(pdf1 = rep("normal", 2),
  theta1.1 = c(10, 20),
  theta2.1 = c(3.0, 2.0),
  pdf1 = rep("Weibull", 2),
  theta1.1 = c(3, 2),
  theta2.1 = c(20, 10))

simulated <- RNGMIX(Dataset = "simulated",
  rseed = -1,
  n = c(15, 25),
  Theta = Theta)

## Estimate number of components, component weights and component parameters.

simulatedest <- REBMIX(Dataset = simulated$Dataset,
  Preprocessing = "Parzen window",
  D = 0.025,
  cmax = 4,
  Criterion = "BIC",
  Variables = c("continuous", "continuous"),
  pdf = c("normal", "Weibull"),
  K = 8)

## Preprocess and plot finite mixtures.

opar <- plot(simulatedest)

par(opar)

y1f <- pemix(x = simulatedest$Dataset[[1]][, 1, drop = FALSE],
  Preprocessing = "Parzen window",
  Variables = "continuous",
  k = 8)

y1 <- seq(from = min(y1f[, 1]), to = max(y1f[, 1]), length.out = 200)

f1 <- pfmix(x = cbind(y1), w = simulatedest$w[[1]], simulatedest$Theta[[1]][1:3,])

y2f <- pemix(x = simulatedest$Dataset[[1]][, 2, drop = FALSE],
  Preprocessing = "Parzen window",
  Variables = "continuous",
  k = 8)

y2 <- seq(from = min(y2f[, 1]), to = max(y2f[, 1]), length.out = 200)

f2 <- pfmix(x = cbind(y2), w = simulatedest$w[[1]], simulatedest$Theta[[1]][4:6,])

opar <- par(mfrow = c(1, 2))

plot(y1, f1, xlab = bquote(y[1]), ylab = bquote(F(y[1])), type = "l", col = "blue")

points(y1f, pch = 3, col = "red")

plot(y2, f2, xlab = bquote(y[2]), ylab = bquote(F(y[2])), type = "l", col = "blue")

points(y2f, pch = 3, col = "red")

par(opar)

Run the code above in your browser using DataLab