plot.hdpGLM: Plot

plot.hdpGLMR Documentation

Plot

Description

Generic function to plot the posterior density estimation produced by the function hdpGLM

Usage

## S3 method for class '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",
  ...
)

Arguments

x

an object of the class hdpGLM generted by the function hdpGLM

terms

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

j.label

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.

j.idx

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

title

string, the title of the plot

subtitle

string, the subtitle of the plot

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).

ncol

interger, the number of columns in the plot

legend.position

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

display.terms

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

context.id

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.

ylab

string, the label of the y-axis

xlab

string, the label of the x-axis

x.axis.size

numeric, the relative size of the label in the x-axis

y.axis.size

numeric, the relative size of the label in the y-axis

title.size

numeric, the relative size of the title of the plot

panel.title.size

numeric, the relative size of the titles in the panel of the plot

legend.size

numeric, the relative size of the legend

rel.height

see ggridges::geom_density_ridges

fill.col

string with the color of the densities

border.col

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.


hdpGLM documentation built on Oct. 13, 2023, 1:17 a.m.