extrapolation_check {regclass} | R Documentation |
A crude check for extrapolation
Description
This function computes the Mahalanobis distance of points as a check for potential extrapolation.
Usage
extrapolation_check(M,newdata)
Arguments
M |
A fitted model that uses only quantitative variables |
newdata |
Data frame (that has the exact same columns as predictors used to fit the model |
Details
This function computes the shape of the predictor data cloud and calculates the distances of points from the center (with respect to the shape of the data cloud). Extrapolation occurs at a combination of predictors that is far from combinations used to build the model. An observation with a large Mahalanobis distance MAY be far from the observations used to build the model and thus MAY require extrapolation.
Note: analysis assumes the predictor data cloud is roughly elliptical (this may not be a good assumptions).
The function reports the percentiles of the Mahalanobis distances of the points in newdata
. Percentiles are the fraction of observations used in model that are CLOSER to
the center than the point(s) in question. Large values of these percentages indicate a greater risk for extrapolation. If Percentile
is about 99
you may be extrapolating.
The method is sensitive to outliers clusters of outliers and gives only a crude idea of the potential for extrapolation.
Author(s)
Adam Petrie
References
Introduction to Regression and Modeling
See Also
Examples
data(SALARY)
M <- lm(Salary~Education*Experience+Months,data=SALARY)
newdata <- data.frame(Education=c(0,5,10),Experience=c(15,15,15),Months=c(0,0,0))
extrapolation_check(M,newdata)
#Individuals 1 and 3 are rather unusual (though not terribly) while individual 2 is typical.