demo/ForwardSelection.R

set.seed(123)

#Use Iris dataset     
K <- 3; p <- 4
X <- as.matrix(iris[,-5])
   
# Obtain initial memberships based on the K-means algorithm
id.km <- kmeans(X, K)$cluster
     
# Run the EM algorithm for a Gaussian mixture model based on K-means solution
G <- Manly.EM(X, id = id.km)
id.G <- G$id
     
# Run FORWARD SELECTION
M.F <- Manly.select(X, model = G, method = "forward")
print(M.F)

Try the ManlyMix package in your browser

Any scripts or data that you put into this service are public.

ManlyMix documentation built on April 29, 2023, 9:17 a.m.