plot.bh: Graphically Summarizing Bayesian Model Fits

Description Usage Arguments Details Author(s) See Also

View source: R/plot.bh.r

Description

This function is to graphically summarize Bayesian hierarchical model fits by plotting the coefficients (or odds ratios) and the standard deviation (2*sd). It also can show the p-values.

Usage

1
2
3
4
5
plot.bh(object = NULL, coefs, sds = NULL, pvalues = NULL, vars.rm = NULL, 
        threshold = 0.05, show.all.vars = FALSE, show.pvalues = TRUE, gap = 0, 
        main = " ", cex.main = 0.9, xlim = NULL, cex.var = 0.8, cex.pts = 1, 
        pch.pts = 20, type = "p", lwd = 1, lty = 1, line = 0, col.pts = "black", 
        OR = FALSE, add = FALSE) 

Arguments

object

an object from bglm or bpolr or bcoxph. If specified, the function get the estimates of coefficints, sd, and p-values, otherwise (i.e., object = NULL), the coefficints, sd and p-values should be given in the arguments coefs, sds, and pvalues.

coefs, sds, pvalues

vector of coefficints (coefs), vector of standard deviations (or n*2 matrix of interval estimates) (sds) and vector of p-values (pvalues) for variables. The names of variables can be given via coefs. If sds is a vector, interval estimates of coefficients are [coefs - 2*sds, coefs + 2*sds]. If sds is a n*2 matrix, interval estimates of coefficients are [sds[,1], sds[,2]]; this is particularly useful for summarizing MCMC samples.

vars.rm

a vector of variables to be removed; default is NULL, display all the variables (including the intercept).

threshold

a p-value or a positive integer value to determine variables to be shown: variables with p-value < threshold or top threshold coefficients.

show.all.vars

logical. If TRUE,show names of all variables. The default is FALSE.

show.pvalues

logical. If TRUE, show p-values for variables. The default is TRUE. The p-values are shown on the right side of the plot.

gap

a value for the distance between two flanking significant variables.

main, cex.main, xlim, type, lwd, lty, line

These arguments are the same as in plot and par.

cex.var

the fontsize of the varible names, default = 0.8.

cex.pts

the size of points, default = 1.

col.pts

color of points and segments, default is black. It can be a vector with two elements, which will use specified colors for different variables determined by the augument threshold.

pch.pts

symbol of points, default is solid dot.

OR

logical. If TRUE, show odds ratios for variables. The default is FALSE.

add

logical. if TRUE, plot over the existing plot. The default is FALSE.

Details

This function plots the estimates of coefficients, intervals and p-values from a fitted GLMs or Cox model. It uses different colors to distinguish between siginificant and insignificant variables based on a threshold.

Author(s)

Nengjun Yi, nyi@uab.edu

See Also

plot, par


nyiuab/BhGLM documentation built on Jan. 9, 2022, 3:31 p.m.