R Under development (unstable) (2023-12-12 r85669 ucrt) -- "Unsuffered Consequences" Copyright (C) 2023 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > library(Rmixmod) Loading required package: Rcpp Rmixmod v. 2.1.10 / URI: www.mixmod.org > createGaussianParameter <- function(nbCluster, pbDimension) { + proportions <- rep(1.0 / nbCluster, nbCluster) + means <- matrix(rep(0, nbCluster * pbDimension), + nrow = nbCluster, + ncol = pbDimension + ) + for (k in 1:nbCluster) { + for (p in 1:pbDimension) { + means[k, p] <- k + } + } + variances <- list(c(1:nbCluster)) + for (k in 1:nbCluster) { + variances[[k]] <- diag(pbDimension) + } + par <- new("GaussianParameter", + proportions = proportions, + mean = means, variance = variances + ) + return(par) + } > > data(iris) > data <- iris[, 1:4] > > param <- createGaussianParameter(3, 4) > strategy <- mixmodStrategy(initMethod = "parameter", parameter = param) > out <- mixmodCluster(data = data, nbCluster = 3, strategy = strategy) > > proc.time() user system elapsed 0.34 0.04 0.37