# Default plot for class dpGLM

Source: `R/src_summaries.R`
`plot.dpGLM.Rd`

This function generates desity plots with the posterior distribution generated by the function `hdpGLM`

    # S3 method for dpGLM
    plot(
      x,
      terms = NULL,
      separate = FALSE,
      hpd = TRUE,
      true.beta = NULL,
      title = NULL,
      subtitle = NULL,
      adjust = 1,
      ncols = NULL,
      only.occupied.clusters = TRUE,
      focus.hpd = FALSE,
      legend.position = "top",
      colour = "grey",
      alpha = 0.4,
      display.terms = TRUE,
      plot.mean = TRUE,
      legend.label.true.value = "True",
      ...
    )

## Arguments

x

  a dpGLM object with the samples from generated by `hdpGLM`

terms

  string vector with the name of covariates to plot. If `NULL` (default), all covariates are plotted.

separate

  boolean, if `TRUE` the linear coefficients `beta` will be displayed in their separate clusters.

hpd

  boolean, if `TRUE` and `separate=T`, the 95% HPDI lines will be displayed.

true.beta

  either `NULL` (default) or a `data.frame` with the true values of the linear coefficients `beta` if they are known. The `data.frame` must contain a column named `k` indicating the cluster of `beta`, and a column named `Parameter` with the name of the linear coefficients (`beta1`, `beta2`, ..., `beta_dx`, where `dx` is the number of covariates at the individual level, and beta1 is the coefficient of the intercept term). It must contain a column named `True` with the true value of the `betas`.

title

  string, the title of the plot

subtitle

  string, the subtitle of the plot

adjust

  the bandwidth used is actually `adjust*bw`. This makes it easy to specify values like ‘half the default’ bandwidth.

ncols

  integer, the number of columns in the plot

only.occupied.clusters

  boolean, if `TRUE` it shows only the densities of the clusters that actually have data points assigned to it with high probability

focus.hpd

  boolean, if `TRUE` and separate is also `TRUE` it will display only the 95% HPDI of the posterior density of the linear coefficients `beta`

legend.position

  one of four options: "bottom" (default), "top", "left", or "right". It indicates the position of the legend

colour

  = string with color to fill the density plot

alpha

  number between 0 and 1 indicating the degree of transparency of the density

display.terms

  boolean, if `TRUE` (default), the covariate name is displayed in the plot

plot.mean

  boolean, if `TRUE` the posterior mean of every cluster is displayed

legend.label.true.value

  a string with the value to display in the legend when the `true.beta` is used

...

  ignored

