plot.confint: Plot diagnostics for a confint object

View source: R/plot_summary_print.R

plot.confintR Documentation

Plot diagnostics for a confint object

Description

plot method for class "confint". Plots the (profile) loglikelihood for a parameter using the values calculated by conf_intervals. Up to 4 different types of loglikelihood (see the argument type to the function returned by adjust_loglik) may be superimposed on the same plot. By default (add_lines = TRUE) the confidence limits calculated in conf_intervals are indicated on the plot .

Usage

## S3 method for class 'confint'
plot(
  x,
  y = NULL,
  y2 = NULL,
  y3 = NULL,
  which_par = x$which_pars[1],
  conf = x$conf,
  add_lines = TRUE,
  legend = any(c(!is.null(y), !is.null(y2), !is.null(y3))),
  legend_pos = "topleft",
  ...
)

Arguments

x, y, y2, y3

objects of class "confint", results of calls to conf_intervals for a common model. A (profile) loglikelihood will be plotted for each object.

which_par

A scalar specifying the parameter for which the plot is produced. Can be either a numeric scalar, specifying index of the component of the full parameter vector, or a character scalar parameter name. The former must be in x$which_pars, the latter must be in names(x$which_pars).

conf

A numeric vector of values in (0, 100). If add_lines = TRUE then a horizontal line is added for each value in conf. If conf is not supplied then the value stored in x$conf is used.

add_lines

A logical scalar. Whether or not to add horizontal lines to the plot to identify the confidence limits. If there is only one input "confint" object then the values of the confidence limits will be added to the horizontal axis.

legend

A logical scalar or a character vector. If this is supplied then a legend is added to the plot. If legend is a character vector then it is used as the argument legend to legend. Otherwise, i.e. if legend = TRUE then the component type of the input object(s) x, y, y2, y3 are used.

legend_pos

The position of the legend (if required) specified using the argument x in legend.

...

Additional arguments passed to matplot or legend. The arguments col, lty and lwd will be used (in a consistent way) by both matplot and legend.

Value

Nothing is returned.

Examples

See the examples in conf_intervals.

See Also

adjust_loglik to adjust a user-supplied loglikelihood function.

conf_intervals for confidence intervals for individual parameters.

conf_region and plot.confreg to plot a confidence region for a pair of parameters.


chandwich documentation built on Aug. 26, 2023, 1:07 a.m.