Question 1

Since this data is categorical, and we want to test if there is a change, we must use the McNemar’s test.

\(H_0: \text{There is no evidence of change.}\)

\(H_1: \text{There is evidence of change.}\)

McNemar=matrix(c(6, 6, 14, 60), 
               nrow=2, 
               dimnames = list(PreTreatment = c("Yes", "No"),
                               PostTreatment = c("Yes", "No")))
McNemar
##             PostTreatment
## PreTreatment Yes No
##          Yes   6 14
##          No    6 60
mcnemar.test(McNemar, correct = FALSE)
## 
##  McNemar's Chi-squared test
## 
## data:  McNemar
## McNemar's chi-squared = 3.2, df = 1, p-value = 0.07364

The results are not statistically significant (with and without the correction factor), and we fail to reject \(H_0\).

Question 2

Since yield of corn is continuous, we will use Wilcoxon rank sum test. It will be one sided.

\(H_0: \text{The median of the two samples is the same.}\)

\(H_1: \text{The medians are not equal; the presence of a small number of weeds reduces the yield of the corn.}\)

A=c(166.7,172.2,165.0,176.9)
B=c(158.6,176.4,153.1,156.0)
wilcox.test(A,B, alternative = "greater")
## 
##  Wilcoxon rank sum test
## 
## data:  A and B
## W = 13, p-value = 0.1
## alternative hypothesis: true location shift is greater than 0

We see the results are not statistically significant, and we fail to reject \(H_0\).

Question 3

For this question, we will use survival analysis, i.e. Log-rank test. We want to test if the Drug 6-MP is effective in term of survival. We cannot perform one sided tests, but we can see if the curves are different.

\(H_0: \text{There is no difference between the survival curves.}\) \(H_1: \text{There is a difference between the survival curves}\)

if (!require("survival")) {
  install.packages("survival", repos="http://cran.rstudio.com/") 
  library("survival")
}
## Loading required package: survival
time =c(6,6,6,7,9,1,2,2,3,4)
event=c(1,1,0,1,0,1,1,1,1,1)
group=c(1,1,1,1,1,0,0,0,0,0)
sur=data.frame(time=time, event=event, group=group)
survdiff(Surv(time, event) ~ group,data=sur, rho = 0)
## Call:
## survdiff(formula = Surv(time, event) ~ group, data = sur, rho = 0)
## 
##         N Observed Expected (O-E)^2/E (O-E)^2/V
## group=0 5        5     1.84      5.42      9.73
## group=1 5        3     6.16      1.62      9.73
## 
##  Chisq= 9.7  on 1 degrees of freedom, p= 0.00181

We see that the results are significant, and we reject \(H_0\).

Question 4

Since we are looking to make claims about the difference between expected frequencies of two categories we can use the chi-square test. While the sample sizes are small, they are large enough to use the chi-square test with caution. Since we want to test if the results were significantly better for the treatment than the control, we will perform a one sided test.

\(H_0: \text{There is no difference between the resulting frequencies.}\) \(H_1: \text{The results were significantly better for the treatment.}\)

Question 5

Since we are looking to make claims about the population of Zea mays, and we have a very small sample size, we will use Student’s T-Test. However, since we want to know if one group is taller than the other, it will be a one sided test. The hypotheses are as follows:

\(H_0: \text{Cross-fertilization plants are the same height as the self-fertilization plants.}\) \(H_1: \text{Cross-fertilization plants are generally taller than the self-fertilization plants.}\)