Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
.) # > > > > > Fisher Sign Test regular<-c(3,7,5,7,8,10,9,6,10,5,9,8,8,8,6,5,6,8,7) lowfat<-c(6,4,8,8,6,6,5,4,7,7,5,7,6,6,8,7,4,6,5) diff<-regular-lowfat B<-length(diff[diff>0]) binom.test(B,length(diff[diff!=0]))
data: B and length(diff[diff != 0]) number of successes = 13, number of trials = 19, p-value = 0.1671 alternative hypothesis: true probability of success is not equal to 0.5 95 percent confidence interval: 0.4344984 0.8742394 sample estimates: probability of success 0.6842105 # > > > > > > Wilcoxon Signed Rank Test regular<-c(3,7,5,7,8,10,9,6,10,5,9,8,8,8,6,5,6,8,7) lowfat<-c(6,4,8,8,6,6,5,4,7,7,5,7,6,6,8,7,4,6,5) diff<-regular-lowfat rank<-rank(abs(diff)) library(exactRankTests) wilcox.test(regular,lowfat,paired=TRUE,alternative="two.sided")
ta: regular and lowfat V = 137, p-value = 0.08888 alternative hypothesis: true location shift is not equal to 0 # Given that the p-value in the fisher sign test is 0.1671 and 0.08 in the Wilcoxon Signed Rank Test, there is no sufficient evidence to believe that there is difference in the median taste test rating between regular and low-fat Oreo cookies. 2.) a.) > media<-matrix(c(20,2,12,16), > nrow=2, > dimnames=list("B"=c("YES","NO"), > "A"=c("YES","NO"))) > media # A B || YES || NO YES|| 20 || 12 NO || 2 || 16
data: 2 and 14 number of successes = 2, number of trials = 14, p-value = 0.01294 alternative hypothesis: true probability of success is not equal to 0.5 95 percent confidence interval: 0.01779452 0.42812916 sample estimates: probability of success 0.1428571 c.) > mcnemar.test(media,correct=FALSE) # McNemar's Chi-squared test data: media McNemar's chi-squared = 7.1429, df = 1, p-value = 0.007526 # CONCLUSION : Reject HO since the pvalue(0.007526) is less than the alpha(0.5)