i'm a graduate student (biology program) with minimal experience with statistics. I have two questions relating to my project that i'd love help with! The first question is how I can take a single measurement of many events (such as, 55 coin flips out of 100 yielded heads) and test if that is significantly different than a separate measurement (such as, now with a different coin, I see 40 coin flips out of 100 yields heads - so are the two coins significantly different? Can I put a p-value on that?). The second question is, if I use an R program that draws a best fit line on some data and gives i.e. the slope is 10 and the 95% confidence interval is from 8 to 12, then compare that to another slope that is 14 with a 95% CI from 12 to 16, are these results significantly different? And can I put a p-value on that as well? Thanks in advance for any help!
1 Answer
Let's do the coin flip first. Here is how to do this in R
heads<-c(55,40)
flips<-c(100,100)
prop.test(heads,flips, correct = F)
The heads
array houses the number of heads we observed. The flips
array houses the number of times each coin was flipped. The function prop.test
performs a test of proportions. You can see the p-value in the print out.
As for the regression, I don't think you can do this without access to the data. You'd need to specify a model, and then look at the coefficients of that model. Do you have a sample dataset we can work with?
-
$\begingroup$ Am I missing something? OP asked about 55 vs 40 each out of 100. Then from
prop.test(c(55,40),c(100,100), correct = F)$p.val
, I get 0.03367207, so signif diff at 5% level. $\endgroup$– BruceETCommented Sep 4, 2019 at 18:25 -
$\begingroup$ @BruceET Oops, must have thought OP said 50 and not 55. Is that what you're referring to? $\endgroup$ Commented Sep 4, 2019 at 18:38
-
-
-
$\begingroup$ As for the regression, I'm not sure how to present it on this site. Hearing that the statistical analysis must be done on a more upstream step is useful to know though. I'm going to hunt through the R program that I used to calculate the CIs and see if there are more comparative functions available. $\endgroup$– DanielCommented Sep 4, 2019 at 22:20