trans.chooser {NCStats}R Documentation

A dynamic graphic used to select a response transform for an ANOVA, SLR, or IVR models.

Description

A dynamic graphic used to select a response transform for an ANOVA, SLR, or IVR models. The graphic, specific to the type of model, is dynamically linked to a slider bar that allows the user to choose different values of lambda. This allows the user to select a lambda for meeting the model assumptions.

Usage

trans.chooser(object,...)

## S3 method for class 'lm':
trans.chooser(object,...)

## S3 method for class 'SLR':
trans.chooser(object,starty=0,startx=0,show.stats=FALSE,...)

## S3 method for class 'IVR':
trans.chooser(object,starty=0,startx=0,show.stats=FALSE,...)

## S3 method for class 'ONEWAY':
trans.chooser(object,starty=0,show.stats=FALSE,bp=TRUE,...)

## S3 method for class 'TWOWAY':
trans.chooser(object,starty=0,show.stats=FALSE,bp=TRUE,...)

Arguments

object An lm object or formula depicting an ANOVA or SLR model.
starty A numeric start value for the transformation of the response variable. See details.
startx A numeric start value for the transformation of the explanatory variable. See details.
show.stats Logical; if TRUE (default) then summary statistics are printed on the graphics. See details.
bp A logical indicating if the residual plot should be constructed as a boxplot (TRUE) or as a traditional residual plot (FALSE, default).
... Other arguments to the generic function.

Details

The starty and startx arguments are used to provide a constant value that shifts the variable left or right. The startx is only used if a SLR or IVR model is considered.

If an ANOVA model is sent then a dynamic graphic will appear that includes a histogram of the residuals and a boxplot of the residuals by group. A slider can be used to select a lambda to be applied to the response variable. Values of lambda can be attempted until the histogram looks approximately normal (or symmetric) and the spread of the residuals by group (i.e., height of the boxes) looks approximately equal.

If an SLR model is sent then a dynamic graphic will appear that includes a fitted line plot, a residual plot, and a histogram of the residuals. Two sliders are available for selecting lambdas to be applied to the response and explanatory variables. Values of lambda can be attemped until the fitted line plot and residual plot look approximately linear and homoscedastic and the histogram looks approximately normal (or symmetric).

If an IVR model is sent then the dynamic graphics will be the same as for the SLR model except that a fitted line plot will not appear.

If show.stats=TRUE then the results of the non-constant variance test will be printed above the residual plot (for SLR and IVR), the results of the Levene's test for homogeneity of variance (for one- and two-way ANOVA), and the results of the Anderson-Darling normality test will be printed above the histogram of the residuals. These items are printed in red if the p-value is less than 0.05 and are printed in black otherwise.

Value

None. However, a dynamic graphic is produced.

Note

On first call a dialog box with one or two sliders will appear in the upper-left corner of the R window. A graphic will not be seen until an item in the dialog box is changed. At this time, the dialog box will appear to disappear. However, it has simply been minimized and can be reaccessed as all minimized programs are accessed. This “bug” only appears when the function is started and upon first change of an item in the dialog box.

Author(s)

Derek H. Ogle, dogle@northland.edu

References

idea came from Fox, J. 1997. Applied Regression Analysis, Linear Models, and Related Methods. Sage Publications. Thousand Oaks, CA.

See Also

levene.test and ncv.test in car; ad.test in nortest; and boxcox in MASS.

Examples

## not run with example() because requires interactive graphics

## example with SLR
## Not run:  data(Mirex)
## Not run:  Mirex$year <- factor(Mirex$year)
## Not run:  attach(Mirex)
## Not run:  lma <- lm(mirex~weight)
## Not run:  trans.chooser(lma)

## example with ANOVA
## Not run:  lmb <- lm(mirex~year)
## Not run:  trans.chooser(lmb)
## Not run:  detach(Mirex)

[Package NCStats version 0.0-12 Index]