程序代写代做代考 Sample Questions for Test 2 (with Solutions)¶

Sample Questions for Test 2 (with Solutions)¶

Disclaimer: The sample questions are provided to give you a rough idea on what might be on the tests. They are not meant to be 100% comprehensive or 100% indicative of the contents of their respective assessments. In particular, there might be true/ false questions, fill-in-the-blanks questions, and/or any other types of questions not specifically included here.
In [1]:
import numpy as np
from scipy.stats import norm

**Preliminaries**
“The 100” is a popular TV series that is also available on Netflix. Per IMDB, the series can be summarised as follows:
“Set ninety-seven years after a nuclear war has destroyed civilization, when a spaceship housing humanity’s lone survivors sends one hundred juvenile delinquents back to Earth, in hopes of possibly re-populating the planet.”
Sample questions here are inspired by the 100 series (but not necessarily depicting an accurate account of what happens in the series).

**QUESTION 1:** The 100 individuals sent back to Earth can tolerate radiation to a certain degree. Specifically, the maximum radiation one of these individuals can tolerate is normally distributed with a mean of 10 grays and a standard deviation of 1.25 grays. The radiation level on the ground, however, is 8 grays. Compute the minimum number of radiation-proof suits they will need to fully accommodate the individuals who cannot tolerate the radiation on the ground.
In [2]:
area_to_the_left = norm.cdf(8, loc = 10, scale = 1.25)
print(f’The percentage of individuals who cannot tolerate 8 grays of radiation is {100*area_to_the_left:.3f}.’)
print(f’So they will need at least {int(np.ceil(100*area_to_the_left))} radiation-proof suits.’)

The percentage of individuals who cannot tolerate 8 grays of radiation is 5.480.
So they will need at least 6 radiation-proof suits.

**QUESTION 2:** The number of attacks on the 100’s camp from the grounders is 65 attacks per year (with 52 weeks in a year). Assuming the number of attacks follow a Poisson distribution, what is the probability that there is at least one attack within a 4-week period?
In [3]:
mean = (65/52)*4
print(f’Mean number of attacks for a 4-week period is {mean:.2f}’)
print(f’P(no attack) = Poisson(k=0|mean={mean}) = {np.exp(-mean):.3f}’)
print(f’P(at least 1 attack) = 1 – Poisson(k=0|mean={mean}) = {1 – np.exp(-mean):.3f}’)

Mean number of attacks for a 4-week period is 5.00
P(no attack) = Poisson(k=0|mean=5.0) = 0.007
P(at least 1 attack) = 1 – Poisson(k=0|mean=5.0) = 0.993

**QUESTION 3:** Commander of the grounders is interested whether her people would support peace with the 100 or they oppose peace. The commander randomly selects 200 grounders and it turns out 83 of them support peace.

A. Construct a 95% confidence interval for the proportion of grounders who support peace with the 100. Remember to check for any necessary conditions to construct this interval.
In [4]:
s = 83
n = 200
print(f”’CHECK
(1) Indepence: Simple random sample and the fact that
{n} is less than 10% of 3000 give us independence.
(2) Success-failure: The success-failure conditions are also satisfied since
{s} and {n} – {s} are both >= 10.
”’)

p_hat = 83/n
print(f’p_hat = {p_hat}’)
std_error = (np.sqrt(p_hat*(1-p_hat)/n))
print(f’SE = (p_hat*(1-p_hat)/n)^1/2 = {std_error:.3f}’)
alpha = 0.05
z_star = norm.ppf(1 – (alpha/2))
margin_of_error = z_star * std_error
print(f’We have z* = {z_star:0.3f} and se = {std_error:0.3f}, so ME = {margin_of_error:0.3f}’)
print(f'{1-alpha}% CI: [{p_hat – margin_of_error:.3f}, {p_hat + margin_of_error:.3f}]’)

CHECK
(1) Indepence: Simple random sample and the fact that
200 is less than 10% of 3000 give us independence.
(2) Success-failure: The success-failure conditions are also satisfied since
83 and 200 – 83 are both >= 10.

p_hat = 0.415
SE = (p_hat*(1-p_hat)/n)^1/2 = 0.035
We have z* = 1.960 and se = 0.035, so ME = 0.068
0.95% CI: [0.347, 0.483]

B. The commander’s chief counsel claims that majority of the grounders oppose peace with the 100. Does this sample provide enough evidence that the chief counsel is right at a 5% significance level? Please explain. Also report a p-value. Remember to check for any necessary conditions and also make sure to state the null and alternative hypotheses where “p” denotes the probability of supporting peace.
In [5]:
print(”’PREPARE
The parameter of interest: The proportion of the grounders opposing peace with the 100
Hypotheses:
Ho: p = 0.5
Ha: p < 0.5 Significance level (alpha): %5 ''') p_o = 0.5 n = 200 p_hat = 83/n print(f'''CHECK (1) Independence: Simple random sample and the fact that {n} is less than 10% of 3000 give us independence. (2) Success-failure: The success-failure conditions are also satisfied since n*p_o = {n*p_o} and n(1-p_o) = {n*(1-p_o)} are both >= 10.
”’)

std_error_ht = (np.sqrt(p_o*(1-p_o)/n))
Z = (p_hat – p_o)/std_error_ht
print(f”’CALCULATE
Z = (p_hat – p_o)/SE = {Z:.3f}
The p-value is the Z score’s one-tail area:
p-value = norm.cdf(Z) = {norm.cdf(Z):0.3f}
”’)

print(”’CONCLUDE
Since the p-value is less than 0.05, we do REJECT the null hypothesis.
That is, majority of the grounders do not want peace with the 100.
”’)

PREPARE
The parameter of interest: The proportion of the grounders opposing peace with the 100
Hypotheses:
Ho: p = 0.5
Ha: p < 0.5 Significance level (alpha): %5 CHECK (1) Independence: Simple random sample and the fact that 200 is less than 10% of 3000 give us independence. (2) Success-failure: The success-failure conditions are also satisfied since n*p_o = 100.0 and n(1-p_o) = 100.0 are both >= 10.

CALCULATE
Z = (p_hat – p_o)/SE = -2.404
The p-value is the Z score’s one-tail area:
p-value = norm.cdf(Z) = 0.008

CONCLUDE
Since the p-value is less than 0.05, we do REJECT the null hypothesis.
That is, majority of the grounders do not want peace with the 100.