Learn R Programming

alr3 (version 1.1.12)

inv.res.plot: Inverse response plots to transform the response

Description

For a lm object, draws an inverse.response plot with the response $Y$ on the vertical axis and the fitted values $\hat{Y}$ on the horizontal axis. Uses nls to estimate $\lambda$ in the function $\hat{Y}=b_0+b_1Y^{\lambda}$. Adds the fitted curve to the plot. inv.res.plot is an alias for inverse.response.plot.

Usage

inverse.response.plot(m, lambda=c(0,1),maxiter=100,xlab=NULL,...)

Arguments

m
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 least squares estimate of lambda
xlab
The horizontal axis label. If NULL, it is constructed by the function.
maxiter
Passed to nls, the maximum number of iterations to be used to compute the optimal value of lambda
...
Other arguments passed to inv.tran.plot 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 $\hat{Y}$ on $Y^{\lambda}$, interpreting $\lambda$ = 0 to be natural logarithms. Numeric output is a list with elements
  • lambdaEstimate of transformation parameter for the response
  • seStandard error of the estimate
  • RSSThe residual sum of squares at the minimum

References

S. Weisberg (2005), Applied Linear Regression, third edition, Wiley, Chapter 7

See Also

inv.tran.plot and inv.tran.estimate, for which this is just a convenient front-end, and nls.

Examples

Run this code
data(highway)
highway$Sigs1 <- (round(highway$Sigs*highway$Len)+1)/highway$Len
attach(highway)
d <- data.frame(Rate=Rate,logLen=logb(Len,2),
                logADT=logb(ADT,2),logTrks=logb(Trks,2),
                Slim=Slim,Shld=Shld,logSigs1=logb(Sigs1,2))
attach(d)
m2 <- lm(Rate~logLen+logADT+logTrks+Slim+Shld+logSigs1,d)
inv.res.plot(m2,key=c(6,2))

Run the code above in your browser using DataLab