Learn R Programming

alr3 (version 1.1.12)

plot.bctrans: Plot and summary helpers for bctrans objects

Description

Extract, view, and plot useful summaries of a bctrans object for transformations to normality.

Usage

## S3 method for class 'bctrans':
plot(x,y=x$Y, lambda=coef(x),family=x$family,plot=pairs,...)

## S3 method for class 'bctrans':
summary(object, digits=4, ...)

## S3 method for class 'bctrans':
coef(object,...)

## S3 method for class 'bctrans':
vcov(object,...)

Arguments

x
An object created by bctrans.
y
If not NULL, add this variable to the scatterplot matrix
object
An object created by bctrans.
lambda
A vector of transformation parameters.
family
A family of transformations, probably "box.cox" or "yeo.johnson"
plot
Name of the plotting function to view the results, usually pairs or similar.
digits
Accuracy of summary output for bctrans objects.
...
Arguments passed to the plotting method.

Value

  • The plot method is used for its side effect of producing a scatterplot matrix. The helper summary summarizes a bctrans object. This helper calls lrt.bctrans, but the latter can be called directly. The helpers coef and vcov return, respectively, the estimated value of lambda, and an estimate of its covariance matrix (based on a profile log-likelihood).

References

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

See Also

bctrans, lrt.bctrans, pairs,inv.res.plot

Examples

Run this code
data(highway)
b <- highway[,c(8,1,2,10,5)] # select interesting columns
summary(ans <- bctrans(b,family="yeo.johnson")) # zeros ==> use yeo.johnson
b$Sigs <- (round(b$Sigs*b$Len)+1)/b$Len # redefine so no zeroes
summary(ans <- bctrans(b)) # fit with box.cox
b$Sigs <- (round(b$Sigs*b$Len)+1)/b$Len # redefine so no zeroes
summary(ans <- bctrans(b)) # fit with box.cox
lrt.bctrans(ans,lrt=list(c(0,-1,1,0)))
plot(ans,family="power") # plot, but use ordinary powers
b <- cbind(b,powtran(ans)) # add transformed variables to data frame

Run the code above in your browser using DataLab