• ¿Documento equivocado? Cámbialo gratis
  • Escrito por estudiantes que aprobaron
  • Inmediatamente disponible después del pago
  • Leer en línea o como PDF
Vender
¿Dónde estudias?
Tu idioma
Document preview thumbnail
Vista previa 2 fuera de 8 páginas
Resumen

Sample Sizes and Confidence Intervals Practice assignment& Summary

Document preview thumbnail
Vista previa 2 fuera de 8 páginas

2. Sample Size and Confidence Level A data science class at the large Data 8 University wants to estimate the percent of Facebook users among students at the school. To do this, they need to take a random sample of students. You can assume that their method of sampling is equivalent to drawing at random with replacement from students at the school. Please review Section 14.6 of the textbook before proceeding with this section. Your work will go much faster that way! Question 2.1. Assign smallest to the smallest number of students they should sample to ensure that a 95% confidence interval for the parameter has a width of no more than 6% from left end to right end. (6 points) Hint: How can our data be represented to show if a student in the sample is a Facebook user? Given this, what assumptions can we make for the SD of the population? Section 14.6 might be helpful! Note: While the true smallest sample size would have to be an integer, please leave your answer in decimal format for the sake of our tests. In [ ]: Out[ ]: smallest = (4 * .5 / 0.06)**2 #(1.96**2 * (.5*(1-.5))) / ( 0.06)**2 #* (.25)#(0.5 * (1 - 0.5)) smallest 1111. In [ ]: Out[ ]: q2_1 passed! ("q2_1") Question 2.2. Suppose the data science class decides to construct a 90% confidence interval instead of a 95% confidence interval, but they still require that the width of the interval is no more than 6% from left end to right end. Will they need the same sample size as in 2.1? Pick the right answer and explain further without calculation. (6 Points) . Yes, they must use the same sample size. . No, a smaller sample size will work. . No, they will need a bigger sample. 2, a smaller sample size will work. Based on the formula which uses the z-score from the percent confidence, a lower confidence interval means a lower z-score which directly contributes to a lower sample size. Question 2.3. The professor tells the class that a 90% confidence interval for the parameter is constructed exactly like a 95% confidence interval, except that you have to go only 1.65 SDs on either side of the estimate (±1.65) instead of 2 SDs on either side (±2). Assign smallest_num to the smallest number of students they should sample to ensure that a 90% confidence interval for the parameter has a width of no more than 6% from left end to right end. (6 points) Note: While the true smallest sample size would have to be an integer, please leave your answer in decimal format for the sake of our tests. In [ ]: smallest_num = (1.65 / ( 0.06 / 2))**2 * (0.5 * (1 - 0.5))

Vista previa del contenido

lOMoAR cPSD| 70487227




lOMoAR cPSD| 70487227




Sample Sizes and Confidence Intervals Practice assignment
Please complete this notebook by filling in the cells provided. Before you begin, execute the following cell to setup the notebook by importing some helpful libraries. Each time you start your server, you will need to execute this cell again.

For all problems that you must write explanations and sentences for, you must provide your answer in the designated space. Moreover, throughout this homework and all future ones, please be sure to not re-assign variables throughout the notebook! For example, if you use max_temperature in your answer to one question, do not reassign it later on.
Otherwise, you will fail tests that you thought you were passing previously!

Note: This homework has hidden tests on it. That means even though the tests may say 100% passed, it doesn't mean your final grade will be 100%. We will be running more tests for correctness once everyone turns in the homework.

Directly sharing answers is not okay, but discussing problems with the course staff or with other students is encouraged.

You should start early so that you have time to get help if you're stuck.




2. Sample Size and Confidence Level
A data science class at the large Data 8 University wants to estimate the percent of Facebook users among students at the school. To do this, they need to take a random sample of students. You can assume that their method of sampling is equivalent to drawing at random with replacement from students at the school.

Please review Section 14.6 of the textbook before proceeding with this section. Your work will go much faster that way!

Question 2.1. Assign smallest to the smallest number of students they should sample to ensure that a 95% confidence interval for the parameter has a width of no more than 6% from left end to right end. (6 points) Hint: How can our data be represented to show

if a student in the sample is a Facebook user? Given this, what assumptions can we make for the SD of the population? Section 14.6 might be helpful!

Note: While the true smallest sample size would have to be an integer, please leave your answer in decimal format for the sake of our tests.

In [ ]: smallest = (4 * ..06)**2 #(1.96**2 * (.5*(1-.5))) / ( 0.06)**2 #* (.25)#(0.5 * (1 - 0.5))
smallest

