outlierTest {ResearchMethods} | R Documentation |
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.
outlierTest(y,x,output=FALSE)
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 |
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.
The function breaks down once the dataset is reduced to one point.
Mohamed Abdolell <mohamed.abdolell@dal.ca and Sam Stewart <samstewart11@gmail.com>
This plot was designed for a course by Mohamed Abdolell
## 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)