document.write( "Question 1167889: The Democrat and Chronicle reported that 25% of the flights arriving at the San Diego airport during the
\n" ); document.write( "first five months of 2001 were late (Democrat and Chronicle, July 23, 2001). Assume the population
\n" ); document.write( "proportion is p .25.
\n" ); document.write( "a. Show the sampling distribution of , the proportion of late flights in a sample of 1000 flights.
\n" ); document.write( "b. What is the probability that the sample proportion will be within .03 of the population proportion if a
\n" ); document.write( "sample of size 1000 is selected?
\n" ); document.write( "c. Answer part (b) for a sample of 500 flights.
\n" ); document.write( "

Algebra.Com's Answer #852083 by CPhill(1959)\"\" \"About 
You can put this solution on YOUR website!
```python?code_reference&code_event_index=2
\n" ); document.write( "import math
\n" ); document.write( "from scipy.stats import norm\r
\n" ); document.write( "\n" ); document.write( "# Population proportion
\n" ); document.write( "p = 0.25\r
\n" ); document.write( "\n" ); document.write( "# --- Part a: Sampling distribution for n = 1000 ---
\n" ); document.write( "n_a = 1000
\n" ); document.write( "mean_p_bar_a = p
\n" ); document.write( "std_dev_p_bar_a = math.sqrt((p * (1 - p)) / n_a)\r
\n" ); document.write( "\n" ); document.write( "# Check for normality assumption
\n" ); document.write( "np_a = n_a * p
\n" ); document.write( "n_1_minus_p_a = n_a * (1 - p)\r
\n" ); document.write( "\n" ); document.write( "print(f\"Part a (n={n_a}):\")
\n" ); document.write( "print(f\" Mean of p_bar: {mean_p_bar_a}\")
\n" ); document.write( "print(f\" Standard deviation of p_bar: {std_dev_p_bar_a}\")
\n" ); document.write( "print(f\" np >= 5: {np_a} >= 5 (True)\")
\n" ); document.write( "print(f\" n(1-p) >= 5: {n_1_minus_p_a} >= 5 (True)\")\r
\n" ); document.write( "\n" ); document.write( "# --- Part b: Probability for n = 1000 ---
\n" ); document.write( "diff = 0.03
\n" ); document.write( "lower_bound_b = p - diff
\n" ); document.write( "upper_bound_b = p + diff\r
\n" ); document.write( "\n" ); document.write( "# Calculate Z-scores
\n" ); document.write( "z_lower_b = (lower_bound_b - p) / std_dev_p_bar_a
\n" ); document.write( "z_upper_b = (upper_bound_b - p) / std_dev_p_bar_a\r
\n" ); document.write( "\n" ); document.write( "# Calculate probability using CDF
\n" ); document.write( "probability_b = norm.cdf(z_upper_b) - norm.cdf(z_lower_b)\r
\n" ); document.write( "\n" ); document.write( "print(f\"\nPart b (n={n_a}):\")
\n" ); document.write( "print(f\" Range: [{lower_bound_b}, {upper_bound_b}]\")
\n" ); document.write( "print(f\" Z-score for lower bound: {z_lower_b}\")
\n" ); document.write( "print(f\" Z-score for upper bound: {z_upper_b}\")
\n" ); document.write( "print(f\" Probability: {probability_b}\")\r
\n" ); document.write( "\n" ); document.write( "# --- Part c: Probability for n = 500 ---
\n" ); document.write( "n_c = 500
\n" ); document.write( "std_dev_p_bar_c = math.sqrt((p * (1 - p)) / n_c)\r
\n" ); document.write( "\n" ); document.write( "# Check for normality assumption
\n" ); document.write( "np_c = n_c * p
\n" ); document.write( "n_1_minus_p_c = n_c * (1 - p)\r
\n" ); document.write( "\n" ); document.write( "# Calculate Z-scores
\n" ); document.write( "z_lower_c = (lower_bound_b - p) / std_dev_p_bar_c
\n" ); document.write( "z_upper_c = (upper_bound_b - p) / std_dev_p_bar_c\r
\n" ); document.write( "\n" ); document.write( "# Calculate probability using CDF
\n" ); document.write( "probability_c = norm.cdf(z_upper_c) - norm.cdf(z_lower_c)\r
\n" ); document.write( "\n" ); document.write( "print(f\"\nPart c (n={n_c}):\")
\n" ); document.write( "print(f\" Standard deviation of p_bar: {std_dev_p_bar_c}\")
\n" ); document.write( "print(f\" np >= 5: {np_c} >= 5 (True)\")
\n" ); document.write( "print(f\" n(1-p) >= 5: {n_1_minus_p_c} >= 5 (True)\")
\n" ); document.write( "print(f\" Z-score for lower bound: {z_lower_c}\")
\n" ); document.write( "print(f\" Z-score for upper bound: {z_upper_c}\")
\n" ); document.write( "print(f\" Probability: {probability_c}\")
\n" ); document.write( "```\r
\n" ); document.write( "\n" ); document.write( "```text?code_stdout&code_event_index=2
\n" ); document.write( "Part a (n=1000):
\n" ); document.write( " Mean of p_bar: 0.25
\n" ); document.write( " Standard deviation of p_bar: 0.013693063937629153
\n" ); document.write( " np >= 5: 250.0 >= 5 (True)
\n" ); document.write( " n(1-p) >= 5: 750.0 >= 5 (True)\r
\n" ); document.write( "\n" ); document.write( "Part b (n=1000):
\n" ); document.write( " Range: [0.22, 0.28]
\n" ); document.write( " Z-score for lower bound: -2.1908902300206643
\n" ); document.write( " Z-score for upper bound: 2.1908902300206665
\n" ); document.write( " Probability: 0.9715402630836895\r
\n" ); document.write( "\n" ); document.write( "Part c (n=500):
\n" ); document.write( " Standard deviation of p_bar: 0.019364916731037084
\n" ); document.write( " np >= 5: 125.0 >= 5 (True)
\n" ); document.write( " n(1-p) >= 5: 375.0 >= 5 (True)
\n" ); document.write( " Z-score for lower bound: -1.5491933384829668
\n" ); document.write( " Z-score for upper bound: 1.5491933384829681
\n" ); document.write( " Probability: 0.878664749641518\r
\n" ); document.write( "\n" ); document.write( "```\r
\n" ); document.write( "\n" ); document.write( "The population proportion of late flights is $p = 0.25$.\r
\n" ); document.write( "\n" ); document.write( "**a. Show the sampling distribution of $\\bar{p}$, the proportion of late flights in a sample of 1000 flights.**\r
\n" ); document.write( "\n" ); document.write( "For a sample of size $n=1000$:\r
\n" ); document.write( "\n" ); document.write( " * **Mean of the sampling distribution ($E(\\bar{p})$):**
\n" ); document.write( " $E(\\bar{p}) = p = 0.25$\r
\n" ); document.write( "\n" ); document.write( " * **Standard deviation of the sampling distribution ($\\sigma\_{\\bar{p}}$):**
\n" ); document.write( " $\\sigma\_{\\bar{p}} = \\sqrt{\\frac{p(1-p)}{n}} = \\sqrt{\\frac{0.25(1-0.25)}{1000}} = \\sqrt{\\frac{0.25 \\times 0.75}{1000}} = \\sqrt{\\frac{0.1875}{1000}} = \\sqrt{0.0001875} \\approx 0.01369$\r
\n" ); document.write( "\n" ); document.write( " * **Shape of the sampling distribution:**
\n" ); document.write( " To determine the shape, we check if $np \\ge 5$ and $n(1-p) \\ge 5$.
\n" ); document.write( " $np = 1000 \\times 0.25 = 250$
\n" ); document.write( " $n(1-p) = 1000 \\times 0.75 = 750$
\n" ); document.write( " Since both $250 \\ge 5$ and $750 \\ge 5$, the sampling distribution of $\\bar{p}$ is **approximately normal**.\r
\n" ); document.write( "\n" ); document.write( "**Summary of Sampling Distribution for $n=1000$:**\r
\n" ); document.write( "\n" ); document.write( " * **Mean:** $0.25$
\n" ); document.write( " * **Standard Deviation:** Approximately $0.01369$
\n" ); document.write( " * **Shape:** Approximately Normal\r
\n" ); document.write( "\n" ); document.write( "**b. What is the probability that the sample proportion will be within .03 of the population proportion if a sample of size 1000 is selected?**\r
\n" ); document.write( "\n" ); document.write( "We want to find $P(p - 0.03 \\le \\bar{p} \\le p + 0.03)$, which is $P(0.25 - 0.03 \\le \\bar{p} \\le 0.25 + 0.03) = P(0.22 \\le \\bar{p} \\le 0.28)$.\r
\n" ); document.write( "\n" ); document.write( "We use the Z-score formula: $Z = \\frac{\\bar{p} - p}{\\sigma\_{\\bar{p}}}$\r
\n" ); document.write( "\n" ); document.write( "For $\\bar{p} = 0.22$:
\n" ); document.write( "$Z\_{lower} = \\frac{0.22 - 0.25}{0.01369} = \\frac{-0.03}{0.01369} \\approx -2.191$\r
\n" ); document.write( "\n" ); document.write( "For $\\bar{p} = 0.28$:
\n" ); document.write( "$Z\_{upper} = \\frac{0.28 - 0.25}{0.01369} = \\frac{0.03}{0.01369} \\approx 2.191$\r
\n" ); document.write( "\n" ); document.write( "Now, we find the probability $P(-2.191 \\le Z \\le 2.191)$:
\n" ); document.write( "$P(Z \\le 2.191) - P(Z \\le -2.191)$
\n" ); document.write( "Using a standard normal table or calculator:
\n" ); document.write( "$P(Z \\le 2.191) \\approx 0.9857$
\n" ); document.write( "$P(Z \\le -2.191) \\approx 0.0143$
\n" ); document.write( "Probability $= 0.9857 - 0.0143 = 0.9714$.\r
\n" ); document.write( "\n" ); document.write( "The probability that the sample proportion will be within $0.03$ of the population proportion for a sample of size 1000 is approximately $\\boxed{0.9715}$.\r
\n" ); document.write( "\n" ); document.write( "**c. Answer part (b) for a sample of 500 flights.**\r
\n" ); document.write( "\n" ); document.write( "For a sample of size $n=500$:\r
\n" ); document.write( "\n" ); document.write( " * **Standard deviation of the sampling distribution ($\\sigma\_{\\bar{p}}$):**
\n" ); document.write( " $\\sigma\_{\\bar{p}} = \\sqrt{\\frac{p(1-p)}{n}} = \\sqrt{\\frac{0.25(1-0.25)}{500}} = \\sqrt{\\frac{0.1875}{500}} = \\sqrt{0.000375} \\approx 0.01936$\r
\n" ); document.write( "\n" ); document.write( "We want to find $P(0.22 \\le \\bar{p} \\le 0.28)$ with the new standard deviation.\r
\n" ); document.write( "\n" ); document.write( "For $\\bar{p} = 0.22$:
\n" ); document.write( "$Z\_{lower} = \\frac{0.22 - 0.25}{0.01936} = \\frac{-0.03}{0.01936} \\approx -1.549$\r
\n" ); document.write( "\n" ); document.write( "For $\\bar{p} = 0.28$:
\n" ); document.write( "$Z\_{upper} = \\frac{0.28 - 0.25}{0.01936} = \\frac{0.03}{0.01936} \\approx 1.549$\r
\n" ); document.write( "\n" ); document.write( "Now, we find the probability $P(-1.549 \\le Z \\le 1.549)$:
\n" ); document.write( "$P(Z \\le 1.549) - P(Z \\le -1.549)$
\n" ); document.write( "Using a standard normal table or calculator:
\n" ); document.write( "$P(Z \\le 1.549) \\approx 0.9393$
\n" ); document.write( "$P(Z \\le -1.549) \\approx 0.0607$
\n" ); document.write( "Probability $= 0.9393 - 0.0607 = 0.8786$.\r
\n" ); document.write( "\n" ); document.write( "The probability that the sample proportion will be within $0.03$ of the population proportion for a sample of size 500 is approximately $\\boxed{0.8787}$.
\n" ); document.write( "
\n" );