Description Usage Format Source References Examples
Researchers taught 18 monkeys to distinguish each of 100 pairs of objects, 20 pairs each at 16, 12, 8, 4, and 2 weeks prior to a treatment. After this training, they blocked access to the hippocampal formation in 11 of the monkeys. All monkeys were then tested on their ability to distinguish the objects. The five-dimensional response for each monkey is the number of correct objects distinguished among those taught at 16, 12, 8, 4, and 2 weeks prior to treatment.
1 |
A data frame with 18 observations on the following 7 variables.
Monkey name
a treatment factor with levels "Control"
and
"Treated"
percentage of 20 objects taught 2 weeks prior to treatment that were correctly distinguished in the test
percentage of 20 objects taught 4 weeks prior to treatment that were correctly distinguished in the test
percentage of 20 objects taught 8 weeks prior to treatment that were correctly distinguished in the test
percentage of 20 objects taught 12 weeks prior to treatment that were correctly distinguished in the test
percentage of 20 objects taught 16 weeks prior to treatment that were correctly distinguished in the test
Ramsey, F.L. and Schafer, D.W. (2013). The Statistical Sleuth: A Course in Methods of Data Analysis (3rd ed), Cengage Learning.
Sola-Morgan, S. M. and Squire, L. R. (1990). The Primate Hippocampal Formation: Evidence for a Time-limited Role in Memory Storage, Science 250: 288–290.
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 60 61 62 63 64 65 | str(case1601)
attach(case1601)
## EXPLORATION
short <- (Week2 + Week4)/2
long <- (Week8 + Week12 + Week16)/3
myPointCode <- ifelse(Treatment=="Control",15,16)
myPointColor <- ifelse(Treatment=="Control","orange","green")
plot(long ~ short, pch=myPointCode, col=myPointColor, cex=2)
abline(h=mean(long),lty=2)
abline(v=mean(short),lty=2)
identify(short,long,labels=Monkey) # Identify outliers; press Esc when done
## INFERENCE USING HOTELLING's T-SQUARED TEST
myLm1 <- lm(cbind(short,long) ~ Treatment) # Full model
myLm2 <- lm(cbind(short,long) ~ 1) # Reduced model, with only intercept
anova(myLm2, myLm1, test="Hotelling") # p-value for Treatment effect
# confidence intervals
n1 <- sum(Treatment=="Control") # 7 control monkeys
n2 <- sum(Treatment=="Treated") # 11 treated monkeys
multiplier <- sqrt(2*((n1+n2-2)/(n1+n2-3))*qf(.95,2,n1+n2-3)) # Sleuth p. 492
summary(myLm1)
shortEffect <- myLm1$coef[2,1] # Difference in sample averages; Short
seShortEffect <- 3.352 # Read this from summary(myLm1)
halfWidth <- multiplier*seShortEffect # Half width of 95% confidence interval
shortEffect + c(-1,1)*halfWidth #95% CI for effect of treatment on Short
longEffect <- myLm1$coef[2,2] # Difference in sample averages; Long
seLongEffect <- 3.2215 # Read this from summary(myLm1)
halfWidth <- multiplier*seLongEffect # Half width of 95% confidence interval
longEffect + c(-1,1)*halfWidth #95% CI for effect of treatment on Long
## GRAPHICAL DISPLAY FOR PRESENTATION
myPointCode <- ifelse(Treatment=="Control",21,22)
myPointColor <- ifelse(Treatment=="Control","green","orange")
plot(long ~ jitter(short),
xlab="Short-Term Memory Score (Percent Correct)",
ylab="Long-Term Memory Score (Percent Correct)",
main="Memory Scores for 11 Hippocampus-Blocked and 7 Control Monkeys",
pch=myPointCode, bg=myPointColor, cex=2.5, lwd=3)
identify(short,long,labels=Monkey) # Label the outliers; press Esc when done
legend(52,54,legend=c("Control","Hippocampus Blocked"), pch=c(21,22),
pt.bg=c("green","orange"), pt.cex=c(2.5,2.5), pt.lwd=c(3,3), cex=1.5)
## ADVANCED: RANDOMIZATION TEST FOR EQUALITY OF BIVARIATE RESPONSES
myAnova <- anova(myLm2, myLm1, test="Hotelling") #Hotelling Test for Treatment
myAnova$approx[2] #[1] 12.32109: F-statistic
numRep <- 50 # Number of random regroupings (change to 50,000)
FStats <- rep(0,numRep) # Initialize a variable for storing the F-statistics
myLmReduced <- lm(cbind(short,long) ~ 1)# Fit the reduced model once
for (rep in 1:numRep) { # Do the following commands in parenthese num.rep times
randomGroup <- rep("Group1",18) # Set randomGroup initially to all "Group1"
randomGroup[sample(1:18,7)] <- "Group2" # Change 7 at random to "Group2"
randomGroup <- factor(randomGroup) # Make the character variable a factor
myLmFull <- lm(cbind(short,long) ~ randomGroup) # Fit full model
myAnova2 <- anova(myLmReduced, myLmFull, test="Hotelling") # Hotelling's test
FStats[rep] <- myAnova2$approx[2] # Store the F-statistic
} # If numRep = 50,000, go get a cup of coffee while you wait for this.
hist(FStats, main="Approx. Randomizatin Dist of F-stat if No Treatment Effect")
abline(v=12.32109) # Show actually observed Hotelling F-statistic
pValue <- sum(FStats >= 12.32109)/numRep
pValue # Approximate randomization test p-value (no distributional assumptions)
detach(case1601)
|
'data.frame': 18 obs. of 7 variables:
$ Monkey : chr "Spank" "Chim" "Chak" "Alf" ...
$ Treatment: Factor w/ 2 levels "Control","Treated": 1 1 1 1 1 1 1 2 2 2 ...
$ Week2 : int 95 85 75 85 65 70 75 75 85 60 ...
$ Week4 : int 75 75 95 80 80 90 80 50 85 70 ...
$ Week8 : int 80 55 60 70 75 85 70 70 60 70 ...
$ Week12 : int 65 75 40 45 65 75 70 75 70 75 ...
$ Week16 : int 70 85 45 80 65 75 70 75 70 70 ...
integer(0)
Analysis of Variance Table
Model 1: cbind(short, long) ~ 1
Model 2: cbind(short, long) ~ Treatment
Res.Df Df Gen.var. Hotelling-Lawley approx F num Df den Df Pr(>F)
1 17 70.469
2 16 -1 46.057 1.6428 12.321 2 15 0.0006831 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Response short :
Call:
lm(formula = short ~ Treatment)
Residuals:
Min 1Q Median 3Q Max
-10.6818 -3.1006 -0.6818 1.8182 21.8182
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 80.357 2.620 30.667 1.21e-15 ***
TreatmentTreated -17.175 3.352 -5.124 0.000102 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 6.933 on 16 degrees of freedom
Multiple R-squared: 0.6214, Adjusted R-squared: 0.5977
F-statistic: 26.26 on 1 and 16 DF, p-value: 0.000102
Response long :
Call:
lm(formula = long ~ Treatment)
Residuals:
Min 1Q Median 3Q Max
-19.286 -1.667 1.190 3.869 10.714
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 67.6190 2.5184 26.850 9.79e-15 ***
TreatmentTreated 0.7143 3.2215 0.222 0.827
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 6.663 on 16 degrees of freedom
Multiple R-squared: 0.003063, Adjusted R-squared: -0.05925
F-statistic: 0.04916 on 1 and 16 DF, p-value: 0.8273
[1] -26.570268 -7.780382
[1] -8.314894 9.743465
integer(0)
[1] 12.32109
[1] 0
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.