In: Statistics and Probability
Use the following code to access data from the Getting To Know You Survey that was just conducted. The dataset can also be found online at the link: http://users.stat.umn.edu/~wuxxx725/data/ Getting2NoUS2020.csv. NoU<- read.csv("http://users.stat.umn.edu/~wuxxx725/data/Getting2NoUS2020.csv", header = TRUE) attach(NoU) 1. Are US students more likely to favor legalizing marijuana? The following two variables will be used. • international.student International student? Two categories ”U.S.” or ”International” • legalizing.marijuana Favor legalizing marijuana? Two categories ”Yes” or ”No”(although three categories are available, we only care about yes or no group)
(a) Run the command below to construct a contingency table. table(international.student,legalizing.marijuana)
(b) Let p1 and p2 denote the proportion favoring marijuana legalization among international students and US students, respectively. Use prop.test() command to construct a 95% confidence interval for comparing p1 and p2. Can you conclude which of p1 and p2 is larger? Explain.
(c) Test your conclusion in (b) at the .05 level using prop.test() command. You only need to show your code and output.
(d) Interpret the reported p-value.
I specifically need help on how to properly run the prop.test
NoU<-
read.csv("http://users.stat.umn.edu/~wuxxx725/data/Getting2NoUS2020.csv",
header = TRUE)
attach(NoU)
table(international.student,legalizing.marijuana)
prop.test(x =c(7,175),n = c(8+7,175+46))
this is command for
prop.test(x, n, p = NULL, alternative = "two.sided", correct = TRUE)
yes column 7 for International and 175 for US
i have ignored sample for why they are not sure
hence
7+8 = 15
for US 175 +46
95 percent confidence interval: -0.6188632 -0.0315139
p2 is larger as all values are negative in CI
note that p-value in output = 0.009773 is for two-tailed test
for left-tailed test
it will be half of 0.009773
since p-value < alpha
we reject the null hypothesis