R/density_estimation.R
density_estimation.Rd
Estimates the density of each covariates with gaussian mixture models and then gives the associated BIC.
density_estimation( X = X, nbclustmax = 10, nbclustmin = 1, verbose = FALSE, detailed = FALSE, max = TRUE, package = c("mclust", "Rmixmod"), nbini = 20, matshape = FALSE, ... )
X | the dataset (matrix) |
---|---|
nbclustmax | max number of clusters in the gaussian mixtures |
nbclustmin | min number of clusters in the gaussian mixtures |
verbose | verbose or not |
detailed | boolean to give the details of the mixtures found |
max | boolean. Use an heuristic to shrink nbclustmax according to the number of individuals in the dataset |
package | package to use ("mclust","Rmixmod" ) |
nbini | number of initial points for Rmixmod |
matshape | boolean to give the detail in matricial shape |
... | additional parameters |
a list that contains:
vector of the BIC (one per variable)
global value of the BIC (=sum(BIC_vect)
)
vector of the numbers of components
list of matrices that describe each Gaussian Mixture (proportions, means and variances)
# dataset generation base = mixture_generator(n = 150, p = 10, valid = 0, ratio = 0.4, tp1 = 1, tp2 = 1, tp3 = 1, positive = 0.5, R2Y = 0.8, R2 = 0.9, scale = TRUE, max_compl = 3, lambda = 1) X_appr = base$X_appr # learning sample density = density_estimation(X = X_appr, detailed = TRUE) # estimation of the marginal densities density$BIC_vect # vector of the BIC (one per variable)#> [1] 449.3303 168.6177 428.1307 426.0546 421.3208 437.8150 427.5890 248.5422 #> [9] 184.2984 210.7557density$BIC # global value of the BIC (sum of the BICs)#> [1] 3402.455density$nbclust # vector of the numbers of components.#> [1] 1 1 1 1 1 1 2 1 1 1density$details # matrices that describe each Gaussian Mixture (proportions, means and variances)#> [[1]] #> prop meansvect varvect i #> [1,] 1 -0.08230836 1.095105 1 #> #> [[2]] #> prop meansvect varvect i #> [1,] 1 0.9437429 0.1685425 2 #> #> [[3]] #> prop meansvect varvect i #> [1,] 1 -0.04690112 0.9507723 3 #> #> [[4]] #> prop meansvect varvect i #> [1,] 1 0.0600327 0.9377036 4 #> #> [[5]] #> prop meansvect varvect i #> [1,] 1 0.02855939 0.908573 5 #> #> [[6]] #> prop meansvect varvect i #> [1,] 1 -0.012416 1.01418 6 #> #> [[7]] #> prop meansvect varvect i #> 1 0.4131431 -1.0517942 0.3308719 7 #> 2 0.5868569 0.7863755 0.2319227 7 #> #> [[8]] #> prop meansvect varvect i #> [1,] 1 -0.874094 0.2871537 8 #> #> [[9]] #> prop meansvect varvect i #> [1,] 1 0.8705975 0.1871154 9 #> #> [[10]] #> prop meansvect varvect i #> [1,] 1 0.9177486 0.2232089 10 #>