# Generate simulated dataset.
n <- c(15, 15)
Theta <- new("RNGMIX.Theta", c = 2, pdf = rep("normal", 3))
a.theta1(Theta, 1) <- c(10, 20, 30)
a.theta1(Theta, 2) <- c(3, 4, 5)
a.theta2(Theta, 1) <- c(3, 2, 1)
a.theta2(Theta, 2) <- c(15, 10, 5)
simulated <- RNGMIX(Dataset.name = paste("simulated_", 1:4, sep = ""),
rseed = -1,
n = n,
Theta = a.Theta(Theta))
# Create object of class EM.Control.
EM <- new("EM.Control", strategy = "exhaustive", variant = "ECM",
acceleration = "fixed", acceleration.multiplier = 1.0, tolerance = 1.0E-4,
maximum.iterations = 1000)
# Estimate number of components, component weights and component parameters.
simulatedest <- REBMIX(Dataset = a.Dataset(simulated),
Preprocessing = "kernel density estimation",
cmax = 4,
pdf = c("n", "n", "n"),
EMcontrol = EM)
# Preprocess simulated dataset.
f <- pemix(simulatedest, pos = 3, variables = c(1))
f
Run the code above in your browser using DataLab