Generic function to plot the posterior density estimation produced by the function hdpGLM
# S3 method for hdpGLM
plot(
x,
terms = NULL,
j.label = NULL,
j.idx = NULL,
title = NULL,
subtitle = NULL,
true.beta = NULL,
ncol = NULL,
legend.position = "bottom",
display.terms = TRUE,
context.id = NULL,
ylab = NULL,
xlab = NULL,
x.axis.size = 1.1,
y.axis.size = 1.1,
title.size = 1.2,
panel.title.size = 1.5,
legend.size = 1.1,
rel.height = 0.01,
fill.col = "#00000044",
border.col = "white",
...
)
an object of the class hdpGLM
generted by the function hdpGLM
string vector with the name of the individual-level covariates to plot. If NULL
(default), all covariates are plotted.
string vector with the names of the contexts to plot. An alternative is to use the context indexes with the parameter j.idx
instead of the context labels. If NULL
(default) and j.idx is also NULL
, the posterior distribution of all contexts are plotted. Note: if contexts to plot are selected using j.label
, the parameter context.id
must also be provided.
integer vector with the index of the contexts to plot. An alternative is to use the context labels with the parameter j.label
instead of the indexes. If NULL
(default) and j.label is also NULL
, the posterior distribution of all contexts are plotted
string, the title of the plot
string, the subtitle of the plot
a data.frame
with the true values of the linear coefficients beta
if they are known. The data.frame
must contain a column named j
with the index of the context associated with that particular linear coefficient beta
. It must match the indexes used in the data set for each context. Another column named k
must be provided, 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
. Finally, the data.frame
must contain columns with the context-level covariates as used in the estimation of the hdpGLM function (see Details below).
interger, the number of columns in the plot
one of four options: "bottom" (default), "top", "left", or "right". It indicates the position of the legend
boolean, if TRUE
(default), the covariate name is displayed in the plot
string with the name of the column containing the labels identifying the contexts. This variable should have been specified when the estimation was conducted using the function hdpGLM
.
string, the label of the y-axis
string, the label of the x-axis
numeric, the relative size of the label in the x-axis
numeric, the relative size of the label in the y-axis
numeric, the relative size of the title of the plot
numeric, the relative size of the titles in the panel of the plot
numeric, the relative size of the legend
see ggridges::geom_density_ridges
string with the color of the densities
string with the color of the border of the densities
Additional arguments accepted are:
true.beta
: a data.frame
with the true values of the linear coefficients beta
if they are known. The data.frame
must contain a column named j
with the index of the context associated with that particular linear coefficient beta
. It must match the indexes used in the data set for each context. Another column named k
must be provided, 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
. Finally, the data.frame
must contain columns with the context-level covariates as used in the estimation of the hdpGLM function (see Details below).
true.tau
: a data.frame
with four columns. The first must be named w
and it indicates the index of each context-level covariate, starting with 0 for the intercept term. The second column named beta
must contain the indexes of the betas of individual-level covariates, starting with 0 for the intercept term. The third column named Parameter
must be named tau<w><beta>
, where w
and beta
must be the actual values displayed in the columns w
and beta
. Finally, it must have a column named True
with the true value of the parameter.