Displaying 1 result from an estimated 1 matches for "plotresiv".
2012 Nov 04
1
Apply same linear model to subset of dataframe
...)
# Plot residuals against fitted values for each model
plot(lm.mpg$fitted,lm.mpg$residuals, main = "lm.mpg")
plot(lm.drat$fitted,lm.drat$residuals, main = "lm.drat")
plot(lm.gear$fitted,lm.gear$residuals, main = "lm.gear")
# Plot residuals against IVs for each model
plotResIV <- function (IV,lmResiduals)
{
lapply(IV, function (x) plot(x,lmResiduals))
}
plotResIV(lm.mpg$model[,-1],lm.mpg$residuals)
plotResIV(lm.drat$model[,-1],lm.drat$residuals)
plotResIV(lm.gear$model[,-1],lm.gear$residuals)
Many thanks
Ross Ahmed
[[alternative HTML version deleted]]