Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

invResPlot

Inverse Response Plots to Transform the Response


Description

For a lm model, draws an inverse.response plot with the response Y on the vertical axis and the fitted values Yhat on the horizontal axis. Uses nls to estimate lambda in the function Yhat = b0 + b1(Y)^(lambda). Adds the fitted curve to the plot. invResPlot is an alias for inverseResponsePlot.

Usage

inverseResponsePlot(model, lambda=c(-1,0,1), robust=FALSE, xlab=NULL, ...)

## S3 method for class 'lm'
inverseResponsePlot(model, lambda=c(-1, 0, 1), 
    robust=FALSE, xlab=NULL, id=FALSE, ...)

invResPlot(model, ...)

Arguments

model

A "lm" regression object.

lambda

A vector of values for lambda. A plot will be produced with curves corresponding to these lambdas and to the nonlinear least squares estimate of lambda.

robust

If TRUE, then estimation uses Huber M-estimates with the median absolute deviation to estimate scale and k= 1.345. The default is FALSE.

xlab

The horizontal axis label. If NULL, it is constructed by the function.

id

controls point identification; if FALSE (the default), no points are identified; can be a list of named arguments to the showLabels function; TRUE is equivalent to list(method=list(method="x", n=2, cex=1, col=carPalette()[1], location="lr"), which identifies the 2 points with the most extreme horizontal (X) values.

...

Other arguments passed to invTranPlot and then to plot.

Value

As a side effect, a plot is produced with the response on the horizontal axis and fitted values on the vertical axis. Several lines are added to be plot as the ols estimates of the regression of Yhat on Y^(lambda), interpreting lambda = 0 to be natural logarithms.

Numeric output is a list with elements

lambda

Estimate of transformation parameter for the response

RSS

The residual sum of squares at the minimum if robust=FALSE. If robust = TRUE, the value of Huber objective function is returned.

Author(s)

Sanford Weisberg, sandy@umn.edu

References

Fox, J. and Weisberg, S. (2011) An R Companion to Applied Regression, Second Edition, Sage.

Prendergast, L. A., & Sheather, S. J. (2013) On sensitivity of inverse response plot estimation and the benefits of a robust estimation approach. Scandinavian Journal of Statistics, 40(2), 219-237.

Weisberg, S. (2014) Applied Linear Regression, Fourth Edition, Wiley, Chapter 7.

See Also

Examples

m2 <- lm(rate ~ log(len) + log(adt) + slim + shld + log(sigs1), Highway1)
invResPlot(m2)

car

Companion to Applied Regression

v3.0-10
GPL (>= 2)
Authors
John Fox [aut, cre], Sanford Weisberg [aut], Brad Price [aut], Daniel Adler [ctb], Douglas Bates [ctb], Gabriel Baud-Bovy [ctb], Ben Bolker [ctb], Steve Ellison [ctb], David Firth [ctb], Michael Friendly [ctb], Gregor Gorjanc [ctb], Spencer Graves [ctb], Richard Heiberger [ctb], Pavel Krivitsky [ctb], Rafael Laboissiere [ctb], Martin Maechler [ctb], Georges Monette [ctb], Duncan Murdoch [ctb], Henric Nilsson [ctb], Derek Ogle [ctb], Brian Ripley [ctb], William Venables [ctb], Steve Walker [ctb], David Winsemius [ctb], Achim Zeileis [ctb], R-Core [ctb]
Initial release
2020-09-23

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.