1111.1111111111113
Out[ ]:


In [ ]: grader.check("q2_1")
Out[ ]:
q2_1 passed! 🌈

Question 2.2. Suppose the data science class decides to construct a 90% confidence interval instead of a 95% confidence interval, but they still require that the width of the interval is no more than 6% from left end to right end. Will they need the same sample size as in 2.1? Pick the right answer and explain further without calculation. (6 Points)

. Yes, they must use the same sample size.
. No, a smaller sample size will work. . No,
they will need a bigger sample.

2, a smaller sample size will work. Based on the formula which uses the z-score from the percent confidence, a lower confidence interval means a lower z-score which directly contributes to a lower sample size.

Question 2.3. The professor tells the class that a 90% confidence interval for the parameter is constructed exactly like a 95% confidence interval, except that you have to go only 1.65 SDs on either side of the estimate (±1.65) instead of 2 SDs on either side (±2). Assign smallest_num to the smallest number of students they should sample to ensure that a

90% confidence interval for the parameter has a width of no more than 6% from left end to right end. (6 points) Note: While the true smallest sample size would have to be an integer, please leave your answer in decimal format for the sake of our tests.

In [ ]: smallest_num = (1.65 / ( 0.))**2 * (0.5 * (1 - 0.5))
smallest_num

756.25
Out[ ]:

, lOMoAR cPSD| 70487227




In [ ]: grader.check("q2_3")
Out[ ]:
q2_3 passed! ✨

For this next exercise, please consult Section 14.3.4 of the textbook for similar examples.

The students are curious about how the professor came up with the value 1.65 in Question 2.3. She says she ran the following two code cells. The first one calls the datascience library function plot_normal_cdf , which displays the proportion that is at most the specified number of SDs above average under the normal curve plotted with standard units
on the horizontal axis. You can find the documentation here.


Note: The acronym cdf stands for cumulative distribution function . It measures the proportion to the left of a specified point under a probability histogram. messages.pdf_cover_qr_code_label
plot_normal_cdf(1.65)
In [ ]: messages.downloaded_by




To run the second cell, the professor had to first import a Python library for probability and statistics:

In [ ]: # Just run this cell
from scipy import stats

Then she used the norm.cdf method in the library to find the gold proportion above.


In [ ]: # Just run this cell
stats.norm.cdf(1.65)

0.9505285319663519
Out[ ]:

Note: You do not need to understand how the scipy library or how to use the method yourself.

Question 2.4. This shows that the percentage in a normal distribution that is at most 1.65 SDs above average is about 95%. Explain why 1.65 is the right number of SDs to use when constructing a 90% confidence interval. (6 Points) The stats.norm.cdf(1.65) gives the percentage

below 1.65 standard deviations on the normal curve but a confidence intervals give you a middle range of the normal curve ignoring the values in the very beginning and end of the curve.



In [ ]: # Just run this cell, do not change it.
stats.norm.cdf(2.33)

0.99009692444083575
Out[ ]:

Question 2.5. The cell above shows that the proportion that is at most 2.33 SDs above average in a normal distribution is 99%. Assign option to the right option to fill in the blank: (6 points) If you start at the estimate and go 2.33

SDs on either side, then you will get a ___% confidence interval for the parameter.

. 99.5 .
99
. 98.5
. 98

In [ ]: option = 4
option

Información del documento

Subido en
18 de septiembre de 2026
Número de páginas
8
Escrito en
2026/2027
Tipo
Resumen
$10.99

¿Documento equivocado? Cámbialo gratis Dentro de los 14 días posteriores a la compra y antes de descargarlo, puedes elegir otro documento. Puedes gastar el importe de nuevo.
Escrito por estudiantes que aprobaron
Inmediatamente disponible después del pago
Leer en línea o como PDF

Vendido
0
Seguidores
0
Artículos
176
Última venta
-



Por qué los estudiantes eligen Stuvia

Creado por compañeros estudiantes, verificado por reseñas

Calidad en la que puedes confiar: escrito por estudiantes que aprobaron y evaluado por otros que han usado estos resúmenes.

¿No estás satisfecho? Elige otro documento

¡No te preocupes! Puedes elegir directamente otro documento que se ajuste mejor a lo que buscas.

Paga como quieras, empieza a estudiar al instante

Sin suscripción, sin compromisos. Paga como estés acostumbrado con tarjeta de crédito y descarga tu documento PDF inmediatamente.

Student with book image

“Comprado, descargado y aprobado. Así de fácil puede ser.”

Alisha Student

Preguntas frecuentes