This function plots the posterior expectation of beta, the linear effect of the individual level covariates, as function of the context-level covariates
plot_pexp_beta(
samples,
X = NULL,
W = NULL,
pred.pexp.beta = FALSE,
ncol.beta = NULL,
ylab = NULL,
nrow.w = NULL,
ncol.w = NULL,
smooth.line = FALSE,
title = NULL,
legend.position = "top",
col.pred.line = "red",
x.axis.size = 1.1,
y.axis.size = 1.1,
title.size = 12,
panel.title.size = 1.4,
legend.size = 1
)
an output of the function hdpGLM
a string vector with the name of the first-level covariates whose associated tau should be displayed
a string vector with the name of the context-level covariate(s) whose linear effect will be displayed. If NULL
, the linear effect tau of all context-level covariates are displayed. Note: the context-level covariate must have been included in the estimation of the model.
boolean, if TRUE
the plots will display a line with the predicted posterior expectation of betas obtained using the posterior expectation of taus, the linear coefficients of the expectation of beta
integer with number of columns of the grid used for each group of context-level covariates
string, the label of the y-axis
integer with the number of rows of the grid
integer with the number of columns of the grid
boolean, if TRUE
the plot will display a regression line representing the regression of the posterior expectation of the linear coefficients betas on the context-level covariates. Default FALSE
string, title of the plot
one of four options: "bottom" (default), "top", "left", or "right". It indicates the position of the legend
string with color of fitted line. Only works if pred.pexp.beta=TRUE
numeric, the relative size of the label in the x-axis
numeric, the relative size of the label in the y-axis
numeric, absolute size of the title
numeric, the relative size of the titles in the panel of the plot
numeric, the relative size of the legend
library(magrittr)
set.seed(66)
# Note: this example is just for illustration. MCMC iterations are very reduced
set.seed(10)
n = 20
data.context1 = 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)) ,
w = 20
)
data.context2 = tibble::tibble(x1 = rnorm(n, -3),
x2 = rnorm(n, 3),
z = sample(1:2, n, replace=TRUE),
y =I(z==1) * (1 + 3*x1 - 2*x2 + rnorm(n)) +
I(z==2) * (1 - 2*x1 + x2 + rnorm(n)),
w = 10
)
data = data.context1 %>%
dplyr::bind_rows(data.context2)
## estimation
mcmc = list(burn.in=1, n.iter=50)
samples = hdpGLM(y ~ x1 + x2, y ~ w, 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 Iterations : 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 Among All Contexts : 1
#> Maximum Number of Clusters Active in the Current Iteration : 1
#>
#> (displaying only clusters with more than 5% of the data)
#> Clusters in Context 1
#> 1.0000e+00
#> 1.0000e+02
#>
#> Clusters in Context 2
#> 1.0000
#> 95.0000
#>
#> [=== ] 3 %
#>
#> -----------------------------------------------------
#> MCMC in progress ....
#>
#> Family of the distribution of the outcome variable of the mixture components: gaussian
#>
#> Burn-in: 1
#> Number of MCMC Iterations : 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 Among All Contexts : 2
#> Maximum Number of Clusters Active in the Current Iteration : 2
#>
#> (displaying only clusters with more than 5% of the data)
#> Clusters in Context 1
#> 1.0000 2.0000
#> 25.0000 75.0000
#>
#> Clusters in Context 2
#> 1.0000 3.0000 4.0000
#> 10.0000 55.0000 35.0000
#>
#> [===== ] 5 %
#>
#> -----------------------------------------------------
#> MCMC in progress ....
#>
#> Family of the distribution of the outcome variable of the mixture components: gaussian
#>
#> Burn-in: 1
#> Number of MCMC Iterations : 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 Among All Contexts : 4
#> Maximum Number of Clusters Active in the Current Iteration : 4
#>
#> (displaying only clusters with more than 5% of the data)
#> Clusters in Context 1
#> 1.0000 2.0000 3.0000 5.0000
#> 15.0000 10.0000 40.0000 35.0000
#>
#> Clusters in Context 2
#> 1.0000 2.0000 3.0000 4.0000 7.0000
#> 10.0000 30.0000 30.0000 10.0000 15.0000
#>
#> [====== ] 7 %
#>
#> -----------------------------------------------------
#> MCMC in progress ....
#>
#> Family of the distribution of the outcome variable of the mixture components: gaussian
#>
#> Burn-in: 1
#> Number of MCMC Iterations : 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 Among All Contexts : 6
#> Maximum Number of Clusters Active in the Current Iteration : 6
#>
#> (displaying only clusters with more than 5% of the data)
#> Clusters in Context 1
#> 2.0000 4.0000 5.0000 7.0000
#> 10.0000 35.0000 10.0000 35.0000
#>
#> Clusters in Context 2
#> 3.0000 4.0000 5.0000 7.0000
#> 35.0000 15.0000 20.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 Iterations : 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 Among All Contexts : 8
#> Maximum Number of Clusters Active in the Current Iteration : 8
#>
#> (displaying only clusters with more than 5% of the data)
#> Clusters in Context 1
#> 1.0000 3.0000 4.0000 5.0000 6.0000
#> 10.0000 35.0000 10.0000 10.0000 20.0000
#>
#> Clusters in Context 2
#> 3.0000 7.0000
#> 50.0000 40.0000
#>
#> [========= ] 11 %
#>
#> -----------------------------------------------------
#> MCMC in progress ....
#>
#> Family of the distribution of the outcome variable of the mixture components: gaussian
#>
#> Burn-in: 1
#> Number of MCMC Iterations : 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 Among All Contexts : 9
#> Maximum Number of Clusters Active in the Current Iteration : 9
#>
#> (displaying only clusters with more than 5% of the data)
#> Clusters in Context 1
#> 2.0000 3.0000 5.0000 6.0000 7.0000 8.0000
#> 15.0000 10.0000 10.0000 15.0000 10.0000 25.0000
#>
#> Clusters in Context 2
#> 3.0000 7.0000
#> 50.0000 40.0000
#>
#> [========== ] 13 %
#>
#> -----------------------------------------------------
#> MCMC in progress ....
#>
#> Family of the distribution of the outcome variable of the mixture components: gaussian
#>
#> Burn-in: 1
#> Number of MCMC Iterations : 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 Among All Contexts : 9
#> Maximum Number of Clusters Active in the Current Iteration : 8
#>
#> (displaying only clusters with more than 5% of the data)
#> Clusters in Context 1
#> 2.0000 3.0000 4.0000 5.0000 6.0000 11.0000
#> 20.0000 10.0000 15.0000 15.0000 20.0000 10.0000
#>
#> Clusters in Context 2
#> 3.0000 7.0000
#> 50.0000 40.0000
#>
#> [=========== ] 15 %
#>
#> -----------------------------------------------------
#> MCMC in progress ....
#>
#> Family of the distribution of the outcome variable of the mixture components: gaussian
#>
#> Burn-in: 1
#> Number of MCMC Iterations : 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 Among All Contexts : 9
#> Maximum Number of Clusters Active in the Current Iteration : 7
#>
#> (displaying only clusters with more than 5% of the data)
#> Clusters in Context 1
#> 1.0000 2.0000 4.0000 5.0000 6.0000
#> 15.0000 10.0000 15.0000 25.0000 25.0000
#>
#> Clusters in Context 2
#> 3.0000 7.0000
#> 50.0000 45.0000
#>
#> [============= ] 17 %
#>
#> -----------------------------------------------------
#> MCMC in progress ....
#>
#> Family of the distribution of the outcome variable of the mixture components: gaussian
#>
#> Burn-in: 1
#> Number of MCMC Iterations : 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 Among All Contexts : 9
#> Maximum Number of Clusters Active in the Current Iteration : 8
#>
#> (displaying only clusters with more than 5% of the data)
#> Clusters in Context 1
#> 2.0000 4.0000 5.0000 6.0000
#> 10.0000 20.0000 10.0000 40.0000
#>
#> Clusters in Context 2
#> 3.0000 7.0000
#> 50.0000 45.0000
#>
#> [============== ] 19 %
#>
#> -----------------------------------------------------
#> MCMC in progress ....
#>
#> Family of the distribution of the outcome variable of the mixture components: gaussian
#>
#> Burn-in: 1
#> Number of MCMC Iterations : 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 Among All Contexts : 9
#> Maximum Number of Clusters Active in the Current Iteration : 9
#>
#> (displaying only clusters with more than 5% of the data)
#> Clusters in Context 1
#> 2.0000 4.0000 5.0000 6.0000
#> 15.0000 15.0000 10.0000 35.0000
#>
#> Clusters in Context 2
#> 3.0000 7.0000
#> 50.0000 40.0000
#>
#> [================ ] 21 %
#>
#> -----------------------------------------------------
#> MCMC in progress ....
#>
#> Family of the distribution of the outcome variable of the mixture components: gaussian
#>
#> Burn-in: 1
#> Number of MCMC Iterations : 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 Among All Contexts : 9
#> Maximum Number of Clusters Active in the Current Iteration : 8
#>
#> (displaying only clusters with more than 5% of the data)
#> Clusters in Context 1
#> 1.0000 4.0000 6.0000 7.0000 10.0000
#> 15.0000 15.0000 35.0000 10.0000 10.0000
#>
#> Clusters in Context 2
#> 3.0000 7.0000
#> 50.0000 50.0000
#>
#> [================= ] 23 %
#>
#> -----------------------------------------------------
#> MCMC in progress ....
#>
#> Family of the distribution of the outcome variable of the mixture components: gaussian
#>
#> Burn-in: 1
#> Number of MCMC Iterations : 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 Among All Contexts : 9
#> Maximum Number of Clusters Active in the Current Iteration : 8
#>
#> (displaying only clusters with more than 5% of the data)
#> Clusters in Context 1
#> 4.0000 6.0000 7.0000 9.0000
#> 15.0000 40.0000 15.0000 10.0000
#>
#> Clusters in Context 2
#> 3.0000 7.0000
#> 50.0000 50.0000
#>
#> [================== ] 25 %
#>
#> -----------------------------------------------------
#> MCMC in progress ....
#>
#> Family of the distribution of the outcome variable of the mixture components: gaussian
#>
#> Burn-in: 1
#> Number of MCMC Iterations : 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 Among All Contexts : 9
#> Maximum Number of Clusters Active in the Current Iteration : 8
#>
#> (displaying only clusters with more than 5% of the data)
#> Clusters in Context 1
#> 1.0000 4.0000 6.0000 7.0000
#> 10.0000 15.0000 45.0000 10.0000
#>
#> Clusters in Context 2
#> 3.0000 7.0000
#> 50.0000 50.0000
#>
#> [==================== ] 27 %
#>
#> -----------------------------------------------------
#> MCMC in progress ....
#>
#> Family of the distribution of the outcome variable of the mixture components: gaussian
#>
#> Burn-in: 1
#> Number of MCMC Iterations : 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 Among All Contexts : 9
#> Maximum Number of Clusters Active in the Current Iteration : 8
#>
#> (displaying only clusters with more than 5% of the data)
#> Clusters in Context 1
#> 1.0000 3.0000 4.0000 6.0000 7.0000
#> 10.0000 10.0000 15.0000 40.0000 10.0000
#>
#> Clusters in Context 2
#> 3.0000 7.0000
#> 45.0000 45.0000
#>
#> [===================== ] 29 %
#>
#> -----------------------------------------------------
#> MCMC in progress ....
#>
#> Family of the distribution of the outcome variable of the mixture components: gaussian
#>
#> Burn-in: 1
#> Number of MCMC Iterations : 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 Among All Contexts : 9
#> Maximum Number of Clusters Active in the Current Iteration : 5
#>
#> (displaying only clusters with more than 5% of the data)
#> Clusters in Context 1
#> 1.0000 3.0000 4.0000 6.0000
#> 20.0000 10.0000 15.0000 50.0000
#>
#> Clusters in Context 2
#> 3.0000 7.0000
#> 50.0000 45.0000
#>
#> [====================== ] 31 %
#>
#> -----------------------------------------------------
#> MCMC in progress ....
#>
#> Family of the distribution of the outcome variable of the mixture components: gaussian
#>
#> Burn-in: 1
#> Number of MCMC Iterations : 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 Among All Contexts : 9
#> Maximum Number of Clusters Active in the Current Iteration : 6
#>
#> (displaying only clusters with more than 5% of the data)
#> Clusters in Context 1
#> 1.0000 4.0000 6.0000
#> 20.0000 15.0000 50.0000
#>
#> Clusters in Context 2
#> 3.0000 7.0000
#> 50.0000 45.0000
#>
#> [======================== ] 33 %
#>
#> -----------------------------------------------------
#> MCMC in progress ....
#>
#> Family of the distribution of the outcome variable of the mixture components: gaussian
#>
#> Burn-in: 1
#> Number of MCMC Iterations : 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 Among All Contexts : 9
#> Maximum Number of Clusters Active in the Current Iteration : 6
#>
#> (displaying only clusters with more than 5% of the data)
#> Clusters in Context 1
#> 1.0000 3.0000 4.0000 5.0000 6.0000
#> 10.0000 10.0000 10.0000 15.0000 50.0000
#>
#> Clusters in Context 2
#> 1.0000 3.0000 7.0000
#> 10.0000 50.0000 40.0000
#>
#> [========================= ] 35 %
#>
#> -----------------------------------------------------
#> MCMC in progress ....
#>
#> Family of the distribution of the outcome variable of the mixture components: gaussian
#>
#> Burn-in: 1
#> Number of MCMC Iterations : 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 Among All Contexts : 9
#> Maximum Number of Clusters Active in the Current Iteration : 6
#>
#> (displaying only clusters with more than 5% of the data)
#> Clusters in Context 1
#> 1.0000 2.0000 3.0000 6.0000
#> 10.0000 20.0000 10.0000 50.0000
#>
#> Clusters in Context 2
#> 1.0000 3.0000 7.0000
#> 10.0000 50.0000 40.0000
#>
#> [=========================== ] 37 %
#>
#> -----------------------------------------------------
#> MCMC in progress ....
#>
#> Family of the distribution of the outcome variable of the mixture components: gaussian
#>
#> Burn-in: 1
#> Number of MCMC Iterations : 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 Among All Contexts : 9
#> Maximum Number of Clusters Active in the Current Iteration : 7
#>
#> (displaying only clusters with more than 5% of the data)
#> Clusters in Context 1
#> 1.0000 2.0000 3.0000 6.0000 7.0000
#> 10.0000 15.0000 10.0000 45.0000 10.0000
#>
#> Clusters in Context 2
#> 1.0000 3.0000 6.0000 7.0000
#> 10.0000 50.0000 10.0000 30.0000
#>
#> [============================ ] 39 %
#>
#> -----------------------------------------------------
#> MCMC in progress ....
#>
#> Family of the distribution of the outcome variable of the mixture components: gaussian
#>
#> Burn-in: 1
#> Number of MCMC Iterations : 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 Among All Contexts : 9
#> Maximum Number of Clusters Active in the Current Iteration : 7
#>
#> (displaying only clusters with more than 5% of the data)
#> Clusters in Context 1
#> 1.0000 2.0000 5.0000 6.0000
#> 15.0000 10.0000 15.0000 45.0000
#>
#> Clusters in Context 2
#> 1.0000 3.0000 7.0000
#> 10.0000 50.0000 35.0000
#>
#> [============================= ] 41 %
#>
#> -----------------------------------------------------
#> MCMC in progress ....
#>
#> Family of the distribution of the outcome variable of the mixture components: gaussian
#>
#> Burn-in: 1
#> Number of MCMC Iterations : 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 Among All Contexts : 9
#> Maximum Number of Clusters Active in the Current Iteration : 6
#>
#> (displaying only clusters with more than 5% of the data)
#> Clusters in Context 1
#> 1.0000 2.0000 4.0000 6.0000
#> 20.0000 10.0000 10.0000 50.0000
#>
#> Clusters in Context 2
#> 1.0000 3.0000 7.0000
#> 10.0000 45.0000 40.0000
#>
#> [=============================== ] 43 %
#>
#> -----------------------------------------------------
#> MCMC in progress ....
#>
#> Family of the distribution of the outcome variable of the mixture components: gaussian
#>
#> Burn-in: 1
#> Number of MCMC Iterations : 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 Among All Contexts : 9
#> Maximum Number of Clusters Active in the Current Iteration : 6
#>
#> (displaying only clusters with more than 5% of the data)
#> Clusters in Context 1
#> 1.0000 2.0000 6.0000
#> 20.0000 15.0000 50.0000
#>
#> Clusters in Context 2
#> 1.0000 3.0000 7.0000
#> 10.0000 50.0000 40.0000
#>
#> [================================ ] 45 %
#>
#> -----------------------------------------------------
#> MCMC in progress ....
#>
#> Family of the distribution of the outcome variable of the mixture components: gaussian
#>
#> Burn-in: 1
#> Number of MCMC Iterations : 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 Among All Contexts : 9
#> Maximum Number of Clusters Active in the Current Iteration : 5
#>
#> (displaying only clusters with more than 5% of the data)
#> Clusters in Context 1
#> 1.0000 2.0000 3.0000 6.0000
#> 25.0000 10.0000 10.0000 50.0000
#>
#> Clusters in Context 2
#> 1.0000 3.0000 7.0000
#> 15.0000 50.0000 35.0000
#>
#> [================================= ] 47 %
#>
#> -----------------------------------------------------
#> MCMC in progress ....
#>
#> Family of the distribution of the outcome variable of the mixture components: gaussian
#>
#> Burn-in: 1
#> Number of MCMC Iterations : 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 Among All Contexts : 9
#> Maximum Number of Clusters Active in the Current Iteration : 5
#>
#> (displaying only clusters with more than 5% of the data)
#> Clusters in Context 1
#> 1.0000 2.0000 3.0000 4.0000 6.0000
#> 20.0000 10.0000 10.0000 10.0000 50.0000
#>
#> Clusters in Context 2
#> 1.0000 3.0000 7.0000
#> 15.0000 50.0000 35.0000
#>
#> [=================================== ] 49 %
#>
#> -----------------------------------------------------
#> MCMC in progress ....
#>
#> Family of the distribution of the outcome variable of the mixture components: gaussian
#>
#> Burn-in: 1
#> Number of MCMC Iterations : 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 Among All Contexts : 9
#> Maximum Number of Clusters Active in the Current Iteration : 5
#>
#> (displaying only clusters with more than 5% of the data)
#> Clusters in Context 1
#> 1.0000 3.0000 6.0000
#> 25.0000 15.0000 50.0000
#>
#> Clusters in Context 2
#> 1.0000 3.0000 7.0000
#> 25.0000 40.0000 25.0000
#>
#> [==================================== ] 50 %
#>
#> -----------------------------------------------------
#> MCMC in progress ....
#>
#> Family of the distribution of the outcome variable of the mixture components: gaussian
#>
#> Burn-in: 1
#> Number of MCMC Iterations : 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 Among All Contexts : 9
#> Maximum Number of Clusters Active in the Current Iteration : 4
#>
#> (displaying only clusters with more than 5% of the data)
#> Clusters in Context 1
#> 1.0000 2.0000 3.0000 6.0000
#> 25.0000 10.0000 15.0000 50.0000
#>
#> Clusters in Context 2
#> 1.0000 3.0000 7.0000
#> 35.0000 45.0000 15.0000
#>
#> [====================================== ] 52 %
#>
#> -----------------------------------------------------
#> MCMC in progress ....
#>
#> Family of the distribution of the outcome variable of the mixture components: gaussian
#>
#> Burn-in: 1
#> Number of MCMC Iterations : 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 Among All Contexts : 9
#> Maximum Number of Clusters Active in the Current Iteration : 4
#>
#> (displaying only clusters with more than 5% of the data)
#> Clusters in Context 1
#> 1.0000 2.0000 3.0000 6.0000
#> 25.0000 10.0000 15.0000 50.0000
#>
#> Clusters in Context 2
#> 1.0000 3.0000
#> 45.0000 45.0000
#>
#> [======================================= ] 54 %
#>
#> -----------------------------------------------------
#> MCMC in progress ....
#>
#> Family of the distribution of the outcome variable of the mixture components: gaussian
#>
#> Burn-in: 1
#> Number of MCMC Iterations : 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 Among All Contexts : 9
#> Maximum Number of Clusters Active in the Current Iteration : 6
#>
#> (displaying only clusters with more than 5% of the data)
#> Clusters in Context 1
#> 1.0000 3.0000 4.0000 6.0000
#> 20.0000 15.0000 10.0000 45.0000
#>
#> Clusters in Context 2
#> 1.0000 3.0000
#> 50.0000 50.0000
#>
#> [======================================== ] 56 %
#>
#> -----------------------------------------------------
#> MCMC in progress ....
#>
#> Family of the distribution of the outcome variable of the mixture components: gaussian
#>
#> Burn-in: 1
#> Number of MCMC Iterations : 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 Among All Contexts : 9
#> Maximum Number of Clusters Active in the Current Iteration : 6
#>
#> (displaying only clusters with more than 5% of the data)
#> Clusters in Context 1
#> 1.0000 2.0000 3.0000 6.0000
#> 20.0000 10.0000 10.0000 50.0000
#>
#> Clusters in Context 2
#> 1.0000 3.0000
#> 45.0000 50.0000
#>
#> [========================================== ] 58 %
#>
#> -----------------------------------------------------
#> MCMC in progress ....
#>
#> Family of the distribution of the outcome variable of the mixture components: gaussian
#>
#> Burn-in: 1
#> Number of MCMC Iterations : 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 Among All Contexts : 9
#> Maximum Number of Clusters Active in the Current Iteration : 6
#>
#> (displaying only clusters with more than 5% of the data)
#> Clusters in Context 1
#> 1.0000 2.0000 3.0000 6.0000
#> 15.0000 10.0000 15.0000 50.0000
#>
#> Clusters in Context 2
#> 1.0000 3.0000
#> 50.0000 50.0000
#>
#> [=========================================== ] 60 %
#>
#> -----------------------------------------------------
#> MCMC in progress ....
#>
#> Family of the distribution of the outcome variable of the mixture components: gaussian
#>
#> Burn-in: 1
#> Number of MCMC Iterations : 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 Among All Contexts : 9
#> Maximum Number of Clusters Active in the Current Iteration : 5
#>
#> (displaying only clusters with more than 5% of the data)
#> Clusters in Context 1
#> 1.0000 3.0000 6.0000
#> 25.0000 15.0000 50.0000
#>
#> Clusters in Context 2
#> 1.0000 3.0000
#> 50.0000 50.0000
#>
#> [============================================ ] 62 %
#>
#> -----------------------------------------------------
#> MCMC in progress ....
#>
#> Family of the distribution of the outcome variable of the mixture components: gaussian
#>
#> Burn-in: 1
#> Number of MCMC Iterations : 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 Among All Contexts : 9
#> Maximum Number of Clusters Active in the Current Iteration : 5
#>
#> (displaying only clusters with more than 5% of the data)
#> Clusters in Context 1
#> 1.0000 3.0000 6.0000
#> 20.0000 20.0000 50.0000
#>
#> Clusters in Context 2
#> 1.0000 3.0000
#> 50.0000 50.0000
#>
#> [============================================== ] 64 %
#>
#> -----------------------------------------------------
#> MCMC in progress ....
#>
#> Family of the distribution of the outcome variable of the mixture components: gaussian
#>
#> Burn-in: 1
#> Number of MCMC Iterations : 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 Among All Contexts : 9
#> Maximum Number of Clusters Active in the Current Iteration : 6
#>
#> (displaying only clusters with more than 5% of the data)
#> Clusters in Context 1
#> 1.0000 3.0000 6.0000
#> 15.0000 20.0000 50.0000
#>
#> Clusters in Context 2
#> 1.0000 3.0000
#> 50.0000 50.0000
#>
#> [=============================================== ] 66 %
#>
#> -----------------------------------------------------
#> MCMC in progress ....
#>
#> Family of the distribution of the outcome variable of the mixture components: gaussian
#>
#> Burn-in: 1
#> Number of MCMC Iterations : 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 Among All Contexts : 9
#> Maximum Number of Clusters Active in the Current Iteration : 4
#>
#> (displaying only clusters with more than 5% of the data)
#> Clusters in Context 1
#> 1.0000 3.0000 6.0000
#> 25.0000 20.0000 50.0000
#>
#> Clusters in Context 2
#> 1.0000 3.0000
#> 50.0000 45.0000
#>
#> [================================================= ] 68 %
#>
#> -----------------------------------------------------
#> MCMC in progress ....
#>
#> Family of the distribution of the outcome variable of the mixture components: gaussian
#>
#> Burn-in: 1
#> Number of MCMC Iterations : 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 Among All Contexts : 9
#> Maximum Number of Clusters Active in the Current Iteration : 4
#>
#> (displaying only clusters with more than 5% of the data)
#> Clusters in Context 1
#> 1.0000 3.0000 6.0000
#> 25.0000 25.0000 45.0000
#>
#> Clusters in Context 2
#> 1.0000 3.0000
#> 50.0000 50.0000
#>
#> [================================================== ] 70 %
#>
#> -----------------------------------------------------
#> MCMC in progress ....
#>
#> Family of the distribution of the outcome variable of the mixture components: gaussian
#>
#> Burn-in: 1
#> Number of MCMC Iterations : 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 Among All Contexts : 9
#> Maximum Number of Clusters Active in the Current Iteration : 4
#>
#> (displaying only clusters with more than 5% of the data)
#> Clusters in Context 1
#> 1.0000 3.0000 6.0000
#> 25.0000 25.0000 45.0000
#>
#> Clusters in Context 2
#> 1.0000 3.0000
#> 45.0000 50.0000
#>
#> [=================================================== ] 72 %
#>
#> -----------------------------------------------------
#> MCMC in progress ....
#>
#> Family of the distribution of the outcome variable of the mixture components: gaussian
#>
#> Burn-in: 1
#> Number of MCMC Iterations : 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 Among All Contexts : 9
#> Maximum Number of Clusters Active in the Current Iteration : 5
#>
#> (displaying only clusters with more than 5% of the data)
#> Clusters in Context 1
#> 1.0000 3.0000 6.0000
#> 20.0000 25.0000 45.0000
#>
#> Clusters in Context 2
#> 1.0000 2.0000 3.0000
#> 40.0000 10.0000 50.0000
#>
#> [===================================================== ] 74 %
#>
#> -----------------------------------------------------
#> MCMC in progress ....
#>
#> Family of the distribution of the outcome variable of the mixture components: gaussian
#>
#> Burn-in: 1
#> Number of MCMC Iterations : 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 Among All Contexts : 9
#> Maximum Number of Clusters Active in the Current Iteration : 4
#>
#> (displaying only clusters with more than 5% of the data)
#> Clusters in Context 1
#> 1.0000 3.0000 5.0000 6.0000
#> 20.0000 30.0000 10.0000 40.0000
#>
#> Clusters in Context 2
#> 1.0000 3.0000
#> 50.0000 50.0000
#>
#> [====================================================== ] 76 %
#>
#> -----------------------------------------------------
#> MCMC in progress ....
#>
#> Family of the distribution of the outcome variable of the mixture components: gaussian
#>
#> Burn-in: 1
#> Number of MCMC Iterations : 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 Among All Contexts : 9
#> Maximum Number of Clusters Active in the Current Iteration : 5
#>
#> (displaying only clusters with more than 5% of the data)
#> Clusters in Context 1
#> 1.0000 2.0000 3.0000 6.0000
#> 20.0000 10.0000 25.0000 40.0000
#>
#> Clusters in Context 2
#> 1.0000 3.0000
#> 50.0000 50.0000
#>
#> [======================================================= ] 78 %
#>
#> -----------------------------------------------------
#> MCMC in progress ....
#>
#> Family of the distribution of the outcome variable of the mixture components: gaussian
#>
#> Burn-in: 1
#> Number of MCMC Iterations : 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 Among All Contexts : 9
#> Maximum Number of Clusters Active in the Current Iteration : 7
#>
#> (displaying only clusters with more than 5% of the data)
#> Clusters in Context 1
#> 1.0000 2.0000 3.0000 4.0000 6.0000
#> 10.0000 20.0000 15.0000 15.0000 30.0000
#>
#> Clusters in Context 2
#> 1.0000 3.0000
#> 45.0000 50.0000
#>
#> [========================================================= ] 80 %
#>
#> -----------------------------------------------------
#> MCMC in progress ....
#>
#> Family of the distribution of the outcome variable of the mixture components: gaussian
#>
#> Burn-in: 1
#> Number of MCMC Iterations : 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 Among All Contexts : 9
#> Maximum Number of Clusters Active in the Current Iteration : 5
#>
#> (displaying only clusters with more than 5% of the data)
#> Clusters in Context 1
#> 1.0000 2.0000 3.0000 4.0000
#> 15.0000 45.0000 20.0000 15.0000
#>
#> Clusters in Context 2
#> 1.0000 3.0000
#> 50.0000 50.0000
#>
#> [========================================================== ] 82 %
#>
#> -----------------------------------------------------
#> MCMC in progress ....
#>
#> Family of the distribution of the outcome variable of the mixture components: gaussian
#>
#> Burn-in: 1
#> Number of MCMC Iterations : 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 Among All Contexts : 9
#> Maximum Number of Clusters Active in the Current Iteration : 6
#>
#> (displaying only clusters with more than 5% of the data)
#> Clusters in Context 1
#> 1.0000 2.0000 3.0000 4.0000 6.0000
#> 15.0000 35.0000 20.0000 15.0000 10.0000
#>
#> Clusters in Context 2
#> 1.0000 2.0000 3.0000
#> 45.0000 10.0000 45.0000
#>
#> [============================================================ ] 84 %
#>
#> -----------------------------------------------------
#> MCMC in progress ....
#>
#> Family of the distribution of the outcome variable of the mixture components: gaussian
#>
#> Burn-in: 1
#> Number of MCMC Iterations : 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 Among All Contexts : 9
#> Maximum Number of Clusters Active in the Current Iteration : 6
#>
#> (displaying only clusters with more than 5% of the data)
#> Clusters in Context 1
#> 1.0000 2.0000 3.0000 4.0000
#> 15.0000 40.0000 20.0000 15.0000
#>
#> Clusters in Context 2
#> 1.0000 3.0000
#> 50.0000 50.0000
#>
#> [============================================================= ] 86 %
#>
#> -----------------------------------------------------
#> MCMC in progress ....
#>
#> Family of the distribution of the outcome variable of the mixture components: gaussian
#>
#> Burn-in: 1
#> Number of MCMC Iterations : 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 Among All Contexts : 9
#> Maximum Number of Clusters Active in the Current Iteration : 6
#>
#> (displaying only clusters with more than 5% of the data)
#> Clusters in Context 1
#> 1.0000 2.0000 3.0000 4.0000
#> 10.0000 45.0000 20.0000 15.0000
#>
#> Clusters in Context 2
#> 1.0000 3.0000
#> 50.0000 50.0000
#>
#> [============================================================== ] 88 %
#>
#> -----------------------------------------------------
#> MCMC in progress ....
#>
#> Family of the distribution of the outcome variable of the mixture components: gaussian
#>
#> Burn-in: 1
#> Number of MCMC Iterations : 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 Among All Contexts : 9
#> Maximum Number of Clusters Active in the Current Iteration : 4
#>
#> (displaying only clusters with more than 5% of the data)
#> Clusters in Context 1
#> 1.0000 2.0000 3.0000 4.0000
#> 10.0000 50.0000 20.0000 20.0000
#>
#> Clusters in Context 2
#> 1.0000 3.0000
#> 50.0000 50.0000
#>
#> [================================================================ ] 90 %
#>
#> -----------------------------------------------------
#> MCMC in progress ....
#>
#> Family of the distribution of the outcome variable of the mixture components: gaussian
#>
#> Burn-in: 1
#> Number of MCMC Iterations : 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 Among All Contexts : 9
#> Maximum Number of Clusters Active in the Current Iteration : 4
#>
#> (displaying only clusters with more than 5% of the data)
#> Clusters in Context 1
#> 1.0000 2.0000 3.0000 4.0000
#> 15.0000 50.0000 20.0000 15.0000
#>
#> Clusters in Context 2
#> 1.0000 3.0000
#> 50.0000 45.0000
#>
#> [================================================================= ] 92 %
#>
#> -----------------------------------------------------
#> MCMC in progress ....
#>
#> Family of the distribution of the outcome variable of the mixture components: gaussian
#>
#> Burn-in: 1
#> Number of MCMC Iterations : 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 Among All Contexts : 9
#> Maximum Number of Clusters Active in the Current Iteration : 4
#>
#> (displaying only clusters with more than 5% of the data)
#> Clusters in Context 1
#> 1.0000 2.0000 3.0000 4.0000
#> 10.0000 50.0000 20.0000 20.0000
#>
#> Clusters in Context 2
#> 1.0000 3.0000
#> 50.0000 50.0000
#>
#> [================================================================== ] 94 %
#>
#> -----------------------------------------------------
#> MCMC in progress ....
#>
#> Family of the distribution of the outcome variable of the mixture components: gaussian
#>
#> Burn-in: 1
#> Number of MCMC Iterations : 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 Among All Contexts : 9
#> Maximum Number of Clusters Active in the Current Iteration : 4
#>
#> (displaying only clusters with more than 5% of the data)
#> Clusters in Context 1
#> 1.0000 2.0000 3.0000 4.0000
#> 15.0000 50.0000 25.0000 10.0000
#>
#> Clusters in Context 2
#> 1.0000 3.0000
#> 45.0000 50.0000
#>
#> [==================================================================== ] 96 %
#>
#> -----------------------------------------------------
#> MCMC in progress ....
#>
#> Family of the distribution of the outcome variable of the mixture components: gaussian
#>
#> Burn-in: 1
#> Number of MCMC Iterations : 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 Among All Contexts : 9
#> Maximum Number of Clusters Active in the Current Iteration : 4
#>
#> (displaying only clusters with more than 5% of the data)
#> Clusters in Context 1
#> 1.0000 2.0000 3.0000
#> 25.0000 50.0000 20.0000
#>
#> Clusters in Context 2
#> 1.0000 3.0000
#> 50.0000 50.0000
#>
#> [===================================================================== ] 98 %
#>
#> -----------------------------------------------------
#> MCMC in progress ....
#>
#> Family of the distribution of the outcome variable of the mixture components: gaussian
#>
#> Burn-in: 1
#> Number of MCMC Iterations : 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 Among All Contexts : 9
#> Maximum Number of Clusters Active in the Current Iteration : 4
#>
#> (displaying only clusters with more than 5% of the data)
#> Clusters in Context 1
#> 1.0000 2.0000 3.0000
#> 20.0000 50.0000 25.0000
#>
#> Clusters in Context 2
#> 1.0000 3.0000
#> 50.0000 50.0000
#>
#> [=======================================================================] 100 %
#>
#> -----------------------------------------------------
#> MCMC in progress ....
#>
#> Family of the distribution of the outcome variable of the mixture components: gaussian
#>
#> Burn-in: 1
#> Number of MCMC Iterations : 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 Among All Contexts : 9
#> Maximum Number of Clusters Active in the Current Iteration : 4
#>
#> (displaying only clusters with more than 5% of the data)
#> Clusters in Context 1
#> 1.0000 2.0000 3.0000
#> 25.0000 50.0000 20.0000
#>
#> Clusters in Context 2
#> 1.0000 3.0000
#> 45.0000 50.0000
#>
#> [=======================================================================] 100 %
plot_pexp_beta(samples)
#>
#>
#> Generating plots ...
#>
plot_pexp_beta(samples, X='x1', ncol.w=2, nrow.w=1)
#>
#>
#> Generating plots ...
#>
plot_pexp_beta(samples, X='x1', ncol.beta=2)
#>
#>
#> Generating plots ...
#>
plot_pexp_beta(samples, pred.pexp.beta=TRUE, W="w", X=c("x1", "x2"))
#>
#>
#> Generating plots ...
#>
plot_pexp_beta(samples, W='w', smooth.line=TRUE, pred.pexp.beta=TRUE, ncol.beta=2)
#>
#>
#> Generating plots ...
#>
#> `geom_smooth()` using formula = 'y ~ x'
#> `geom_smooth()` using formula = 'y ~ x'