Discussion 7: Hypothesis Testing#

STATS 60 / STATS 160 / PSYCH 10


Show and Tell: Hypothesis Test#

The discussion assignment for the week was to describe a pattern or tend you have observed on Stanford campus, then design a hypothesis test to determine whether it is statistically significant.

  • Describe the pattern or trend

  • Formulate the hypothesis test. What is the null hypothesis? What is the alternative hypothesis?

  • Explain how to compute the \(p\)-value.

  • Did you reject the null hypothesis?

![](image link here)

Hypothesis Testing#

  • State the null hypothesis

    • Assume “nothing unusual is happening”

    • The data we observed is just by chance

  • Assuming the null hypothesis is true, what is the probability of the observed data?

    • This is the \(p\)-value

  • If the \(p\)-value is small, we reject the null hypothesis. This means that under the assumptions of null hypothesis, our observed data is unlikely.

Activity: Bob or Tim?#

One man is named Bob, the other is named Tim. Which one do you think is named Tim?

a. the man on the left b. the man on the right

Facial Stereotyping#

These photos come from a 2007 study about whether people use facial prototypes when they encounter different names.

If there is no facial stereotyping, what is the probability that we get 3 or fewer people in a sample of 15 identifying the man on the right as Tim?

If only 3 people in a sample of 15 identified the man on the right as Tim, is there evidence of facial stereotyping?

Step 1: Set up the Hypothesis#

  • Remember that the null hypothesis says that what we observed is “just noise”.

  • \(H_0:\) Each person is randomly picking the left or right photo as Tim.

    • The probability of picking the left photo as Tim is 0.5.

  • What is the alternative hypothesis?

  • Remember that the alternative hypothesis is our explanation if we reject the null hypothesis.

  • \(H_A:\) There is facial stereotyping. People are likely to identify one of the photos as Tim.

    • The probability of picking the left photo as Tim is not 0.5.

    • Under the alternative hypothesis, the probability of picking the left photo could be close to 0 or close to 1.

Interlude#

Before we carry out the hypothesis test, let’s think about the possible errors.

  • What would a Type I error be? (false positive)

  • What would a Type II error be? (false negative)

Truth
$H_0$ $H_A$
Decision reject $H_0$ Type I error
don't reject $H_0$ Type II error
  • \(H_0\): There’s no facial stereotyping. People are picking randomly which one is Tim. (\(p = .5\))

  • \(H_A\): There is facial stereotyping. People have a tendency to identify one of the photos as Tim. (\(p \neq .5\))

Step 2: Calculate the Probability#

  • Remember that the \(P\)-value is the probability of observing the data or a more extreme result, if \(H_0\) is true.

  • There are three ways to calculate this probability:

    1. simulation using the box model applet{target=”_blank”}

    2. simulation using Python or R

    3. exact calculation using the binomial model

  • \(p = Pr(Binomial(n, 1/2) \geq \#\ people \ voting \ left)\)

Step 3: Interpret the \(p\)-value#

Based on the \(p\)-value, what can we conclude?