Description Usage Format Source Examples
These data were collected on 18 women and 14 men to investigate a certain theory on why women exhibit a lower tolerance for alcohol and develop alcohol–related liver disease more readily than men.
1 |
A data frame with 32 observations on the following 5 variables.
subject number in the study
first–pass metabolism of alcohol in the stomach (in mmol/liter-hour)
gastric alcohol dehydrogenase activity in the stomach (in mumol/min/g of tissue)
sex of the subject
whether the subject is alcoholic or not
Ramsey, F.L. and Schafer, D.W. (2013). The Statistical Sleuth: A Course in Methods of Data Analysis (3rd ed), Cengage Learning.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | str(case1101)
attach(case1101)
## EXPLORATION
library(lattice)
xyplot(Metabol~Gastric|Sex*Alcohol, case1101)
myPch <- ifelse(Sex=="Female",24,21)
myBg <- ifelse(Alcohol=="Alcoholic","gray","white")
plot(Metabol~Gastric, pch=myPch,bg=myBg,cex=1.5)
legend(1,12, pch=c(24,24,21,21), pt.cex=c(1.5,1.5,1.5,1.5),
pt.bg=c("white","gray", "white", "gray"),
c("Non-alcoholic Females", "Alcoholic Females",
"Non-alcoholic Males", "Alcoholic Males"))
identify(Metabol ~ Gastric)
# Left click on outliers to show case number; Esc when finished.
myLm1 <- lm(Metabol ~ Gastric + Sex + Gastric:Sex)
plot(myLm1, which=1)
plot(myLm1, which=4) # Show Cook's Distance; note cases 31 and 32.
plot(myLm1, which=5) # Note leverage and studentized residual for cases 31 and 32.
subject <- 1:32 # Create ID number from 1 to 32
# Refit model without cases 31 and 32:
myLm2 <- update(myLm1, ~ ., subset = (subject !=31 & subject !=32))
plot(myLm2,which=1)
plot(myLm2,which=4)
plot(myLm2,which=5)
summary(myLm1)
summary(myLm2) # Significance of interaction terms hinges on cases 31 and 32.
myLm3 <- update(myLm2, ~ . - Gastric:Sex) #Drop interaction (without 31,32).
summary(myLm3)
if(require(car)){ # Use the car library
crPlots(myLm3) # Show partial residual (component + residual) plots.
}
## INFERENCE AND INTERPRETATION
summary(myLm3)
confint(myLm3,2:3)
## DISPLAY FOR PRESENTATION
myCol <- ifelse(Sex=="Male","blue","red")
plot(Metabol ~ Gastric,
xlab=expression("Gastric Alcohol Dehydrogenase Activity in Stomach ("*mu*"mol/min/g of Tissue)"),
ylab="First-pass Metabolism in the Stomach (mmol/liter-hour)",
main="First-Pass Alcohol Metabolism and Enzyme Activity for 18 Females and 14 Males",
pch=myPch, bg=myBg,cex=1.75, col=myCol, lwd=1)
legend(0.8,12.2, c("Females", "Males"), lty=c(1,2),
pch=c(24,21), pt.cex=c(1.75,1.75), col=c("red", "blue"))
dummyGastric <- seq(min(Gastric),3,length=100)
beta <- myLm3$coef
curveF <- beta[1] + beta[2]*dummyGastric
curveM <- beta[1] + beta[2]*dummyGastric + beta[3]
lines(curveF ~ dummyGastric, col="red")
lines(curveM ~ dummyGastric, col="blue",lty=2)
text(.8,10,"gray indicates alcoholic",cex = .8, adj=0)
detach(case1101)
|
'data.frame': 32 obs. of 5 variables:
$ Subject: int 1 2 3 4 5 6 7 8 9 10 ...
$ Metabol: num 0.6 0.6 1.5 0.4 0.1 0.2 0.3 0.3 0.4 1 ...
$ Gastric: num 1 1.6 1.5 2.2 1.1 1.2 0.9 0.8 1.5 0.9 ...
$ Sex : Factor w/ 2 levels "Female","Male": 1 1 1 1 1 1 1 1 1 1 ...
$ Alcohol: Factor w/ 2 levels "Alcoholic","Non-alcoholic": 1 1 1 2 2 2 2 2 2 2 ...
integer(0)
Call:
lm(formula = Metabol ~ Gastric + Sex + Gastric:Sex)
Residuals:
Min 1Q Median 3Q Max
-2.4427 -0.6111 -0.0326 0.5436 3.8759
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -0.1973 0.8022 -0.246 0.8075
Gastric 0.8369 0.4839 1.730 0.0947 .
SexMale -0.9885 1.0724 -0.922 0.3645
Gastric:SexMale 1.5069 0.5591 2.695 0.0118 *
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 1.207 on 28 degrees of freedom
Multiple R-squared: 0.8137, Adjusted R-squared: 0.7938
F-statistic: 40.77 on 3 and 28 DF, p-value: 2.386e-10
Call:
lm(formula = Metabol ~ Gastric + Sex + Gastric:Sex, subset = (subject !=
31 & subject != 32))
Residuals:
Min 1Q Median 3Q Max
-1.59619 -0.60249 -0.04076 0.47590 1.64726
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -0.1973 0.5860 -0.337 0.7391
Gastric 0.8369 0.3535 2.368 0.0256 *
SexMale 0.2668 0.9932 0.269 0.7904
Gastric:SexMale 0.7285 0.5394 1.351 0.1885
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.8819 on 26 degrees of freedom
Multiple R-squared: 0.6729, Adjusted R-squared: 0.6352
F-statistic: 17.83 on 3 and 26 DF, p-value: 1.711e-06
Call:
lm(formula = Metabol ~ Gastric + Sex, subset = (subject != 31 &
subject != 32))
Residuals:
Min 1Q Median 3Q Max
-1.81012 -0.49381 -0.05505 0.52307 2.03515
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -0.6823 0.4701 -1.451 0.158244
Gastric 1.1498 0.2710 4.242 0.000232 ***
SexMale 1.5276 0.3445 4.434 0.000139 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.8953 on 27 degrees of freedom
Multiple R-squared: 0.65, Adjusted R-squared: 0.6241
F-statistic: 25.07 on 2 and 27 DF, p-value: 7e-07
Loading required package: car
Loading required package: carData
Call:
lm(formula = Metabol ~ Gastric + Sex, subset = (subject != 31 &
subject != 32))
Residuals:
Min 1Q Median 3Q Max
-1.81012 -0.49381 -0.05505 0.52307 2.03515
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -0.6823 0.4701 -1.451 0.158244
Gastric 1.1498 0.2710 4.242 0.000232 ***
SexMale 1.5276 0.3445 4.434 0.000139 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.8953 on 27 degrees of freedom
Multiple R-squared: 0.65, Adjusted R-squared: 0.6241
F-statistic: 25.07 on 2 and 27 DF, p-value: 7e-07
2.5 % 97.5 %
Gastric 0.5937204 1.705959
SexMale 0.8206476 2.234454
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.