outlierTest {ResearchMethods}R Documentation

Effects of removing outliers on regression fits

Description

Using the identify function in R, this function demonstrates the effects that outliers can have on regression by allowing them to be removed in real time.

Usage

  outlierTest(y,x,output=FALSE)

Arguments

y The response variable for the linear regression
x The predictor variable for the linear regression
output a boolean deciding whether to print a summary of each new model to the R terminal

Details

This function takes the input vectors y and x and performs a simple linear regression using the code lm(y~x). Then, using the locator() function it allows the user to point and click on the plot to add or remove modifiers from the dataset. Data points in the model will be colored blue, points excluded will be colored green, and new points will be colored red.

Note

The function breaks down once the dataset is reduced to one point.

Author(s)

Mohamed Abdolell <mohamed.abdolell@dal.ca and Sam Stewart <samstewart11@gmail.com>

References

This plot was designed for a course by Mohamed Abdolell

See Also

identify

Examples

## Not run: 
 
  data(MFSV)
  outlierTest(MFSV[,1],MFSV[,2])                # simplest test
  outlierTest(MFSV[,2],MFSV[,2],output=TRUE)    # see the details of each successive model
## End(Not run)

[Package ResearchMethods version 1.01 Index]