mean and standard deviation confused

Reply

Join Date: Oct 2009
Posts: 15
Reputation: kulrik is an unknown quantity at this point 
Solved Threads: 0
kulrik kulrik is offline Offline
Newbie Poster

mean and standard deviation confused

 
0
  #1
16 Days Ago
I am really confused by this problem. PLEASE HELP

Write a program that reads a set of floating point data values from the input. When the user indicates the end of the input, print out the count if the values, the average, and the standard deviation. The average of a data set is x1,......,xn is

t = Σxi/n

where Σx1 = x1+...+xn is the sum of the input values. The standard deviation is:

s=Math.sqrt(Σxi^2 - (1/n)*(Σxi)^2/n-1)

my professor asks me to Create a method in the class Mymath to print out the count of values, the average, and the standard deviation. Use the numerically less stable formula to find the standard deviation.

and this is what the output should be:

1
2
3
4
5
6
-1

Count of values: 6
Average: 3.50
Standard Deviation: 1.87
Reply With Quote Quick reply to this message  
Join Date: Sep 2008
Posts: 1,560
Reputation: BestJewSinceJC is a name known to all BestJewSinceJC is a name known to all BestJewSinceJC is a name known to all BestJewSinceJC is a name known to all BestJewSinceJC is a name known to all BestJewSinceJC is a name known to all 
Solved Threads: 196
BestJewSinceJC BestJewSinceJC is offline Offline
Posting Virtuoso
 
0
  #2
16 Days Ago
So which part are you confused about? Reading in the values? Calculating the formulas? The formulas are standard formulas, so if you don't get them, just look up those terms on google and you'll find plenty of explanations. Your professor didn't make those up. And to read in the values, you can make a Scanner. Test each value read in; if it is -1, stop reading in values, and do not include the -1 value in your calculations. So you'll basically be using a while loop to read in all the values, then adding them to an ArrayList<Integer>.
Out.
Reply With Quote Quick reply to this message  
Join Date: Oct 2009
Posts: 15
Reputation: kulrik is an unknown quantity at this point 
Solved Threads: 0
kulrik kulrik is offline Offline
Newbie Poster
 
0
  #3
16 Days Ago
im just confused on how to do it. i guess i need a jump start thats all.
Reply With Quote Quick reply to this message  
Join Date: Jan 2008
Posts: 3,810
Reputation: VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute 
Solved Threads: 501
Featured Poster
VernonDozier VernonDozier is offline Offline
Senior Poster
 
0
  #4
16 Days Ago
  1. Get the count
  2. Calculate the sum
  3. From the count and the sum, calculate the average.
  4. From the average, get each deviation (error).
  5. Square each deviation (squared error).
  6. Add up the squares (sum of squared errors).
  7. Divide by (count - 1) (mean squared error. count - 1 is degrees of freedom).
  8. Take the square root.
  9. You now have the standard deviation.


Slightly different formula/method than the one you listed, but if you do some math, I imagine you'll find that they are equivalent and will give identical results.
Last edited by VernonDozier; 16 Days Ago at 3:04 pm.
Reply With Quote Quick reply to this message  
Reply

Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC