specs_coef_plot: Draw a coefficient plot.

View source: R/specs_plots.R

specs_coef_plotR Documentation

Draw a coefficient plot.

Description

specs_coef_plot produces the coefficient plot in a specification plot or standalone.

Usage

specs_coef_plot(
  coef_grid,
  palette = "green",
  coef_ylabel = "Coefficient estimate",
  coef_ylim = NULL,
  coef_xlabel = NULL,
  label_text_size = NULL,
  point_size = NULL,
  error_alpha = NULL,
  error_geom = NULL,
  error_width = 0,
  hline = NULL,
  pcolors = NULL,
  standalone = FALSE,
  ...
)

Arguments

coef_grid

A dataframe with the following components: index (if part of a specification plot) or coef_name (if standalone), coef, error_low, error_high, p for p-value categories (character with values, default should be "p<0.01", "p<0.05", "p<0.10", p>0.10") or pval for the raw numeric p-values.

palette

Change the palette. Default to "green" for green-shaded plot. Change to "brown" for brown-shaded plot.

coef_ylabel

A string specifying the y-axis label on the coefficient panel. Default to "Coefficient estimate".

coef_ylim

A numeric vector of length two indicating the minimum and maximum values of the y-axis in the coefficient plot. Default to NULL to use ggplot2 default.

coef_xlabel

A string specifying the x-axis label on the coefficient panel. Default to NULL for none.

label_text_size

A numeric scalar indicating how large the text for the axis labels should be. Default to NULL for ttr::theme_tt() default.

point_size

A numeric scalar indicating the size of the coefficient estimate points. Default to NULL and set according to the number of specs.

error_alpha

A numeric scalar indicating the alpha of the error geom. Default to NULL and set to 0.5 for "errorbar" and 0.21 for "ribbon".

error_geom

A string indicating the type of geom that should be used to depict confidence intervals on coefficient estimates. Currently supported are "ribbon", "errorbar", and "none". Default to NULL and set to "errorbar"if fewer than 100 specs and to"ribbon"' otherwise.

error_width

A numeric scalar indicating the width of the error bar. Default to 0 and only applicable when error_geom is set to "errorbar".

hline

A numeric scalar indicating a horizontal line at value hline. Default to NULL for none.

pcolors

A named vector of colors for points by p value (defaults are "p<0.01", "p<0.05", "p<0.10", "p>0.10"). Default to NULL for default colors based on ttr::ttcolors.

standalone

A boolean to indicate whether this is a standalone plot or part of a specification plot with a control grid panel. Default to FALSE.

...

Other arguments passed to ttr::theme_tt()

Value

A ggplot2 object depicting the coefficient plot


ttecon/ttr documentation built on March 6, 2023, 7:36 a.m.