STA 111 Lab 5: Difference in 2 Proportions

Complete all Questions and submit final PDF or html under Assignments in Canvas.

Submission Set Up

Create a Google Doc or Microsoft Word document for your responses. You will be answering each of the Questions in the boxes below. When you are done, submit your document as a PDF!

The Data Set

We have data from the animal shelter system in Austin, Texas. Volunteers there are curious if there is a difference in how long it takes puppies to get adopted versus kittens, and if so, how much of a difference. This helps them plan for volunteer needs, like foster care, and also helps them allocate their advertising budget to help the animals who are likely to take longer to get adopted.

They provide us with a random sample of 500 kittens and puppies that were adopted last year from the shelter system. We define a kitten as a cat less than 1 year of age and a puppy as a dog less than 1 year of age. We are provided information on the type of animal (dog or cat) as well as whether or not the animal was adopted in less than 30 days. These animals were all found or brought in as strays, and all were in good health, meaning no injuries or illnesses that prevented them from being adopted.

The Goal: Is there convincing evidence of a difference in the proportion of puppies versus kittens who get adopted in less than 30 days?

Question 1

Do you think that we would use a hypothesis test or a confidence interval to answer this, or would either one work? Briefly explain your answer.

Exploring the Data

Everything about this set up should be screaming inference!!. We have a random sample from the population, and we want to know if the information the sample gives us can argue about something in the whole population.

Question 2

In the sample we are given, 209 puppies are adopted in less than 30 days, and 28 puppies take at least 30 days (or longer) to be adopted.

Does this provide convincing evidence that more than 75% of puppies in the Austin animal shelter system are adopted in less than 30 days?

Show all you work necessary to answer this question. This means show all the steps!!

If Question 2 was all the volunteers needed to know, we would be set. However, this set up has something new. So far in our work with inference, we have had only one proportion to deal with. Today, we have two. Our goal is not to check to see if a proportion is less than .4, or greater than .6, but rather to see if two proportions are different from one another.

The first step is going to be to find our sample statistics. In other words, We want to find the proportion of puppies who were adopted in less than 30 days and the proportion of kittens who were adopted in less than 30 days in our sample so we can compare them.

Download the data by copying and pasting this link into a new browser window: https://www.dropbox.com/scl/fi/p5jux2dqfz4wlzch8lzr6/KittenPuppyAdoptions.csv?rlkey=gfd9vtkaqibdlx1ro82e03hts&st=1psy1cdh&dl=0

Once you do that, copy and paste this link into a new browser window: https://www.lock5stat.com/StatKey/descriptive_2_cat/descriptive_2_cat.html

Click Upload Data and upload your data set. Choose the two variables of interest, animaltype and Adoptedin30DaysorLess.

Question 3

  1. Take a screen shot of the plot that shows up on the screen and paste it in your assignment. This is called a stacked barplot. The blue (top) part of the plot is for kittens, and the brown (bottom) part is for puppies.

  2. Based on the plot, does it look like more puppies or kittens are adopted in less than 30 days?

Question 4

Using the two way table in the applet, state:

  1. \(\hat{p}_{puppy}\): The proportion of puppies who were adopted in less than 30 days

  2. \(\hat{p}_{kitten}\): The proportion of kittens who were adopted in less than 30 days

Question 5

Based on the sample, is like there is a difference in the proportion of dogs who are adopted in less than 30 days and the proportion of cats who are adopted in less than 30 days? Explain.

In Question 5, the quantity you found can be represented as a difference in two proportions:

\[\hat{p}_{puppy} -\hat{p}_{kitten}\]

This is what we see in the sample, but can we take this conclusion and extend it to the whole population? That’s the role of inference, like hypothesis testing and confidence intervals, so let’s do that next!

Question 6

Recall that the goal is to answer the following: Is there convincing evidence of a difference in the proportion of puppies versus kittens who get adopted in less than 30 days?

Based on this, write down what you think Step 1 should be in a hypothesis test. In other words, write down the hypotheses. You can use either words or mathematical notation.

Once we have our hypotheses, the next step is generally to find a test statistic and check conditions necessary for the CLT. But…what test statistic do we need now that we are comparing two groups? And does the CLT even apply??

Sampling Distribution

The CLT is a way for us to describe the sampling distribution of a statistic if we could take infinitely many samples from a population in which the null hypotheses were true. In other words, if there were no difference between the proportion of dogs and cats, what kinds of difference would we expect to see in the sample statistics?

Question 7

If there is no difference in the proportions in the population, do we expect values of \(\hat{p}_{Dogs} -\hat{p}_{Cats}\) to be (a) negative, (b) close to 0, or (c) positive?

While we may be able to guess at the center of the sampling distribution of \(\hat{p}_{puppy} -\hat{p}_{kitten}\), for our test statistic we need to know the measure of spread to use. This means we need to simulate the sampling distribution to see what the shape looks like.

Question 8

Generate one random sample from the sampling distribution. State the value of \(\hat{p}_{Dogs} -\hat{p}_{Cats}\) you get from this sample. Is this higher or lower then what we got in our original data (in Question 5)?

Question 9

Generate 5000 more random sample from the sampling distribution. Describe the modality and skew of the distribution you get.

It looks like even though we are dealing with a difference in proportions rather than one proportion, the sampling distribution is still a normal distribution!!

Question 10

Recall that the goal is to answer the following: Is there convincing evidence of a difference in the proportion of puppies versus kittens who get adopted in less than 30 days?

  1. With our 5001 samples, what mean do we have in our simulated sampling distribution?

  2. What should the mean of our sampling distribution be if we have infinitely many samples?

