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}$.pfmix(x = NULL, w = NULL, Theta = NULL, lower.tail = TRUE, log.p = FALSE, ...)
pdfi
. One of "normal"
, "lognormal"
, "Weibull"
, "gamma"
, "binomial"
, "Poisson"
or "Dirac"
TRUE
(default), probabilities are $P[X \leq x]$, otherwise, $P[X > x]$.TRUE
, probabilities $p$ are given as $\log(p)$.## 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,
b = 0.0)
## 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