Skip to main content
Statistics LibreTexts

11.7: Running the Hypothesis Test in Practice

  • Page ID
  • At this point some of you might be wondering if this is a “real” hypothesis test, or just a toy example that I made up. It’s real. In the previous discussion I built the test from first principles, thinking that it was the simplest possible problem that you might ever encounter in real life. However, this test already exists: it’s called the binomial test, and it’s implemented by an R function called binom.test(). To test the null hypothesis that the response probability is one-half p = .5,164 using data in which x = 62 of n = 100 people made the correct response, here’s how to do it in R:

    binom.test( x=62, n=100, p=.5 )
    ##  Exact binomial test
    ## data:  62 and 100
    ## number of successes = 62, number of trials = 100, p-value =
    ## 0.02098
    ## alternative hypothesis: true probability of success is not equal to 0.5
    ## 95 percent confidence interval:
    ##  0.5174607 0.7152325
    ## sample estimates:
    ## probability of success 
    ##                   0.62

    Right now, this output looks pretty unfamiliar to you, but you can see that it’s telling you more or less the right things. Specifically, the p-value of 0.02 is less than the usual choice of α=.05, so you can reject the null. We’ll talk a lot more about how to read this sort of output as we go along; and after a while you’ll hopefully find it quite easy to read and understand. For now, however, I just wanted to make the point that R contains a whole lot of functions corresponding to different kinds of hypothesis test. And while I’ll usually spend quite a lot of time explaining the logic behind how the tests are built, every time I discuss a hypothesis test the discussion will end with me showing you a fairly simple R command that you can use to run the test in practice.

    • Was this article helpful?