In addition to the mean, we need to think about the standard error. With one proportion, the standard error of \(\hat{p}\) is

\[SE_{\hat{p}} = \sqrt{\frac{\hat{p}(1-\hat{p})}{n} }\]

as long as (1) independence and (2) the success/failure condition are met. When comparing two proportions, the standard error of \(\hat{p}_1 - \hat{p}_2\) is:

Option 1

\[SE_{\hat{p}_1-\hat{p}_2} = \sqrt{\frac{\hat{p}_{1}(1-\hat{p}_1)}{n_1} + \frac{\hat{p}_2(1-\hat{p}_2)}{n_2}}\]

if our null hypothesis is \(p_1 > p_2\) or \(p_1 < p_2\) and

Option 2

\[SE_{\hat{p}_1-\hat{p}_2} = \sqrt{\frac{\hat{p}_{pooled}(1-\hat{p}_{pooled})}{n}}\]

if our null hypothesis is \(p_1 = p_2\) or \(p_1 - p_2 =0\). The value \(\hat{p}_{pooled}\) is the total proportion of animals in sample (both kittens and puppies) who were adopted in less than 30 days. If the proportion is the same, there is no point separating the groups!

Question 11

Which standard error are we going to use: option 1 or option 2?

Conditions for Option 1 SE

  • The two samples are independent from one another (meaning there should be no relationship between the puppies in one sample and the kittens in the other)
  • Each sample is independent (which we usually get from having a random sample)
  • \(\hat{p}_{puppy} \times n_{puppy} \geq 10\)
  • \((1 - \hat{p}_{puppy}) \times n_{puppy} \geq 10\)
  • \(\hat{p}_{kitten} \times n_{kitten} \geq 10\)
  • \((1-\hat{p}_{kitten}) \times n_{kitten} \geq 10\)

Conditions for Option 2 SE

  • The two samples are independent from one another (meaning there should be no relationship between the puppies in one sample and the kittens in the other)
  • Each sample is independent (which we usually get from having a random sample)
  • \(\hat{p}_{pooled} \times n \geq 10\)
  • \((1 - \hat{p}_{pooled}) \times n \geq 10\)

Question 12

  1. Check the conditions for either Option 1 or Option 2 (depending on what you chose in Question 11.)

  2. Compute the standard error.

Okay, so at this point we know that there is a version of the CLT that applies when comparing two proportions. That is what we need to be able to perform a hypothesis test.

Hypothesis Test

Recall that the goal is to answer the following: Is there convincing evidence of a difference in the proportion of puppies versus kittens who get adopted in less than 30 days?

We have already decided that:

Step 1

\[H_0: p_{puppies} - p_{kittens} = 0\] \[H_0: p_{puppies} - p_{kittens} \neq 0\]

Question 13

Is this a one sided test or a two sided test?

Step 2 is creating a test statistic and checking any conditions needed to do this. We have already checked conditions, so…

Question 14

What is the value of the test statistic for this test? Show your work.

Hint: This is the same set up as we have with one proportion! You just have a different standard error and your sample statistic is the difference in two proportions. Let me know if you get stuck!

Step 3 is finding a p-value. We can use the applet to help us do this. Here is the picture of the sampling distribution:

Question 15

Based on the plot, does it look like the p-value is:

    1. Exactly 1
    1. Close to 1
    1. Approximately 0
    1. Exactly 0
    1. None of the above

Question 16

Why is it so important to distinguish between approximately 0/1 and exactly 0/1?

Recall that the p-value is

\[p-value = 2 \times P( \hat{p}_{puppy} - \hat{p}_{kitten} > .35 ~|~{p}_{puppy} - {p}_{kitten} =0)\]

Using an online tool, we get

\[p-value \approx 1.43 \times 10^{-68}\]

Question 17

At a significance level of \(\alpha = .05\), do we have convincing evidence of a difference in the proportion of puppies versus kittens who get adopted in less than 30 days?

Confidence Intervals

Right now, we can tell the volunteers whether we have evidence of a difference. However, the follow-up question is likely to be how much of a difference? Just as we can with one proportion, we can answer this with a confidence interval.

For the difference in two proportions, the formula for a 95% CI is:

\[(\hat{p}_{puppy} - \hat{p}_{kitten}) + 1.96\sqrt{\frac{\hat{p}_{1}(1-\hat{p}_1)}{n_1} + \frac{\hat{p}_2(1-\hat{p}_2)}{n_2}}\]

Question 18

Build and interpret a 95% CI for the difference in the proportion of puppies and kittens adopted in less than 30 days.

Question 19

Do you think this interval suggests (a) statistical significance, (b) practical significance (practical importance), (c) neither, or (d) both? Explain your answer.

Question 20

Recall that the goal of all of this is to try and help volunteers decide how much extra advertising might be needed for puppies or kittens for adoptions. Based on everything we have done in this lab, what would you recommend and why? Answer in 1-2 sentences.

Submitting

  • Make sure your name is on the document, along with the name of your partner if you worked with a partner.
  • Make sure you run spell check.
  • Convert your document to a PDF and submit on Canvas!

References

Creative Commons License
This work was created by Nicole Dalzell is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License. Last updated 2026 June 5.

The data set used in this lab is from:

“A Dataset of University Students’ Stress and Anxiety Levels based on Questionnaires and Wearable Sensors”, Enrique Garcia-Ceja, Joanna Alvarado-Uribe, Ponciano Jorge Escamilla-Ambrosio, Adriana Lara, Alma Mena-Martinez, Gina Gallegos-Garcia, Miguel Gonzalez-Mendoza, Raul Monroy, Gilberto Martinez Luna, Juan Manuel Fernández-Cárdenas (2026). .