In: Statistics and Probability
Test of equal or given proportions: Use the “bacteria” data set to answer the question, “did the drug treatment have a significant effect of the presence of the bacteria compared with the placebo?”
Please use R to answer this question.
It should be use In R studio. dataset is also in the R
The R output is:
The R code is:
library(MASS)
data(bacteria)
prop=bacteria[[1]]
table(prop)
x=0
n=length(prop)
for(i in 1:n)
{ if(prop[i]=="y")
x=x+1
}
prop.test(x=x,n=n,p=0.5,alternative='greater')
The hypothesis being tested is:
H0: p = 0.5
Ha: p > 0.5
The p-value is 0.0000.
Since the p-value (0.0000) is less than the significance level (0.05), we can reject the null hypothesis.
Therefore, we can conclude that drug treatment have a significant effect on the presence of the bacteria compared with the placebo.