document.write( "Question 1163253: Consider the following hypotheses:
\n" ); document.write( "H0: μ = 73
\n" ); document.write( "HA: μ ≠ 73\r
\n" ); document.write( "
\n" ); document.write( "\n" ); document.write( "Find the p-value for this test based on the following sample information. (You may find it useful to reference the appropriate table: z table or t table)\r
\n" ); document.write( "
\n" ); document.write( "\n" ); document.write( "a. x¯= 70; s = 6.9; n = 35
\n" ); document.write( "b. x¯ = 76; s = 6.9; n = 35
\n" ); document.write( "c. x¯ = 70; s = 6.4; n = 19
\n" ); document.write( "d. x¯ = 70; s = 6.4; n = 24
\n" ); document.write( "
\n" ); document.write( "

Algebra.Com's Answer #854383 by CPhill(2264)\"\" \"About 
You can put this solution on YOUR website!
```python?code_reference&code_event_index=2
\n" ); document.write( "import scipy.stats as stats
\n" ); document.write( "import numpy as np\r
\n" ); document.write( "\n" ); document.write( "def calculate_p_value(x_bar, s, n, mu_0=73):
\n" ); document.write( " t_stat = (x_bar - mu_0) / (s / np.sqrt(n))
\n" ); document.write( " df = n - 1
\n" ); document.write( " # Two-tailed test
\n" ); document.write( " p_value = 2 * (1 - stats.t.cdf(abs(t_stat), df))
\n" ); document.write( " return t_stat, p_value\r
\n" ); document.write( "\n" ); document.write( "# Case a
\n" ); document.write( "ta, pa = calculate_p_value(70, 6.9, 35)
\n" ); document.write( "# Case b
\n" ); document.write( "tb, pb = calculate_p_value(76, 6.9, 35)
\n" ); document.write( "# Case c
\n" ); document.write( "tc, pc = calculate_p_value(70, 6.4, 19)
\n" ); document.write( "# Case d
\n" ); document.write( "td, pd = calculate_p_value(70, 6.4, 24)\r
\n" ); document.write( "\n" ); document.write( "print(f\"a: t = {ta:.4f}, p-value = {pa:.4f}\")
\n" ); document.write( "print(f\"b: t = {tb:.4f}, p-value = {pb:.4f}\")
\n" ); document.write( "print(f\"c: t = {tc:.4f}, p-value = {pc:.4f}\")
\n" ); document.write( "print(f\"d: t = {td:.4f}, p-value = {pd:.4f}\")\r
\n" ); document.write( "
\n" ); document.write( "\n" ); document.write( "```
\n" ); document.write( "```text?code_stdout&code_event_index=2
\n" ); document.write( "a: t = -2.5722, p-value = 0.0146
\n" ); document.write( "b: t = 2.5722, p-value = 0.0146
\n" ); document.write( "c: t = -2.0432, p-value = 0.0560
\n" ); document.write( "d: t = -2.2964, p-value = 0.0311\r
\n" ); document.write( "\n" ); document.write( "```
\n" ); document.write( "To find the p-values for these two-tailed hypothesis tests, we use the $t$-test because the population standard deviation is unknown and the sample standard deviation ($s$) is provided.\r
\n" ); document.write( "\n" ); document.write( "The test statistic is calculated as:
\n" ); document.write( "$$t = \frac{\bar{x} - \mu_0}{s/\sqrt{n}}$$
\n" ); document.write( "The degrees of freedom are $df = n - 1$. Since it is a two-tailed test ($H_A: \mu \neq 73$), the p-value is $2 \times P(T > |t|)$.\r
\n" ); document.write( "\n" ); document.write( "### a. $\bar{x} = 70, s = 6.9, n = 35$
\n" ); document.write( "* **Test Statistic ($t$):** $\frac{70 - 73}{6.9/\sqrt{35}} \approx -2.572$
\n" ); document.write( "* **Degrees of Freedom:** $35 - 1 = 34$
\n" ); document.write( "* **p-value:** $P(T < -2.572) + P(T > 2.572) \approx \mathbf{0.0146}$\r
\n" ); document.write( "\n" ); document.write( "### b. $\bar{x} = 76, s = 6.9, n = 35$
\n" ); document.write( "* **Test Statistic ($t$):** $\frac{76 - 73}{6.9/\sqrt{35}} \approx 2.572$
\n" ); document.write( "* **Degrees of Freedom:** $35 - 1 = 34$
\n" ); document.write( "* **p-value:** $P(T < -2.572) + P(T > 2.572) \approx \mathbf{0.0146}$
\n" ); document.write( "*(Note: Because the distance from the mean is the same as in part 'a', the p-value is identical.)*\r
\n" ); document.write( "\n" ); document.write( "### c. $\bar{x} = 70, s = 6.4, n = 19$
\n" ); document.write( "* **Test Statistic ($t$):** $\frac{70 - 73}{6.4/\sqrt{19}} \approx -2.043$
\n" ); document.write( "* **Degrees of Freedom:** $19 - 1 = 18$
\n" ); document.write( "* **p-value:** $2 \times P(T > 2.043) \approx \mathbf{0.0560}$\r
\n" ); document.write( "\n" ); document.write( "### d. $\bar{x} = 70, s = 6.4, n = 24$
\n" ); document.write( "* **Test Statistic ($t$):** $\frac{70 - 73}{6.4/\sqrt{24}} \approx -2.296$
\n" ); document.write( "* **Degrees of Freedom:** $24 - 1 = 23$
\n" ); document.write( "* **p-value:** $2 \times P(T > 2.296) \approx \mathbf{0.0311}$
\n" ); document.write( "
\n" );