---
title: "HW 4 -- Math 58B"
subtitle: "due Thursday, February 19, 2026"
author: "your name here"
format: pdf
execute:
  warning: false
  message: false
---


```{r}
library(tidyverse)
library(broom)
library(infer)
library(praise)
```


### Assignment Summary (Goals)
* articulation of **what** the confidence interval is capturing
* knowledge of the impact of sample size on the resulting confidence interval
* understanding of confidence level


#### Q1. TRUE / FALSE

Label each of the following as TRUE or FALSE.  If FALSE, explain why not.

(a) A 95% confidence interval contains 95% of all the sample proportions. 
(b) A 95% confidence interval contains 95% of the observations. 
(c) A 95% confidence interval contains 95% of the population parameters. 
(d) 95% of confidence intervals contain their own sample proportion. 
(e) 95% of confidence intervals contain the population proportion. 


#### Q2. Extreme Poverty

This question comes from Hans Rosling (see his [TED talk here](https://www.ted.com/playlists/474/the_best_hans_rosling_talks_yo)) who asked a group of people whether the percentage of the world's population who live in extreme poverty doubled, halved, or remained the same over the past twenty years?^[Example comes from Allan Rossman https://askgoodquestions.blog/]

In a sample of 1005 US adults in 2017, 59% of the sample thought that the rate had doubled (the true answer is that the rate has halved).

Here, we define "success" to be when an individual answered that the proportion of people in extreme poverty had doubled.

(a) What is the parameter of interest? 
(b) Use R and bootstrapping (as in Lab 4) to find a 95% confidence interval for the true parameter value. 
(c) Interpret the confidence interval using words like "extreme poverty".



#### Q3. Confidence

Using an applet, we will explore what "confidence" really means.^[Example comes from Allan Rossman https://askgoodquestions.blog/]

Note: the applet constructs a confidence interval in a different method from boostrapping (we will see the method in the coming weeks).  However, the ideas of and interpretation of a CI are the same regardless of the method of construction.

The confidence interval applet: http://www.rossmanchance.com/applets/2021/confsim/ConfSim.html

Scenario:  let's say we are taking samples from a college where 40% of the student body has a tattoo.  Hypothetical samples of size 75 will be taken.

To start, set $\pi = 0.4$ (in this applet, the true proportion is given by the notation $\pi$, we use $p$ in class, they are the same thing).  Set n= 75.  Click "Sample" to generate a single sample and a single confidence interval.

(a) Provide the value of the confidence interval generated by the applet.  Does the interval succeed in capturing the true population proportion?  Explain (include the numerical value of the true population proportion?) 
(b) Click on the "sample" button a few times. 
  * Is the sample always the same?  What is the range of values for the number of students in your sample of 75 with a tattoo?  (That is, do you ever get a number of successes of 3?  What about 72?  What is the range of values you are seeing?)
  * Do all of your intervals capture the parameter?  Explain how the intervals vary around the parameter line.
(c) Click on the "sample" button until the line turns red.  Why is the interval red? 
(d) Now change the number of intervals from 1 to 100.  Click on "sample".  What proportion of the intervals are green?
(e) Click on "sample" again (100 new intervals). Do you always get 95% green intervals?  After a few more clicks, report your running total of the percent of green intervals.
(f) Survey researchers typically select only one random sample from a population, and then they produce a confidence interval based on that sample. How do we know whether the resulting confidence interval is successful in capturing the unknown value of the population parameter? 
(g) If we can't know for sure whether the confidence interval contains the value of the population parameter, on what grounds can we be confident about the process of creating an interval estimate for the parameter?
(h) Change the sample size (n) from 75:  first try n at 20, then try n at 200.  Report on both how changing the sample size changes/doesn't change (1) the width of the interval as well as the (2) rate of parameter capture.
(i) Change the conf level from 95%:  first try conf level at 80%, then try conf level at 99%.  Report on how changing the confidence level changes/doesn't change the (1) width of the interval as well as (2) the rate of parameter capture.


```{r}
praise()
```