document.write( "Question 1166050: Question#1
\n" ); document.write( "Following is the sales (in thousands) of salesmen, calculate mean and standard deviation and discuss which salesman performed consistently.
\n" ); document.write( "Salesman1 4 6 5 7 8 11 6 8 10
\n" ); document.write( "Salesman2 26 1 13 1 10 30 4 0 1\r
\n" ); document.write( "\n" ); document.write( "Question#2
\n" ); document.write( "Calculate mean, median and mode of following data.
\n" ); document.write( "Class Interval 1 to 10 11 to 20 21 to 30 31 to 40 41 to 50
\n" ); document.write( "Frequency 6 8 12 14
\n" ); document.write( "
\n" ); document.write( "

Algebra.Com's Answer #852870 by CPhill(2189)\"\" \"About 
You can put this solution on YOUR website!
```python?code_reference&code_event_index=2
\n" ); document.write( "import numpy as np
\n" ); document.write( "import pandas as pd\r
\n" ); document.write( "\n" ); document.write( "# Question 1 Data (Sales in thousands)
\n" ); document.write( "salesman1 = np.array([4, 6, 5, 7, 8, 11, 6, 8, 10])
\n" ); document.write( "salesman2 = np.array([26, 1, 13, 1, 10, 30, 4, 0, 1])\r
\n" ); document.write( "\n" ); document.write( "# Calculate Mean (average)
\n" ); document.write( "mean1 = np.mean(salesman1)
\n" ); document.write( "mean2 = np.mean(salesman2)\r
\n" ); document.write( "\n" ); document.write( "# Calculate Standard Deviation (using sample standard deviation, ddof=1)
\n" ); document.write( "std1 = np.std(salesman1, ddof=1)
\n" ); document.write( "std2 = np.std(salesman2, ddof=1)\r
\n" ); document.write( "\n" ); document.write( "print(f\"Salesman 1 Mean: {mean1}\")
\n" ); document.write( "print(f\"Salesman 1 Standard Deviation: {std1}\")
\n" ); document.write( "print(f\"Salesman 2 Mean: {mean2}\")
\n" ); document.write( "print(f\"Salesman 2 Standard Deviation: {std2}\")\r
\n" ); document.write( "\n" ); document.write( "```\r
\n" ); document.write( "\n" ); document.write( "```text?code_stdout&code_event_index=2
\n" ); document.write( "Salesman 1 Mean: 7.222222222222222
\n" ); document.write( "Salesman 1 Standard Deviation: 2.279132388529557
\n" ); document.write( "Salesman 2 Mean: 9.555555555555555
\n" ); document.write( "Salesman 2 Standard Deviation: 11.413929112175953\r
\n" ); document.write( "\n" ); document.write( "```\r
\n" ); document.write( "\n" ); document.write( "## Question \#1: Sales Consistency\r
\n" ); document.write( "\n" ); document.write( "To assess consistency, we calculate the **mean** and **standard deviation ($s$)** for each salesman. The standard deviation measures the dispersion of the sales data around the mean; a **lower standard deviation indicates greater consistency**.\r
\n" ); document.write( "\n" ); document.write( "| Statistic | Salesman 1 | Salesman 2 |
\n" ); document.write( "| :---: | :---: | :---: |
\n" ); document.write( "| **Mean ($\bar{X}$)** | $7.22$ (thousand) | $9.56$ (thousand) |
\n" ); document.write( "| **Standard Deviation ($s$)** | $\mathbf{2.28}$ (thousand) | $\mathbf{11.41}$ (thousand) |\r
\n" ); document.write( "\n" ); document.write( "-----\r
\n" ); document.write( "\n" ); document.write( "### Discussion on Consistency\r
\n" ); document.write( "\n" ); document.write( "1. **Salesman 1** has a mean sales of **$7,220** with a standard deviation of **$2,280**.
\n" ); document.write( "2. **Salesman 2** has a higher mean sales of **$9,560** but a much larger standard deviation of **$11,410**.\r
\n" ); document.write( "\n" ); document.write( "**Conclusion:**\r
\n" ); document.write( "\n" ); document.write( "**Salesman 1 performed more consistently**. Although Salesman 2 achieved a higher average sale, the high standard deviation indicates that their sales were highly volatile, ranging from 0 to 30 thousand. Salesman 1's sales were tightly clustered around their mean, showing a more predictable and stable performance.\r
\n" ); document.write( "\n" ); document.write( "-----\r
\n" ); document.write( "\n" ); document.write( "## Question \#2: Mean, Median, and Mode for Grouped Data\r
\n" ); document.write( "\n" ); document.write( "The following calculations are based on the four class intervals for which frequency data is provided.\r
\n" ); document.write( "\n" ); document.write( "| Class Interval | Frequency ($f$) | Midpoint ($x_m$) | $f \cdot x_m$ | Cumulative Frequency ($C$) |
\n" ); document.write( "| :---: | :---: | :---: | :---: | :---: |
\n" ); document.write( "| 1 to 10 | 6 | 5.5 | 33.0 | 6 |
\n" ); document.write( "| 11 to 20 | 8 | 15.5 | 124.0 | 14 |
\n" ); document.write( "| 21 to 30 | 12 | 25.5 | 306.0 | 26 |
\n" ); document.write( "| 31 to 40 | 14 | 35.5 | 497.0 | 40 |
\n" ); document.write( "| **Totals** | $\mathbf{N=40}$ | | $\mathbf{\sum f x_m = 960.0}$ | |
\n" ); document.write( "$$\text{Class Width } (h) = 10 \text{ (e.g., } 10 - 1 + 1 \text{ or } 10.5 - 0.5 \text{)}$$\r
\n" ); document.write( "\n" ); document.write( "### 1\. Mean ($\bar{X}$)\r
\n" ); document.write( "\n" ); document.write( "The mean for grouped data is calculated as $\bar{X} = \frac{\sum f x_m}{N}$.
\n" ); document.write( "$$\bar{X} = \frac{960.0}{40} = \mathbf{24.0}$$\r
\n" ); document.write( "\n" ); document.write( "### 2\. Median ($M$)\r
\n" ); document.write( "\n" ); document.write( "The median is the value that splits the data in half. $N/2 = 40/2 = 20$.
\n" ); document.write( "The **median class** is the class where $C$ first exceeds 20, which is **21 to 30** ($C=26$).\r
\n" ); document.write( "\n" ); document.write( "$$\text{Median Formula: } M = L + \left(\frac{\frac{N}{2} - C}{f}\right) \times h$$
\n" ); document.write( "Where:\r
\n" ); document.write( "\n" ); document.write( " * $L$ (Lower boundary of median class) = 20.5
\n" ); document.write( " * $N/2 = 20$
\n" ); document.write( " * $C$ (Cumulative frequency of preceding class) = 14
\n" ); document.write( " * $f$ (Frequency of median class) = 12
\n" ); document.write( " * $h$ (Class width) = 10\r
\n" ); document.write( "\n" ); document.write( "$$M = 20.5 + \left(\frac{20 - 14}{12}\right) \times 10$$
\n" ); document.write( "$$M = 20.5 + \left(\frac{6}{12}\right) \times 10$$
\n" ); document.write( "$$M = 20.5 + 5 = \mathbf{25.5}$$\r
\n" ); document.write( "\n" ); document.write( "### 3\. Mode ($Mo$)\r
\n" ); document.write( "\n" ); document.write( "The **modal class** is the class with the highest frequency, which is **31 to 40** ($f_m=14$).\r
\n" ); document.write( "\n" ); document.write( "$$\text{Mode Formula: } Mo = L + \left(\frac{f_m - f_1}{2f_m - f_1 - f_2}\right) \times h$$
\n" ); document.write( "Where:\r
\n" ); document.write( "\n" ); document.write( " * $L$ (Lower boundary of modal class) = 30.5
\n" ); document.write( " * $f_m$ (Frequency of modal class) = 14
\n" ); document.write( " * $f_1$ (Frequency of preceding class) = 12
\n" ); document.write( " * $f_2$ (Frequency of succeeding class) = 0 (Assuming $f$ for 41-50 is 0)
\n" ); document.write( " * $h$ (Class width) = 10\r
\n" ); document.write( "\n" ); document.write( "$$Mo = 30.5 + \left(\frac{14 - 12}{2(14) - 12 - 0}\right) \times 10$$
\n" ); document.write( "$$Mo = 30.5 + \left(\frac{2}{28 - 12}\right) \times 10$$
\n" ); document.write( "$$Mo = 30.5 + \left(\frac{2}{16}\right) \times 10$$
\n" ); document.write( "$$Mo = 30.5 + 1.25 = \mathbf{31.75}$$
\n" ); document.write( "
\n" );