##10.2.5 a) Ho: The is no difference between exposure to pestiulance by one organism granting resistanc to pesiluance of another organism. Ha: The is a difference between exposure to pestiulance by one organism granting resistanc to pesiluance of another organism. b) Ho: Pr{Success(Wilt)|Mite (Exposure)} = Pr{Success(Wilt)| No mite(no exposure)} c)
prmat<-matrix(c(11/26, 17/21, 15/26, 4/21), ncol =2, byrow = TRUE)
rownames(prmat)<-c("wilt", "no wilt")
colnames(prmat)<-c("mite", "no mites")
prmat<-as.table(prmat);prmat
## mite no mites
## wilt 0.4230769 0.8095238
## no wilt 0.5769231 0.1904762
d-e) X-squared = 5.6885. P value= 0.01708/2 (directional) = 0.854 at the alpha level = 0.01, we would reject the null which states that those groups that were exposed to mites (pestulance) prior to exposure to another pest (Verticillium fungus) were less susceptible to disease (wilt disease).
wilt<-c(11, 17)
no_wilt<-c(15, 4)
test<-data.frame(wilt, no_wilt); test
## wilt no_wilt
## 1 11 15
## 2 17 4
chisq.test(test)
##
## Pearson's Chi-squared test with Yates' continuity correction
##
## data: test
## X-squared = 5.6885, df = 1, p-value = 0.01708
##10.2.7.a i) Ho: Pr{Seizure free(success)|Valproate}=Pr{Siezure free(success)|Phenytoin} Ha: Pr{Seizure free(success)|Valproate}!=Pr{Siezure free(success)|Phenytoin} ii) X-squared = 2.6469e-31, df = 1, p-value = 1 (Is my p-value different than the books due to continuity correction?) iii) Fail to reject the null that these two drugs are any different at reducing seizures over 12 months. b) My conclusion in iii, finds there does not appear to be a significant difference between groups, and to generalize, yes, valproate and phenytoin appear to be equally effective in preventing seizures though there is not control to decide if it is equally better than placebo (though the two drugs would have already gone through that testing to get ont he market).
suc<-c(6,6)
fail<-c(14,11)
test <- data.frame(suc, fail);test
## suc fail
## 1 6 14
## 2 6 11
chisq.test(test)
##
## Pearson's Chi-squared test with Yates' continuity correction
##
## data: test
## X-squared = 2.6469e-31, df = 1, p-value = 1
##10.3.3 a) Pr{D|S}=0.2392 Pr{D|WW}=0.3046 b) Ho:Pr{D|S}=Pr{D|WW} Fail to reject the null, there is no significant difference observed between survival in the surgery versus watchful waiting group
83/347
## [1] 0.2391931
106/348
## [1] 0.3045977
died<-c(83,106)
lived<-c(264, 242)
test<-data.frame(died,lived)
chisq.test(test)
##
## Pearson's Chi-squared test with Yates' continuity correction
##
## data: test
## X-squared = 3.431, df = 1, p-value = 0.06399
##10.9.1.a i) relative risk= 1.3392 ii) odds ratio= 1.356
pr1<-25/(492+25)
pr2<-23/(614+23)
rr<-pr1/pr2;rr
## [1] 1.339248
oddsratio<-(pr1/(1-pr1))/(pr2/(1-pr2));oddsratio
## [1] 1.356486
##10.9.1.b i) relative risk=1.314 ii) odds ratio=1.355
pr1<-12/(93+12)
pr2<-8/(84+8)
rr<-pr1/pr2;rr
## [1] 1.314286
oddsratio<-(pr1/(1-pr1))/(pr2/(1-pr2));oddsratio
## [1] 1.354839
10.9.3 Relative risk of hip dysplasia in golden retrievers compared to border collies is: 2.013
prgr<-3995/(3995+42946)
prbc<-221/(221+5007)
rr<-prgr/prbc;rr
## [1] 2.013297
10.9.4 a) Odds Ratio of hip dysplasia in golden retrievers compared to border collies is: 2.108
oddsratio<-(prgr/(1-prgr))/(prbc/(1-prbc));oddsratio
## [1] 2.107557