Learn R Programming

LorenzRegression (version 2.2.0)

autoplot.PLR: Plots for the penalized Lorenz regression

Description

autoplot generates summary plots for an object of class "PLR" and returns them as ggplot objects. The plot method is a wrapper around autoplot that directly displays the plot, providing a more familiar interface for users accustomed to base R plotting.

Usage

# S3 method for PLR
autoplot(
  object,
  type = c("explained", "traceplot", "diagnostic", "residuals"),
  traceplot.which = "BIC",
  pars.idx = "BIC",
  score.df = NULL,
  band.level = 0.95,
  ...
)

# S3 method for PLR plot(x, ...)

Value

autoplot returns a ggplot object representing the desired graph. plot directly displays this plot.

Arguments

object

An object of class "PLR". The object might also have S3 classes "PLR_boot" and/or "PLR_cv" (both inherit from class "PLR")

type

A character string indicating the type of plot. Possible values are "explained", "traceplot" and "diagnostic".

  • If "explained" is selected, the graph displays the Lorenz curve of the response and concentration curve of the response with respect to the estimated index. The grid and penalty parameters used to estimate the index are chosen via the pars.idx argument. If object inherits from "PLR_boot" and LC_store was set to TRUE in Lorenz.boot, pointwise confidence intervals for the concentration curve are added. Their confidence level is set via the argument band.level.

  • If "traceplot" is selected, the graph displays a traceplot, where the horizontal axis is -log(lambda), lambda being the value of the penalty parameter. The vertical axis gives the value of the estimated coefficient attached to each covariate.

  • If "diagnostic" is selected, the graph displays a faceted plot, where each facet corresponds to a different value of the grid parameter. Each plot shows the evolution of the scores of each available selection method. For comparability reasons, the scores are normalized such that the larger the better and the optimum is attained in 1.

  • If "residuals" is selected, the graph displays a scatterplot of residuals with respect to the estimated index. The grid and penalty parameters used for estimation are chosen via the pars.idx argument. Obtaining residuals entail to estimate the link function of the single-index. This is performed via the function Rearrangement.estimation, as explained in predict.LR.

traceplot.which

This argument indicates the value of the grid parameter for which the traceplot should be produced (see arguments grid.value and grid.arg in function Lorenz.Reg). It can be an integer indicating the index in the grid determined via grid.value. Alternatively, it can be a character string indicating the selection method. In this case the index corresponds to the optimal value according to that selection method.

pars.idx

What grid and penalty parameters should be used for parameter selection. Either a character string specifying the selection method, where the possible values are:

  • "BIC" (default) - Always available.

  • "Boot" - Available if object inherits from "PLR_boot".

  • "CV" - Available if object inherits from "PLR_cv".

Or a numeric vector of length 2, where the first element is the index of the grid parameter and the second is the index of the penalty parameter.

score.df

A data.frame providing the scores to be displayed if type is set to "diagnostic". For internal use only.

band.level

Confidence level for the bootstrap confidence intervals.

...

Additional arguments passed either to Lorenz.graphs (for type = "explained") or to fitted.PLR and residuals.PLR (for type = "residuals").

x

An object of class "PLR". The object might also have S3 classes "PLR_boot" and/or "PLR_cv" (both inherit from class "PLR")

Details

The available selection methods depend on the classes of the object: BIC is always available, bootstrap is available if object inherits from "PLR_boot", cross-validation is available if object inherits from "PLR_cv"

See Also

Lorenz.Reg

Examples

Run this code
## For examples see example(Lorenz.Reg), example(Lorenz.boot) and example(PLR.CV)

Run the code above in your browser using DataLab