Answered step by step
Verified Expert Solution
Question
1 Approved Answer
The Standard Deviation is a measure of how spread out numbers are from the normal. The symbol for Standard Deviation is sigma (sigma), which has
The Standard Deviation is a measure of how spread out numbers are from the normal. The symbol for Standard Deviation is sigma (sigma), which has the following: sigma = Squareroot 1/N sigma^N_i = 1 (x_i - mu)^2 To calculate the standard deviation of those numbers: 1. Work out the Mean mu (the simple average of the numbers) 2. Then for each number: subtract the Mean and square the result 3. Then work out the mean of those squared differences. 4. Take the squareroot of that and we are done! Example: A 20 students took a C++ quiz in which they scored the following grades: 9, 2, 5, 4, 12, 7, 8. 11, 9, 3, 7, 4, 12 5, 4, 10, 9, 6, 9, and 4. find the Standard Deviation. Step 1. Work out the mean, in the formula above mu is the mean of all our values. The mean is mu = 9 + 2 + 5 + 4 + 12 + 7 + 8 + 11 + 9 + 3 + 7 + 4 + 12 + 5 + 4 + 10 + 9 + 6 + 9 + 420 = 140/20 7. Step 2. Then for each number: subtract the Mean and square the result. This is the part of the formula that says: (x_i - mu)^2 subtract the mean and square the result", like this (9-7)^2 - (2)^2 = 4 (11 - 7)^2 = (4)^2 = 16 (4 - 7)^3 = (3)^2 = 9 (2 - 7)^2 = (-5)^2 = 25 (9 - 7)^2 = (2)^2 = 4 (9 - 7)^2 = (2)^2 = 4 (5 - 7)^2 = (-2)^2 = 9 (3-7) (4)^2 = 16 (9 - 7)^2 = (2)^2 = 4 (4 - 7)^2 = (-3)^2 = 9 (7 - 7)^2 = (0)^2 = 0 (6 - 7)^2 = (1)^2 = 1 (12 - 7)^2 = (5)^2 = 25 (4 - 7)^2 = (3)^2 = 9 (9 - 7)^2 = (2) = 4 (7 - 7)^2 = (0)^2 = 0 (12 - 7)^2 = (5)^2 = 25 (4 - 7)^2 = (3)^2 = 9 (8 - 7)^2 = (1)^2 = 1 (5 - 7)^2 = (2)^2 = 4 Step 3. Then work out the mean of those squared differences. To work out the mean, add up all the values then divide by how many. First add up all the values from the previous step. We want to add up all the values from 1 to N, where N = 20 in our case because there are 20 values: Example (continued): sigma^N_i = 1 (x_i - mu)^2 Which means: Sum all values from (X_1 - 7)^2 to (X_N - 7)^2 We already calculated (X_1 - 7)^2 = 4 etc. in the previous step, so just sum them up: = 4 + 25 + 4 + 9 + 25 + 0 + 1 + 16 + 4 + 16 + 0 + 9 + 25 + 4 + 9 + 9 + 4 + 1 + 4 + 9 = 178 But that t the mean yet, we need to divide by how many, which is simply done by multiplying by "1/N": Example (continued): 1/N sigma^N_i = 1 (x_i - mu)^2 Mean of squared differences = (1/20) times 178 = 8.9 Step 4. Take the squareroot of that to find the Standard Deviation: sigma = Squareroot (8.9) = 2.983 Lab Assignment: 1. Write a complete C++ program that calculates Standard Deviation using data from input file called: grades.txt. 2. Use data in the example above to populate the data file: grades.txt 3. Output the average and the standard deviation to an external file called: results.txt. 6. Increase your program modularity by implementing functions so the main contains only function calls
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started