Question

SOLVE USING R STUDIO

In a study of memory enhancement, 50 lab rats were randomly assigned to one of the following five treatments: ginkgo, phos-phatidylserine (PS), phosphatidylcholine (PC), vinpocetine, and control. They were fed an appropriate dose of these supplements for 6 weeks, then run in a series of maze tests to evaluate memory. The performance score on the maze (higher score = better performance) is given below. Assume technical assumptions of ANOVA have been met.

i. Is there evidence for an effect of these drugs on memory?
ii. Design a set of orthogonal contrasts and test the following sub-hypotheses. Provide test statistic, p-value, and df corresponding with these tests altogether in a unified ANOVA table.

a. Do the drugs, generally as a group, affect memory compared to the control group?

b. Do the plant-based drugs, ginkgo and vinpocetine, differ from the two synthetic drugs (PS and PC)?

c. Do PS and PC differ from one another?

d. Do ginkgo and vinpocetine differ from one another?

Ginkgo PS PC Vinpocetine Control 30.3 29.760.6 55.4 34.5 33.5 66.7 28.751.3 61.8 35.1 49.7 51.1 29.844.7 47.6 39.163.249.4 31

0 0
Add a comment Improve this question Transcribed image text
Answer #1

d=scan("clipboard")
d=matrix(d,ncol=5,byrow=TRUE)

Ginkgo=d[,1]
PS=d[,2]
PC=d[,3]
Vinopocetine=d[,4]
Control=d[,5]

Ginkgo=c(30.3,29.7,34.5,28.7,35.1,29.8,39.1,31.4,33.5,26.9)
PS=c(63.0,60.6,33.5,51.3,49.7,44.7,63.2,47.0,37.0,51.3)
PC=c(39.2,55.4,66.7,61.8,51.1,47.6,49.4,56.6,60.8,37.2)
Vinopocetine=c(35.8,31.3,42.6,40.7,20.1,23.8,26.8,17.1,39.6,28.9)
Control=c(21.0,21.2,21.4,28.5,17.6,23.7,15.4,19.0,15.4,22.6)
scores=c(Ginkgo,PS,PC,Vinopocetine,Control)
dru=rep(1:5,each=10)
dru
[1] 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5
drugs=factor(dru)
drugs

[1] 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5
Levels: 1 2 3 4 5
ANOVA=aov(scores~drugs)
ANOVA
Call:
aov(formula = scores ~ drugs)
Terms:
drugs Residuals
Sum of Squares 7506.807 2738.054
Deg. of Freedom 4 45
Residual standard error: 7.800362
Estimated effects may be unbalanced

s=summary(ANOVA)
s
Df Sum Sq Mean Sq F value Pr(>F)
drugs 4 7507 1876.7 30.84 2.23e-12 ***
Residuals 45 2738 60.8   
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

##H0: drugs do not have effect on memory
##From summary, p-value=2.23e-12=0, we Reject H0.
##YES, there is effect of these drugs on memory.

##A set of orthogonal contrasts and test the following sub-hypotheses.
##Assigning coefficients:
#If two groups of equal size are to be compared, assign coefficients of +1 to the members of one group and -1 to those of the other group. It does not matter which group is assigned the positive coefficient.
#In comparing groups containing different numbers of treatments, assign to the first group, coefficients equal to the number of treatments in the second group, and to the second group, coefficients of the opposite sign equal to the number of treatments in the first group.
#sum of coefficients of contrast equals to zero i.e. sum (aj)=0.

Samplemeans=c(mean(Ginkgo),mean(PS),mean(PC),mean(Vinopocetine),mean(Control))
Samplemeans
#[1] 31.90 50.13 52.58 30.67 20.58

##Consider vector of length 5: Ginkgo=value-1, PS=value-2, PC=value-3, Vinopocetine=value-4, Control=value-5

##Sub-Hypotheis:
#a. Do the drugs, generally as a group, affect memory compared to the control group?
aj=c(1,1,1,1,-4)
sum(aj) #[1]0

#b. Do the plant-based drugs, ginkgo and vinopocetine, differ from the two synthetic drugs (PS and PC)?
bj=c(1,-1,-1,1,0)
sum(bj) #[1]0

#c. Do PS and PC differ from one another?
cj=c(0,1,-1,0,0)
sum(cj) #[1]0

#d. Do ginkgo and vinopocetine differ from one another?
dj=c(1,0,0,-1,0)
sum(dj) #[1]0

