if(require("robustbase")) {
# Examples from Rousseeuw etal (2004)
data(pulpfiber, package="robustbase")
# Figure 1
distancePlot(pulpfiber[, 1:4], pulpfiber[, 5:8])
# Figure 3
pulp.mod <- lm(cbind(Y1, Y2, Y3, Y4) ~ X1 + X2 + X3 + X4, data = pulpfiber)
distancePlot(pulp.mod, method = "mcd")
}
# NLSY data
data(NLSY, package = "heplots")
NLSY.mlm <- lm(cbind(math, read) ~ income + educ + antisoc + hyperact,
data = NLSY)
distancePlot(NLSY.mlm)
# gives the same result
distancePlot(NLSY[, 3:6], residuals(NLSY.mlm), level = 0.975)
distancePlot(NLSY.mlm, method ="mve")
# distancePlot(cbind(math, read) ~ income + educ + antisoc + hyperact,
# data = NLSY)
# schooldata dataset
data(schooldata)
school.mod <- lm(cbind(reading, mathematics, selfesteem) ~ ., data=schooldata)
distancePlot(school.mod)
data(Hernior)
Hern.mod <- lm(cbind(leave, nurse, los) ~
age + sex + pstat + build + cardiac + resp, data=Hernior)
distancePlot(Hern.mod)
Run the code above in your browser using DataLab