| | |
mean and standard deviation confused
![]() |
•
•
Join Date: Oct 2009
Posts: 15
Reputation:
Solved Threads: 0
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
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
•
•
Join Date: Sep 2008
Posts: 1,560
Reputation:
Solved Threads: 196
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.
•
•
Join Date: Jan 2008
Posts: 3,810
Reputation:
Solved Threads: 501
0
#4 16 Days Ago
- Get the count
- Calculate the sum
- From the count and the sum, calculate the average.
- From the average, get each deviation (error).
- Square each deviation (squared error).
- Add up the squares (sum of squared errors).
- Divide by (count - 1) (mean squared error. count - 1 is degrees of freedom).
- Take the square root.
- 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.
![]() |
Similar Threads
- Standard deviation method (Java)
- Array problem in standard deviation program (C++)
- need a little help with standard deviation (C)
- need a little help with standard deviation (C++)
- C++ help for Standard deviation (C++)
Other Threads in the Java Forum
- Previous Thread: Threads en servidor de mensajes instantáneos.
- Next Thread: problem with date class
| Thread Tools | Search this Thread |
account android api applet application array arrays automation bidirectional binary birt bluetooth class classes client code columns component constructor database designadrawingapplicationusingjavajslider draw eclipse error errors exception expand fractal game givemetehcodez graphics gui guidancer homework html ide image inetaddress inheritance integer intellij j2me java javamicroeditionuseofmotionsensor javaprojects jlabel jme jni jpanel jtextfield jtree julia linux list loop map method methods midlethttpconnection mobile mobiledevelopmentcreatejar monitoring myaggfun netbeans newbie nullpointerexception open-source oracle plazmic print problem program project property recursion ria scanner search server set sharepoint smart sms smsspam sort sourcelabs splash sql sqlite static string subclass support swing testautomation threads tree unlimited webservices windows






