Learn R Programming

heplots (version 1.0-2)

Hernior: Recovery from Elective Herniorrhaphy

Description

A data set on measures of post-operative recovery of 32 patients undergoing an elective herniorrhaphy operation, in relation to pre-operative measures.

Usage

data(Hernior)

Arguments

source

Mosteller, F. and Tukey, J. W. (1977), Data analysis and regression, Reading, MA: Addison-Wesley. Data Exhibit 8, 567-568. Their source: A study by B. McPeek and J. P. Gilbert of the Harvard Anesthesia Center.

Details

leave, nurse and los are outcome measures; the remaining variables are potential predictors of recovery status. The variable nurse is recorded as 1-4, with remaining (20) entries entered as "-" in both sources. It is not clear whether this means "none" or NA. The former interpretation was used in constructing the R data frame, so nurse==5 for these observations. Using Hernior$nurse[Hernior$nurse==5] <- NA would change to the other interpretation, but render nurse useless in a multivariate analysis. The ordinal predictors could instead be treated as factors, and there are also potential interactions to be explored.

References

Hand, D. J., Daly, F., Lunn, A. D., McConway, K. J. and Ostrowski, E. (1994), A Handbook of Small Data Sets, Number 484, 390-391.

Examples

Run this code
str(Hernior)
Hern.mod <- lm(cbind(leave, nurse, los) ~ age + sex +  pstat +  build + cardiac + resp, data=Hernior)
Anova(Hern.mod, test="Roy") # actually, all tests are identical
# test overall regression
linearHypothesis(Hern.mod, c("age", "sexm", "pstat", "build", "cardiac", "resp"))
# joint test of age, sex & caridac
linearHypothesis(Hern.mod, c("age", "sexm", "cardiac"))

clr <- c("red", "darkgray", "blue", "darkgreen", "magenta", "brown", "black")
heplot(Hern.mod, col=clr)
pairs(Hern.mod, col=clr)

## Enhancing the pairs plot ...
# create better variable labels
vlab <- c("LeaveCondition
(leave)", "NursingCare
(nurse)", "LengthOfStay
(los)")
# Add ellipse to test all 5 regressors simultaneously
hyp <- list("Regr" = c("age", "sexm", "pstat", "build", "cardiac", "resp"))
pairs(Hern.mod, hypotheses=hyp, col=clr, var.labels=vlab)

## Views in canonical space for the various predictors
if (require(candisc)) {
	Hern.canL <- candiscList(Hern.mod)
	plot(Hern.canL, term="age")
	plot(Hern.canL, term="sex")
	plot(Hern.canL, term="pstat")  # physical status
}

Run the code above in your browser using DataLab