# Generate simulated dataset.
Theta <- list(pdf1 = c("normal", "Weibull"),
theta1.1 = c(10, 3),
theta2.1 = c(3, 2),
pdf2 = c("normal", "Weibull"),
theta1.2 = c(20, 2),
theta2.2 = c(2, 10))
simulated <- RNGMIX(Dataset.name = "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",
cmax = 4,
Criterion = "BIC",
pdf = c("normal", "Weibull"),
K = 8)
# Predictive density calculation.
i <- 1
x <- simulatedest@Dataset[[1]][, i]
f <- dfmix(x = x,
w = simulatedest@w[[1]],
Theta = lapply(simulatedest@Theta[[1]], "[", i))
plot(x, f)
i <- 2
x <- simulatedest@Dataset[[1]][, i]
f <- dfmix(x = x,
w = simulatedest@w[[1]],
Theta = lapply(simulatedest@Theta[[1]], "[", i))
plot(x, f)
Run the code above in your browser using DataLab