## Examples

    # Note: this example is just for illustration. MCMC iterations are very reduced
    set.seed(10)
    n = 20
    data = tibble::tibble(x1 = rnorm(n, -3),
                                       x2 = rnorm(n,  3),
                                       z  = sample(1:3, n, replace=TRUE),
                                       y  =I(z==1) * (3 + 4*x1 - x2 + rnorm(n)) +
                                           I(z==2) * (3 + 2*x1 + x2 + rnorm(n)) +
                                           I(z==3) * (3 - 4*x1 - x2 + rnorm(n)) ,
                                       )

    ## estimation
    mcmc    = list(burn.in=1, n.iter=50)
    samples = hdpGLM(y ~ x1 + x2,  data=data, mcmc=mcmc, n.display=1)
    #>
    #>
    #> Preparing for estimation ...
    #>
    #>
    #>
    #> Estimation in progress ...
    #>
    #>
    #>
    #> -----------------------------------------------------
    #> MCMC in progress ....
    #>
    #> Family of the distribution of the outcome variable of the mixture components: gaussian
    #>
    #> Burn-in: 1
    #> Number of MCMC samples: 50
    #>
    #> Iteration: 1
    #>
    #> Acceptance Rate for beta         : 1
    #> Average Acceptance Rate for beta : 1
    #>
    #> Maximum Number of Clusters Allowed (K): 100
    #> Maximum Number of Clusters Activated  : 1
    #> Current Number of Active Clusters     : 1
    #>
    #> Percentage of data classified in each cluster k at current iteraction (displaying only clusters with more than 5% of the data)
    #>    1.0000e+00
    #>    1.0000e+02
    #>
    #> [===                                                                    ] 3 %

    #>
    #> -----------------------------------------------------
    #> MCMC in progress ....
    #>
    #> Family of the distribution of the outcome variable of the mixture components: gaussian
    #>
    #> Burn-in: 1
    #> Number of MCMC samples: 50
    #>
    #> Iteration: 2
    #>
    #> Acceptance Rate for beta         : 1
    #> Average Acceptance Rate for beta : 1
    #>
    #> Maximum Number of Clusters Allowed (K): 100
    #> Maximum Number of Clusters Activated  : 7
    #> Current Number of Active Clusters     : 7
    #>
    #> Percentage of data classified in each cluster k at current iteraction (displaying only clusters with more than 5% of the data)
    #>     1.0000    2.0000    3.0000    4.0000    5.0000
    #>    15.0000   20.0000   25.0000   10.0000   20.0000
    #>
    #> [=====                                                                  ] 5 %

    #>
    #> -----------------------------------------------------
    #> MCMC in progress ....
    #>
    #> Family of the distribution of the outcome variable of the mixture components: gaussian
    #>
    #> Burn-in: 1
    #> Number of MCMC samples: 50
    #>
    #> Iteration: 3
    #>
    #> Acceptance Rate for beta         : 1
    #> Average Acceptance Rate for beta : 1
    #>
    #> Maximum Number of Clusters Allowed (K): 100
    #> Maximum Number of Clusters Activated  : 7
    #> Current Number of Active Clusters     : 7
    #>
    #> Percentage of data classified in each cluster k at current iteraction (displaying only clusters with more than 5% of the data)
    #>     1.0000    2.0000    3.0000    8.0000
    #>    10.0000   15.0000   50.0000   10.0000
    #>
    #> [======                                                                 ] 7 %

    #>
    #> -----------------------------------------------------
    #> MCMC in progress ....
    #>
    #> Family of the distribution of the outcome variable of the mixture components: gaussian
    #>
    #> Burn-in: 1
    #> Number of MCMC samples: 50
    #>
    #> Iteration: 4
    #>
    #> Acceptance Rate for beta         : 1
    #> Average Acceptance Rate for beta : 1
    #>
    #> Maximum Number of Clusters Allowed (K): 100
    #> Maximum Number of Clusters Activated  : 7
    #> Current Number of Active Clusters     : 5
    #>
    #> Percentage of data classified in each cluster k at current iteraction (displaying only clusters with more than 5% of the data)
    #>     1.0000    2.0000    3.0000    4.0000    8.0000
    #>    10.0000   15.0000   50.0000   10.0000   15.0000
    #>
    #> [=======                                                                ] 9 %

    #>
    #> -----------------------------------------------------
    #> MCMC in progress ....
    #>
    #> Family of the distribution of the outcome variable of the mixture components: gaussian
    #>
    #> Burn-in: 1
    #> Number of MCMC samples: 50
    #>
    #> Iteration: 5
    #>
    #> Acceptance Rate for beta         : 1
    #> Average Acceptance Rate for beta : 1
    #>
    #> Maximum Number of Clusters Allowed (K): 100
    #> Maximum Number of Clusters Activated  : 7
    #> Current Number of Active Clusters     : 5
    #>
    #> Percentage of data classified in each cluster k at current iteraction (displaying only clusters with more than 5% of the data)
    #>     1.0000    2.0000    3.0000    4.0000
    #>    10.0000   15.0000   50.0000   20.0000
    #>
    #> [=========                                                              ] 11 %

    #>
    #> -----------------------------------------------------
    #> MCMC in progress ....
    #>
    #> Family of the distribution of the outcome variable of the mixture components: gaussian
    #>
    #> Burn-in: 1
    #> Number of MCMC samples: 50
    #>
    #> Iteration: 6
    #>
    #> Acceptance Rate for beta         : 1
    #> Average Acceptance Rate for beta : 1
    #>
    #> Maximum Number of Clusters Allowed (K): 100
    #> Maximum Number of Clusters Activated  : 7
    #> Current Number of Active Clusters     : 5
    #>
    #> Percentage of data classified in each cluster k at current iteraction (displaying only clusters with more than 5% of the data)
    #>     1.0000    2.0000    3.0000    8.0000
    #>    15.0000   15.0000   50.0000   15.0000
    #>
    #> [==========                                                             ] 13 %

    #>
    #> -----------------------------------------------------
    #> MCMC in progress ....
    #>
    #> Family of the distribution of the outcome variable of the mixture components: gaussian
    #>
    #> Burn-in: 1
    #> Number of MCMC samples: 50
    #>
    #> Iteration: 7
    #>
    #> Acceptance Rate for beta         : 1
    #> Average Acceptance Rate for beta : 1
    #>
    #> Maximum Number of Clusters Allowed (K): 100
    #> Maximum Number of Clusters Activated  : 7
    #> Current Number of Active Clusters     : 5
    #>
    #> Percentage of data classified in each cluster k at current iteraction (displaying only clusters with more than 5% of the data)
    #>     1.0000    3.0000    5.0000    8.0000
    #>    10.0000   45.0000   20.0000   20.0000
    #>
    #> [===========                                                            ] 15 %

    #>
    #> -----------------------------------------------------
    #> MCMC in progress ....
    #>
    #> Family of the distribution of the outcome variable of the mixture components: gaussian
    #>
    #> Burn-in: 1
    #> Number of MCMC samples: 50
    #>
    #> Iteration: 8
    #>
    #> Acceptance Rate for beta         : 1
    #> Average Acceptance Rate for beta : 1
    #>
    #> Maximum Number of Clusters Allowed (K): 100
    #> Maximum Number of Clusters Activated  : 7
    #> Current Number of Active Clusters     : 6
    #>
    #> Percentage of data classified in each cluster k at current iteraction (displaying only clusters with more than 5% of the data)
    #>     3.0000    4.0000    5.0000    8.0000
    #>    50.0000   10.0000   10.0000   20.0000
    #>
    #> [=============                                                          ] 17 %

    #>
    #> -----------------------------------------------------
    #> MCMC in progress ....
    #>
    #> Family of the distribution of the outcome variable of the mixture components: gaussian
    #>
    #> Burn-in: 1
    #> Number of MCMC samples: 50
    #>
    #> Iteration: 9
    #>
    #> Acceptance Rate for beta         : 1
    #> Average Acceptance Rate for beta : 1
    #>
    #> Maximum Number of Clusters Allowed (K): 100
    #> Maximum Number of Clusters Activated  : 7
    #> Current Number of Active Clusters     : 6
    #>
    #> Percentage of data classified in each cluster k at current iteraction (displaying only clusters with more than 5% of the data)
    #>     3.0000    5.0000    6.0000    8.0000
    #>    45.0000   15.0000   10.0000   20.0000
    #>
    #> [==============                                                         ] 19 %

    #>
    #> -----------------------------------------------------
    #> MCMC in progress ....
    #>
    #> Family of the distribution of the outcome variable of the mixture components: gaussian
    #>
    #> Burn-in: 1
    #> Number of MCMC samples: 50
    #>
    #> Iteration: 10
    #>
    #> Acceptance Rate for beta         : 1
    #> Average Acceptance Rate for beta : 1
    #>
    #> Maximum Number of Clusters Allowed (K): 100
    #> Maximum Number of Clusters Activated  : 7
    #> Current Number of Active Clusters     : 4
    #>
    #> Percentage of data classified in each cluster k at current iteraction (displaying only clusters with more than 5% of the data)
    #>     3.0000    4.0000    5.0000    8.0000
    #>    45.0000   10.0000   20.0000   25.0000
    #>
    #> [================                                                       ] 21 %

    #>
    #> -----------------------------------------------------
    #> MCMC in progress ....
    #>
    #> Family of the distribution of the outcome variable of the mixture components: gaussian
    #>
    #> Burn-in: 1
    #> Number of MCMC samples: 50
    #>
    #> Iteration: 11
    #>
    #> Acceptance Rate for beta         : 1
    #> Average Acceptance Rate for beta : 1
    #>
    #> Maximum Number of Clusters Allowed (K): 100
    #> Maximum Number of Clusters Activated  : 7
    #> Current Number of Active Clusters     : 6
    #>
    #> Percentage of data classified in each cluster k at current iteraction (displaying only clusters with more than 5% of the data)
    #>     3.0000    5.0000    8.0000
    #>    40.0000   20.0000   25.0000
    #>
    #> [=================                                                      ] 23 %

    #>
    #> -----------------------------------------------------
    #> MCMC in progress ....
    #>
    #> Family of the distribution of the outcome variable of the mixture components: gaussian
    #>
    #> Burn-in: 1
    #> Number of MCMC samples: 50
    #>
    #> Iteration: 12
    #>
    #> Acceptance Rate for beta         : 1
    #> Average Acceptance Rate for beta : 1
    #>
    #> Maximum Number of Clusters Allowed (K): 100
    #> Maximum Number of Clusters Activated  : 7
    #> Current Number of Active Clusters     : 6
    #>
    #> Percentage of data classified in each cluster k at current iteraction (displaying only clusters with more than 5% of the data)
    #>     3.0000    5.0000    7.0000    8.0000
    #>    50.0000   20.0000   10.0000   10.0000
    #>
    #> [==================                                                     ] 25 %

    #>
    #> -----------------------------------------------------
    #> MCMC in progress ....
    #>
    #> Family of the distribution of the outcome variable of the mixture components: gaussian
    #>
    #> Burn-in: 1
    #> Number of MCMC samples: 50
    #>
    #> Iteration: 13
    #>
    #> Acceptance Rate for beta         : 1
    #> Average Acceptance Rate for beta : 1
    #>
    #> Maximum Number of Clusters Allowed (K): 100
    #> Maximum Number of Clusters Activated  : 7
    #> Current Number of Active Clusters     : 6
    #>
    #> Percentage of data classified in each cluster k at current iteraction (displaying only clusters with more than 5% of the data)
    #>     1.0000    3.0000    4.0000    5.0000    8.0000
    #>    10.0000   45.0000   15.0000   15.0000   10.0000
    #>
    #> [====================                                                   ] 27 %

    #>
    #> -----------------------------------------------------
    #> MCMC in progress ....
    #>
    #> Family of the distribution of the outcome variable of the mixture components: gaussian
    #>
    #> Burn-in: 1
    #> Number of MCMC samples: 50
    #>
    #> Iteration: 14
    #>
    #> Acceptance Rate for beta         : 1
    #> Average Acceptance Rate for beta : 1
    #>
    #> Maximum Number of Clusters Allowed (K): 100
    #> Maximum Number of Clusters Activated  : 7
    #> Current Number of Active Clusters     : 6
    #>
    #> Percentage of data classified in each cluster k at current iteraction (displaying only clusters with more than 5% of the data)
    #>     1.0000    3.0000    5.0000
    #>    20.0000   45.0000   20.0000
    #>
    #> [=====================                                                  ] 29 %

    #>
    #> -----------------------------------------------------
    #> MCMC in progress ....
    #>
    #> Family of the distribution of the outcome variable of the mixture components: gaussian
    #>
    #> Burn-in: 1
    #> Number of MCMC samples: 50
    #>
    #> Iteration: 15
    #>
    #> Acceptance Rate for beta         : 1
    #> Average Acceptance Rate for beta : 1
    #>
    #> Maximum Number of Clusters Allowed (K): 100
    #> Maximum Number of Clusters Activated  : 7
    #> Current Number of Active Clusters     : 5
    #>
    #> Percentage of data classified in each cluster k at current iteraction (displaying only clusters with more than 5% of the data)
    #>     1.0000    3.0000    5.0000    8.0000
    #>    10.0000   50.0000   25.0000   10.0000
    #>
    #> [======================                                                 ] 31 %

    #>
    #> -----------------------------------------------------
    #> MCMC in progress ....
    #>
    #> Family of the distribution of the outcome variable of the mixture components: gaussian
    #>
    #> Burn-in: 1
    #> Number of MCMC samples: 50
    #>
    #> Iteration: 16
    #>
    #> Acceptance Rate for beta         : 1
    #> Average Acceptance Rate for beta : 1
    #>
    #> Maximum Number of Clusters Allowed (K): 100
    #> Maximum Number of Clusters Activated  : 7
    #> Current Number of Active Clusters     : 5
    #>
    #> Percentage of data classified in each cluster k at current iteraction (displaying only clusters with more than 5% of the data)
    #>     1.0000    2.0000    3.0000    5.0000
    #>    25.0000   10.0000   50.0000   10.0000
    #>
    #> [========================                                               ] 33 %

    #>
    #> -----------------------------------------------------
    #> MCMC in progress ....
    #>
    #> Family of the distribution of the outcome variable of the mixture components: gaussian
    #>
    #> Burn-in: 1
    #> Number of MCMC samples: 50
    #>
    #> Iteration: 17
    #>
    #> Acceptance Rate for beta         : 1
    #> Average Acceptance Rate for beta : 1
    #>
    #> Maximum Number of Clusters Allowed (K): 100
    #> Maximum Number of Clusters Activated  : 7
    #> Current Number of Active Clusters     : 4
    #>
    #> Percentage of data classified in each cluster k at current iteraction (displaying only clusters with more than 5% of the data)
    #>     1.0000    2.0000    3.0000    5.0000
    #>    25.0000   10.0000   50.0000   15.0000
    #>
    #> [=========================                                              ] 35 %

    #>
    #> -----------------------------------------------------
    #> MCMC in progress ....
    #>
    #> Family of the distribution of the outcome variable of the mixture components: gaussian
    #>
    #> Burn-in: 1
    #> Number of MCMC samples: 50
    #>
    #> Iteration: 18
    #>
    #> Acceptance Rate for beta         : 1
    #> Average Acceptance Rate for beta : 1
    #>
    #> Maximum Number of Clusters Allowed (K): 100
    #> Maximum Number of Clusters Activated  : 7
    #> Current Number of Active Clusters     : 4
    #>
    #> Percentage of data classified in each cluster k at current iteraction (displaying only clusters with more than 5% of the data)
    #>     1.0000    2.0000    3.0000    5.0000
    #>    25.0000   15.0000   50.0000   10.0000
    #>
    #> [===========================                                            ] 37 %

    #>
    #> -----------------------------------------------------
    #> MCMC in progress ....
    #>
    #> Family of the distribution of the outcome variable of the mixture components: gaussian
    #>
    #> Burn-in: 1
    #> Number of MCMC samples: 50
    #>
    #> Iteration: 19
    #>
    #> Acceptance Rate for beta         : 1
    #> Average Acceptance Rate for beta : 1
    #>
    #> Maximum Number of Clusters Allowed (K): 100
    #> Maximum Number of Clusters Activated  : 7
    #> Current Number of Active Clusters     : 5
    #>
    #> Percentage of data classified in each cluster k at current iteraction (displaying only clusters with more than 5% of the data)
    #>     1.0000    3.0000    5.0000
    #>    25.0000   50.0000   15.0000
    #>
    #> [============================                                           ] 39 %

    #>
    #> -----------------------------------------------------
    #> MCMC in progress ....
    #>
    #> Family of the distribution of the outcome variable of the mixture components: gaussian
    #>
    #> Burn-in: 1
    #> Number of MCMC samples: 50
    #>
    #> Iteration: 20
    #>
    #> Acceptance Rate for beta         : 1
    #> Average Acceptance Rate for beta : 1
    #>
    #> Maximum Number of Clusters Allowed (K): 100
    #> Maximum Number of Clusters Activated  : 7
    #> Current Number of Active Clusters     : 4
    #>
    #> Percentage of data classified in each cluster k at current iteraction (displaying only clusters with more than 5% of the data)
    #>     1.0000    3.0000    5.0000
    #>    25.0000   50.0000   20.0000
    #>
    #> [=============================                                          ] 41 %

    #>
    #> -----------------------------------------------------
    #> MCMC in progress ....
    #>
    #> Family of the distribution of the outcome variable of the mixture components: gaussian
    #>
    #> Burn-in: 1
    #> Number of MCMC samples: 50
    #>
    #> Iteration: 21
    #>
    #> Acceptance Rate for beta         : 1
    #> Average Acceptance Rate for beta : 1
    #>
    #> Maximum Number of Clusters Allowed (K): 100
    #> Maximum Number of Clusters Activated  : 7
    #> Current Number of Active Clusters     : 4
    #>
    #> Percentage of data classified in each cluster k at current iteraction (displaying only clusters with more than 5% of the data)
    #>     1.0000    2.0000    3.0000    5.0000
    #>    25.0000   10.0000   50.0000   15.0000
    #>
    #> [===============================                                        ] 43 %

    #>
    #> -----------------------------------------------------
    #> MCMC in progress ....
    #>
    #> Family of the distribution of the outcome variable of the mixture components: gaussian
    #>
    #> Burn-in: 1
    #> Number of MCMC samples: 50
    #>
    #> Iteration: 22
    #>
    #> Acceptance Rate for beta         : 1
    #> Average Acceptance Rate for beta : 1
    #>
    #> Maximum Number of Clusters Allowed (K): 100
    #> Maximum Number of Clusters Activated  : 7
    #> Current Number of Active Clusters     : 4
    #>
    #> Percentage of data classified in each cluster k at current iteraction (displaying only clusters with more than 5% of the data)
    #>     1.0000    2.0000    3.0000    5.0000
    #>    25.0000   10.0000   50.0000   15.0000
    #>
    #> [================================                                       ] 45 %

    #>
    #> -----------------------------------------------------
    #> MCMC in progress ....
    #>
    #> Family of the distribution of the outcome variable of the mixture components: gaussian
    #>
    #> Burn-in: 1
    #> Number of MCMC samples: 50
    #>
    #> Iteration: 23
    #>
    #> Acceptance Rate for beta         : 1
    #> Average Acceptance Rate for beta : 1
    #>
    #> Maximum Number of Clusters Allowed (K): 100
    #> Maximum Number of Clusters Activated  : 7
    #> Current Number of Active Clusters     : 4
    #>
    #> Percentage of data classified in each cluster k at current iteraction (displaying only clusters with more than 5% of the data)
    #>     1.0000    2.0000    3.0000    5.0000
    #>    20.0000   15.0000   50.0000   15.0000
    #>
    #> [=================================                                      ] 47 %

    #>
    #> -----------------------------------------------------
    #> MCMC in progress ....
    #>
    #> Family of the distribution of the outcome variable of the mixture components: gaussian
    #>
    #> Burn-in: 1
    #> Number of MCMC samples: 50
    #>
    #> Iteration: 24
    #>
    #> Acceptance Rate for beta         : 1
    #> Average Acceptance Rate for beta : 1
    #>
    #> Maximum Number of Clusters Allowed (K): 100
    #> Maximum Number of Clusters Activated  : 7
    #> Current Number of Active Clusters     : 5
    #>
    #> Percentage of data classified in each cluster k at current iteraction (displaying only clusters with more than 5% of the data)
    #>     1.0000    2.0000    3.0000    4.0000    5.0000
    #>    10.0000   15.0000   50.0000   10.0000   15.0000
    #>
    #> [===================================                                    ] 49 %

    #>
    #> -----------------------------------------------------
    #> MCMC in progress ....
    #>
    #> Family of the distribution of the outcome variable of the mixture components: gaussian
    #>
    #> Burn-in: 1
    #> Number of MCMC samples: 50
    #>
    #> Iteration: 25
    #>
    #> Acceptance Rate for beta         : 1
    #> Average Acceptance Rate for beta : 1
    #>
    #> Maximum Number of Clusters Allowed (K): 100
    #> Maximum Number of Clusters Activated  : 7
    #> Current Number of Active Clusters     : 5
    #>
    #> Percentage of data classified in each cluster k at current iteraction (displaying only clusters with more than 5% of the data)
    #>     2.0000    3.0000    4.0000    5.0000
    #>    15.0000   50.0000   15.0000   15.0000
    #>
    #> [====================================                                   ] 50 %

    #>
    #> -----------------------------------------------------
    #> MCMC in progress ....
    #>
    #> Family of the distribution of the outcome variable of the mixture components: gaussian
    #>
    #> Burn-in: 1
    #> Number of MCMC samples: 50
    #>
    #> Iteration: 26
    #>
    #> Acceptance Rate for beta         : 1
    #> Average Acceptance Rate for beta : 1
    #>
    #> Maximum Number of Clusters Allowed (K): 100
    #> Maximum Number of Clusters Activated  : 7
    #> Current Number of Active Clusters     : 5
    #>
    #> Percentage of data classified in each cluster k at current iteraction (displaying only clusters with more than 5% of the data)
    #>     2.0000    3.0000    4.0000    5.0000
    #>    15.0000   50.0000   20.0000   10.0000
    #>
    #> [======================================                                 ] 52 %

    #>
    #> -----------------------------------------------------
    #> MCMC in progress ....
    #>
    #> Family of the distribution of the outcome variable of the mixture components: gaussian
    #>
    #> Burn-in: 1
    #> Number of MCMC samples: 50
    #>
    #> Iteration: 27
    #>
    #> Acceptance Rate for beta         : 1
    #> Average Acceptance Rate for beta : 1
    #>
    #> Maximum Number of Clusters Allowed (K): 100
    #> Maximum Number of Clusters Activated  : 7
    #> Current Number of Active Clusters     : 5
    #>
    #> Percentage of data classified in each cluster k at current iteraction (displaying only clusters with more than 5% of the data)
    #>     2.0000    3.0000    4.0000    5.0000
    #>    15.0000   45.0000   20.0000   15.0000
    #>
    #> [=======================================                                ] 54 %

    #>
    #> -----------------------------------------------------
    #> MCMC in progress ....
    #>
    #> Family of the distribution of the outcome variable of the mixture components: gaussian
    #>
    #> Burn-in: 1
    #> Number of MCMC samples: 50
    #>
    #> Iteration: 28
    #>
    #> Acceptance Rate for beta         : 1
    #> Average Acceptance Rate for beta : 1
    #>
    #> Maximum Number of Clusters Allowed (K): 100
    #> Maximum Number of Clusters Activated  : 7
    #> Current Number of Active Clusters     : 6
    #>
    #> Percentage of data classified in each cluster k at current iteraction (displaying only clusters with more than 5% of the data)
    #>     1.0000    2.0000    3.0000    4.0000    5.0000
    #>    15.0000   15.0000   30.0000   20.0000   15.0000
    #>
    #> [========================================                               ] 56 %

    #>
    #> -----------------------------------------------------
    #> MCMC in progress ....
    #>
    #> Family of the distribution of the outcome variable of the mixture components: gaussian
    #>
    #> Burn-in: 1
    #> Number of MCMC samples: 50
    #>
    #> Iteration: 29
    #>
    #> Acceptance Rate for beta         : 1
    #> Average Acceptance Rate for beta : 1
    #>
    #> Maximum Number of Clusters Allowed (K): 100
    #> Maximum Number of Clusters Activated  : 7
    #> Current Number of Active Clusters     : 5
    #>
    #> Percentage of data classified in each cluster k at current iteraction (displaying only clusters with more than 5% of the data)
    #>     1.0000    2.0000    3.0000    4.0000    5.0000
    #>    15.0000   10.0000   35.0000   20.0000   20.0000
    #>
    #> [==========================================                             ] 58 %

    #>
    #> -----------------------------------------------------
    #> MCMC in progress ....
    #>
    #> Family of the distribution of the outcome variable of the mixture components: gaussian
    #>
    #> Burn-in: 1
    #> Number of MCMC samples: 50
    #>
    #> Iteration: 30
    #>
    #> Acceptance Rate for beta         : 1
    #> Average Acceptance Rate for beta : 1
    #>
    #> Maximum Number of Clusters Allowed (K): 100
    #> Maximum Number of Clusters Activated  : 7
    #> Current Number of Active Clusters     : 5
    #>
    #> Percentage of data classified in each cluster k at current iteraction (displaying only clusters with more than 5% of the data)
    #>     2.0000    3.0000    4.0000    5.0000
    #>    10.0000   45.0000   20.0000   20.0000
    #>
    #> [===========================================                            ] 60 %

    #>
    #> -----------------------------------------------------
    #> MCMC in progress ....
    #>
    #> Family of the distribution of the outcome variable of the mixture components: gaussian
    #>
    #> Burn-in: 1
    #> Number of MCMC samples: 50
    #>
    #> Iteration: 31
    #>
    #> Acceptance Rate for beta         : 1
    #> Average Acceptance Rate for beta : 1
    #>
    #> Maximum Number of Clusters Allowed (K): 100
    #> Maximum Number of Clusters Activated  : 7
    #> Current Number of Active Clusters     : 5
    #>
    #> Percentage of data classified in each cluster k at current iteraction (displaying only clusters with more than 5% of the data)
    #>     1.0000    2.0000    3.0000    4.0000    5.0000
    #>    15.0000   15.0000   35.0000   20.0000   15.0000
    #>
    #> [============================================                           ] 62 %

    #>
    #> -----------------------------------------------------
    #> MCMC in progress ....
    #>
    #> Family of the distribution of the outcome variable of the mixture components: gaussian
    #>
    #> Burn-in: 1
    #> Number of MCMC samples: 50
    #>
    #> Iteration: 32
    #>
    #> Acceptance Rate for beta         : 1
    #> Average Acceptance Rate for beta : 1
    #>
    #> Maximum Number of Clusters Allowed (K): 100
    #> Maximum Number of Clusters Activated  : 7
    #> Current Number of Active Clusters     : 6
    #>
    #> Percentage of data classified in each cluster k at current iteraction (displaying only clusters with more than 5% of the data)
    #>     1.0000    2.0000    3.0000    4.0000
    #>    15.0000   25.0000   35.0000   15.0000
    #>
    #> [==============================================                         ] 64 %

    #>
    #> -----------------------------------------------------
    #> MCMC in progress ....
    #>
    #> Family of the distribution of the outcome variable of the mixture components: gaussian
    #>
    #> Burn-in: 1
    #> Number of MCMC samples: 50
    #>
    #> Iteration: 33
    #>
    #> Acceptance Rate for beta         : 1
    #> Average Acceptance Rate for beta : 1
    #>
    #> Maximum Number of Clusters Allowed (K): 100
    #> Maximum Number of Clusters Activated  : 7
    #> Current Number of Active Clusters     : 7
    #>
    #> Percentage of data classified in each cluster k at current iteraction (displaying only clusters with more than 5% of the data)
    #>     1.0000    2.0000    3.0000    4.0000    8.0000
    #>    15.0000   15.0000   35.0000   15.0000   10.0000
    #>
    #> [===============================================                        ] 66 %

    #>
    #> -----------------------------------------------------
    #> MCMC in progress ....
    #>
    #> Family of the distribution of the outcome variable of the mixture components: gaussian
    #>
    #> Burn-in: 1
    #> Number of MCMC samples: 50
    #>
    #> Iteration: 34
    #>
    #> Acceptance Rate for beta         : 1
    #> Average Acceptance Rate for beta : 1
    #>
    #> Maximum Number of Clusters Allowed (K): 100
    #> Maximum Number of Clusters Activated  : 7
    #> Current Number of Active Clusters     : 6
    #>
    #> Percentage of data classified in each cluster k at current iteraction (displaying only clusters with more than 5% of the data)
    #>     1.0000    2.0000    3.0000    4.0000    5.0000
    #>    20.0000   20.0000   25.0000   20.0000   10.0000
    #>
    #> [=================================================                      ] 68 %

    #>
    #> -----------------------------------------------------
    #> MCMC in progress ....
    #>
    #> Family of the distribution of the outcome variable of the mixture components: gaussian
    #>
    #> Burn-in: 1
    #> Number of MCMC samples: 50
    #>
    #> Iteration: 35
    #>
    #> Acceptance Rate for beta         : 1
    #> Average Acceptance Rate for beta : 1
    #>
    #> Maximum Number of Clusters Allowed (K): 100
    #> Maximum Number of Clusters Activated  : 8
    #> Current Number of Active Clusters     : 8
    #>
    #> Percentage of data classified in each cluster k at current iteraction (displaying only clusters with more than 5% of the data)
    #>     1.0000    2.0000    3.0000    4.0000
    #>    15.0000   20.0000   30.0000   15.0000
    #>
    #> [==================================================                     ] 70 %

    #>
    #> -----------------------------------------------------
    #> MCMC in progress ....
    #>
    #> Family of the distribution of the outcome variable of the mixture components: gaussian
    #>
    #> Burn-in: 1
    #> Number of MCMC samples: 50
    #>
    #> Iteration: 36
    #>
    #> Acceptance Rate for beta         : 1
    #> Average Acceptance Rate for beta : 1
    #>
    #> Maximum Number of Clusters Allowed (K): 100
    #> Maximum Number of Clusters Activated  : 8
    #> Current Number of Active Clusters     : 7
    #>
    #> Percentage of data classified in each cluster k at current iteraction (displaying only clusters with more than 5% of the data)
    #>     1.0000    2.0000    3.0000    4.0000    5.0000
    #>    20.0000   15.0000   30.0000   15.0000   10.0000
    #>
    #> [===================================================                    ] 72 %

    #>
    #> -----------------------------------------------------
    #> MCMC in progress ....
    #>
    #> Family of the distribution of the outcome variable of the mixture components: gaussian
    #>
    #> Burn-in: 1
    #> Number of MCMC samples: 50
    #>
    #> Iteration: 37
    #>
    #> Acceptance Rate for beta         : 1
    #> Average Acceptance Rate for beta : 1
    #>
    #> Maximum Number of Clusters Allowed (K): 100
    #> Maximum Number of Clusters Activated  : 8
    #> Current Number of Active Clusters     : 5
    #>
    #> Percentage of data classified in each cluster k at current iteraction (displaying only clusters with more than 5% of the data)
    #>     1.0000    2.0000    3.0000    4.0000    5.0000
    #>    20.0000   10.0000   30.0000   20.0000   20.0000
    #>
    #> [=====================================================                  ] 74 %

    #>
    #> -----------------------------------------------------
    #> MCMC in progress ....
    #>
    #> Family of the distribution of the outcome variable of the mixture components: gaussian
    #>
    #> Burn-in: 1
    #> Number of MCMC samples: 50
    #>
    #> Iteration: 38
    #>
    #> Acceptance Rate for beta         : 1
    #> Average Acceptance Rate for beta : 1
    #>
    #> Maximum Number of Clusters Allowed (K): 100
    #> Maximum Number of Clusters Activated  : 8
    #> Current Number of Active Clusters     : 6
    #>
    #> Percentage of data classified in each cluster k at current iteraction (displaying only clusters with more than 5% of the data)
    #>     1.0000    2.0000    3.0000    4.0000    5.0000
    #>    20.0000   15.0000   30.0000   20.0000   10.0000
    #>
    #> [======================================================                 ] 76 %

    #>
    #> -----------------------------------------------------
    #> MCMC in progress ....
    #>
    #> Family of the distribution of the outcome variable of the mixture components: gaussian
    #>
    #> Burn-in: 1
    #> Number of MCMC samples: 50
    #>
    #> Iteration: 39
    #>
    #> Acceptance Rate for beta         : 1
    #> Average Acceptance Rate for beta : 1
    #>
    #> Maximum Number of Clusters Allowed (K): 100
    #> Maximum Number of Clusters Activated  : 8
    #> Current Number of Active Clusters     : 6
    #>
    #> Percentage of data classified in each cluster k at current iteraction (displaying only clusters with more than 5% of the data)
    #>     1.0000    3.0000    4.0000    5.0000    7.0000
    #>    20.0000   30.0000   20.0000   15.0000   10.0000
    #>
    #> [=======================================================                ] 78 %

    #>
    #> -----------------------------------------------------
    #> MCMC in progress ....
    #>
    #> Family of the distribution of the outcome variable of the mixture components: gaussian
    #>
    #> Burn-in: 1
    #> Number of MCMC samples: 50
    #>
    #> Iteration: 40
    #>
    #> Acceptance Rate for beta         : 1
    #> Average Acceptance Rate for beta : 1
    #>
    #> Maximum Number of Clusters Allowed (K): 100
    #> Maximum Number of Clusters Activated  : 8
    #> Current Number of Active Clusters     : 5
    #>
    #> Percentage of data classified in each cluster k at current iteraction (displaying only clusters with more than 5% of the data)
    #>     2.0000    3.0000    4.0000    5.0000
    #>    15.0000   45.0000   25.0000   10.0000
    #>
    #> [=========================================================              ] 80 %

    #>
    #> -----------------------------------------------------
    #> MCMC in progress ....
    #>
    #> Family of the distribution of the outcome variable of the mixture components: gaussian
    #>
    #> Burn-in: 1
    #> Number of MCMC samples: 50
    #>
    #> Iteration: 41
    #>
    #> Acceptance Rate for beta         : 1
    #> Average Acceptance Rate for beta : 1
    #>
    #> Maximum Number of Clusters Allowed (K): 100
    #> Maximum Number of Clusters Activated  : 8
    #> Current Number of Active Clusters     : 6
    #>
    #> Percentage of data classified in each cluster k at current iteraction (displaying only clusters with more than 5% of the data)
    #>     2.0000    3.0000    4.0000    5.0000    6.0000
    #>    10.0000   35.0000   20.0000   15.0000   15.0000
    #>
    #> [==========================================================             ] 82 %

    #>
    #> -----------------------------------------------------
    #> MCMC in progress ....
    #>
    #> Family of the distribution of the outcome variable of the mixture components: gaussian
    #>
    #> Burn-in: 1
    #> Number of MCMC samples: 50
    #>
    #> Iteration: 42
    #>
    #> Acceptance Rate for beta         : 1
    #> Average Acceptance Rate for beta : 1
    #>
    #> Maximum Number of Clusters Allowed (K): 100
    #> Maximum Number of Clusters Activated  : 8
    #> Current Number of Active Clusters     : 5
    #>
    #> Percentage of data classified in each cluster k at current iteraction (displaying only clusters with more than 5% of the data)
    #>     2.0000    3.0000    4.0000    5.0000
    #>    15.0000   50.0000   20.0000   10.0000
    #>
    #> [============================================================           ] 84 %

    #>
    #> -----------------------------------------------------
    #> MCMC in progress ....
    #>
    #> Family of the distribution of the outcome variable of the mixture components: gaussian
    #>
    #> Burn-in: 1
    #> Number of MCMC samples: 50
    #>
    #> Iteration: 43
    #>
    #> Acceptance Rate for beta         : 1
    #> Average Acceptance Rate for beta : 1
    #>
    #> Maximum Number of Clusters Allowed (K): 100
    #> Maximum Number of Clusters Activated  : 8
    #> Current Number of Active Clusters     : 7
    #>
    #> Percentage of data classified in each cluster k at current iteraction (displaying only clusters with more than 5% of the data)
    #>     2.0000    3.0000    4.0000    5.0000    8.0000
    #>    10.0000   45.0000   15.0000   10.0000   10.0000
    #>
    #> [=============================================================          ] 86 %

    #>
    #> -----------------------------------------------------
    #> MCMC in progress ....
    #>
    #> Family of the distribution of the outcome variable of the mixture components: gaussian
    #>
    #> Burn-in: 1
    #> Number of MCMC samples: 50
    #>
    #> Iteration: 44
    #>
    #> Acceptance Rate for beta         : 1
    #> Average Acceptance Rate for beta : 1
    #>
    #> Maximum Number of Clusters Allowed (K): 100
    #> Maximum Number of Clusters Activated  : 8
    #> Current Number of Active Clusters     : 7
    #>
    #> Percentage of data classified in each cluster k at current iteraction (displaying only clusters with more than 5% of the data)
    #>     2.0000    3.0000    4.0000    5.0000
    #>    15.0000   45.0000   15.0000   10.0000
    #>
    #> [==============================================================         ] 88 %

    #>
    #> -----------------------------------------------------
    #> MCMC in progress ....
    #>
    #> Family of the distribution of the outcome variable of the mixture components: gaussian
    #>
    #> Burn-in: 1
    #> Number of MCMC samples: 50
    #>
    #> Iteration: 45
    #>
    #> Acceptance Rate for beta         : 1
    #> Average Acceptance Rate for beta : 1
    #>
    #> Maximum Number of Clusters Allowed (K): 100
    #> Maximum Number of Clusters Activated  : 8
    #> Current Number of Active Clusters     : 4
    #>
    #> Percentage of data classified in each cluster k at current iteraction (displaying only clusters with more than 5% of the data)
    #>     2.0000    3.0000    4.0000
    #>    20.0000   50.0000   25.0000
    #>
    #> [================================================================       ] 90 %

    #>
    #> -----------------------------------------------------
    #> MCMC in progress ....
    #>
    #> Family of the distribution of the outcome variable of the mixture components: gaussian
    #>
    #> Burn-in: 1
    #> Number of MCMC samples: 50
    #>
    #> Iteration: 46
    #>
    #> Acceptance Rate for beta         : 1
    #> Average Acceptance Rate for beta : 1
    #>
    #> Maximum Number of Clusters Allowed (K): 100
    #> Maximum Number of Clusters Activated  : 8
    #> Current Number of Active Clusters     : 6
    #>
    #> Percentage of data classified in each cluster k at current iteraction (displaying only clusters with more than 5% of the data)
    #>     2.0000    3.0000    4.0000
    #>    15.0000   50.0000   20.0000
    #>
    #> [=================================================================      ] 92 %

    #>
    #> -----------------------------------------------------
    #> MCMC in progress ....
    #>
    #> Family of the distribution of the outcome variable of the mixture components: gaussian
    #>
    #> Burn-in: 1
    #> Number of MCMC samples: 50
    #>
    #> Iteration: 47
    #>
    #> Acceptance Rate for beta         : 1
    #> Average Acceptance Rate for beta : 1
    #>
    #> Maximum Number of Clusters Allowed (K): 100
    #> Maximum Number of Clusters Activated  : 8
    #> Current Number of Active Clusters     : 4
    #>
    #> Percentage of data classified in each cluster k at current iteraction (displaying only clusters with more than 5% of the data)
    #>     2.0000    3.0000    4.0000
    #>    25.0000   50.0000   20.0000
    #>
    #> [==================================================================     ] 94 %

    #>
    #> -----------------------------------------------------
    #> MCMC in progress ....
    #>
    #> Family of the distribution of the outcome variable of the mixture components: gaussian
    #>
    #> Burn-in: 1
    #> Number of MCMC samples: 50
    #>
    #> Iteration: 48
    #>
    #> Acceptance Rate for beta         : 1
    #> Average Acceptance Rate for beta : 1
    #>
    #> Maximum Number of Clusters Allowed (K): 100
    #> Maximum Number of Clusters Activated  : 8
    #> Current Number of Active Clusters     : 3
    #>
    #> Percentage of data classified in each cluster k at current iteraction (displaying only clusters with more than 5% of the data)
    #>     2.0000    3.0000    4.0000
    #>    25.0000   50.0000   25.0000
    #>
    #> [====================================================================   ] 96 %

    #>
    #> -----------------------------------------------------
    #> MCMC in progress ....
    #>
    #> Family of the distribution of the outcome variable of the mixture components: gaussian
    #>
    #> Burn-in: 1
    #> Number of MCMC samples: 50
    #>
    #> Iteration: 49
    #>
    #> Acceptance Rate for beta         : 1
    #> Average Acceptance Rate for beta : 1
    #>
    #> Maximum Number of Clusters Allowed (K): 100
    #> Maximum Number of Clusters Activated  : 8
    #> Current Number of Active Clusters     : 5
    #>
    #> Percentage of data classified in each cluster k at current iteraction (displaying only clusters with more than 5% of the data)
    #>     1.0000    2.0000    3.0000    4.0000
    #>    10.0000   25.0000   40.0000   20.0000
    #>
    #> [=====================================================================  ] 98 %

    #>
    #> -----------------------------------------------------
    #> MCMC in progress ....
    #>
    #> Family of the distribution of the outcome variable of the mixture components: gaussian
    #>
    #> Burn-in: 1
    #> Number of MCMC samples: 50
    #>
    #> Iteration: 50
    #>
    #> Acceptance Rate for beta         : 1
    #> Average Acceptance Rate for beta : 1
    #>
    #> Maximum Number of Clusters Allowed (K): 100
    #> Maximum Number of Clusters Activated  : 8
    #> Current Number of Active Clusters     : 5
    #>
    #> Percentage of data classified in each cluster k at current iteraction (displaying only clusters with more than 5% of the data)
    #>     2.0000    3.0000    4.0000
    #>    20.0000   50.0000   20.0000
    #>
    #> [=======================================================================] 100 %

    #>
    #> -----------------------------------------------------
    #> MCMC in progress ....
    #>
    #> Family of the distribution of the outcome variable of the mixture components: gaussian
    #>
    #> Burn-in: 1
    #> Number of MCMC samples: 50
    #>
    #> Iteration: 51
    #>
    #> Acceptance Rate for beta         : 1
    #> Average Acceptance Rate for beta : 1
    #>
    #> Maximum Number of Clusters Allowed (K): 100
    #> Maximum Number of Clusters Activated  : 8
    #> Current Number of Active Clusters     : 5
    #>
    #> Percentage of data classified in each cluster k at current iteraction (displaying only clusters with more than 5% of the data)
    #>     2.0000    3.0000    4.0000    6.0000
    #>    15.0000   50.0000   20.0000   10.0000
    #>
    #> [=======================================================================] 100 %

    plot(samples)
    #>
    #>
    #> Generating plot...
    #>