##Sub-Hypotheis:
#H0a/ H01: the drugs, generally as a group, do not affect memory compared to the control group
#H0b/ H02: the plant-based drugs, ginkgo and vinopocetine, do not differ from the two synthetic drugs (PS and PC)
#H0c/ H03: PS and PC do not differ from one another
#H0d/ H04: ginkgo and vinopocetine do not differ from one another

##Two contrasts aj and bj are orthogonal if sum(aj*bj)=0.
sum(aj*bj)  
sum(aj*cj)  
sum(aj*dj)  
sum(bj*cj)  
sum(bj*dj)  
sum(cj*dj)  
#All summations equal to zero. Therefore, all contrasts are orthogonal to each other.

RESULT:

SS_{contrast}=\frac {n(\sum c_{j}{\bar {X}}_{j})^{2}}{\sum c_{j}^{2}} \\\\where,cj=coefficients\, of\, contrast......with\, 1 \,degree\, of \,freedom,\\\, n\,(Here,n=10)\, represents\, the\, number \,of \,observations\, per \,group.\,\\ If\, the\, contrasts \,are\, orthogonal,\, the \,sum \,of \,the\, SScontrasts = SStreatment.

##SSContrast= n*((sum(cj*Xjbar))^2)/sum(cj^2)

n=10
SSaj=n*(sum(aj*Samplemeans)^2)/sum(aj^2)   
SSaj
#[1] 3441.181

SSbj=n*(sum(bj*Samplemeans)^2)/sum(bj^2)   
SSbj
#[1] 4028.049

SScj=n*(sum(cj*Samplemeans)^2)/sum(cj^2)
SScj
#[1] 30.0125

SSdj=n*(sum(dj*Samplemeans)^2)/sum(dj^2)
SSdj
#[1] 7.5645

SSRes=2738.054 #From ANOVA Table
MSaj=SSaj/1 #[1] 3441.181
MSaj
MSbj=SSbj/1 #[1] 4028.049
MSbj
MScj=SScj/1 #[1] 30.0125
MScj
MSdj=SSdj/1 #[1] 7.5645
MSdj
MSRes=SSRes/45 #df of residuals=45
MSRes
#[1] 60.84564

Ftab=qf(0.95,1,45) ##Since, alpha=5%=0.05
Ftab
#[1] 4.056612

Faj=MSaj/MSRes   
Faj ##[1] 56.55591
Fbj=MSbj/MSRes   
Fbj ##[1] 66.20111
Fcj=MScj/MSRes   
Fcj ##[1] 0.4932563
Fdj=MSdj/MSRes
Fdj ##[1] 0.1243228
##Calculated values of F-statistic (Faj,Fbj) are greater than tabulated F-value=4.056612, we Reject sub-null-hypothesis 1 & 2 i.e. H01 & H02..
##Calculated values of F-statistic (Fcj,Fdj) are less than tabulated F-value=4.056612,we do not Reject H03 & H04.
## Contrasts 1 & 2 are significant. Contrasts 3 & 4 are not significant.

##Difference in pairs is also tested as:
TukeyHSD(ANOVA,'drugs')
Tukey multiple comparisons of means
95% family-wise confidence level
Fit: aov(formula = scores ~ drugs)
$drugs
diff lwr upr p adj
2-1 18.23 8.317807 28.1421932 0.0000412
3-1 20.68 10.767807 30.5921932 0.0000039
4-1 -1.23 -11.142193 8.6821932 0.9965651
5-1 -11.32 -21.232193 -1.4078068 0.0179478
3-2 2.45 -7.462193 12.3621932 0.9549078
4-2 -19.46 -29.372193 -9.5478068 0.0000126
5-2 -29.55 -39.462193 -19.6378068 0.0000000
4-3 -21.91 -31.822193 -11.9978068 0.0000012
5-3 -32.00 -41.912193 -22.0878068 0.0000000
5-4 -10.09 -20.002193 -0.1778068 0.0441940

##Clearly pairs (4-1, 3-2)have p-values (0.9965651 ,0.9549078)respectively; which are greater than alpha=0.05. We do not Reject H0.

##Conclusions of Sub-Hypotheis:
#a. YES, the drugs, generally as a group, do affect memory compared to the control group.
#b. YES, the plant-based drugs, ginkgo and vinopocetine, do differ from the two synthetic drugs (PS and PC).
#c. NO, PS and PC do not differ from one another.
#d. NO, ginkgo and vinopocetine do not differ from one another.

Add a comment
Know the answer?
Add Answer to:
SOLVE USING R STUDIO In a study of memory enhancement, 50 lab rats were randomly assigned to one ...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT