aspose file tools*
The moose likes Beginning Java and the fly likes Mean and STadard Deviation?!! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Mean and STadard Deviation?!!" Watch "Mean and STadard Deviation?!!" New topic
Author

Mean and STadard Deviation?!!

Justin Fox
Ranch Hand

Joined: Jan 24, 2006
Posts: 802
ok, i have a program that wants me to put integers entered into an array,
thats very easy.

but then it wants me to give the mean, and stadard deviant of that array also, then again not so hard.

but....the formulas a pretty....insane.

like Ex/N thats for the mean....i thought the weird E was for "sum of"...
but if this is true, then that is the same as average.

and the SD is even crazier...if someone could put it into lamens for me it would be great...thx!


You down with OOP? Yeah you know me!
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

Originally posted by Monk Fox:
...like Ex/N thats for the mean....i thought the weird E was for "sum of"...but if this is true, then that is the same as average.

That's correct. The weird E is an uppercase Sigma, for "sum of." The mean is, in fact, the arithmetic average.


"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
Adam Price
Ranch Hand

Joined: Nov 11, 2005
Posts: 95
Originally posted by Monk Fox:
ok, i have a program that wants me to put integers entered into an array,
thats very easy.

but then it wants me to give the mean, and stadard deviant of that array also, then again not so hard.

but....the formulas a pretty....insane.

like Ex/N thats for the mean....i thought the weird E was for "sum of"...
but if this is true, then that is the same as average.

and the SD is even crazier...if someone could put it into lamens for me it would be great...thx!


Some Values: 1, 3, 13, 1, 2

Mean - what most people call "average" The sum of the values divided by the number of values. With these values, Mean = 4

Median - Put all the values in order, biggest to smallest. The median is the one in the middle
With these values, Median = 2

Mode - The most common value (If you have a stuffy nose, "The /mode/ common value" Here Mode = 1

Standard Deviation - Attempts to give an indication of how far away from the mean most of the values are. Here is another set of numbers with Mean = 4 : {4, 4, 4, 4} Clearly they do not deviate very much from the mean. The way the SD is calculated is to add up the squares of all of the deviations (amount by which a particular datum varies from the mean), divide by the number of values, then take the square root. The variances are squared so that when they are added up, bigger variances really stand out and so that they are all positive. Essentially, the SD finds some "average" of the amount by which the values deviate from their collective "mean." I don't think the explanation athttp://www.med.umkc.edu/tlwbiostats/variability.html is the best I have ever seen, but it's better than mine, plus it spells out the formula in layman's terms.

The wikipedia article http://en.wikipedia.org/wiki/Standard_deviation is also good reading. In particular, read the paragraph headed "Interpretation and Application."
HTH
[ January 26, 2006: Message edited by: Adam Price ]
Justin Fox
Ranch Hand

Joined: Jan 24, 2006
Posts: 802
omg sweet arse....ya'll are the best ya hear....
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

Suppose you have 3 numbers: 1, 3, and 8. The mean (m) is (1+3+8)/3 = 4.

Then for standard deviation...

26/n = 26/3 which is about 8.7. And the square root of 8.7 is about 2.95. That's the standard deviation.
Adam Price
Ranch Hand

Joined: Nov 11, 2005
Posts: 95
Originally posted by marc weber:
Suppose you have 3 numbers: 1, 3, and 8. The mean (m) is (1+3+8)/3 = 4.

26/n = 26/3 which is about 8.7. And the square root of 8.7 is about 2.95. That's the standard deviation.


Nice, Mark....
Let's try it with my set: 1, 3, 13, 1, 2
Then for standard deviation...

104/n = 104/5 which is 20.8. And the square root of 20.8 is about 4.56. That's the standard deviation. From this we see that although the average number of fish per tank is the same in my aquarium and in Mark's, the standard deviation is greater in mine. If you put exactly enough food for four fish (the average number) in every tank, more would die in my tanks from either starvation or exploding bellies than would die in Mark's tanks.
Adam Richards
Ranch Hand

Joined: Nov 03, 2005
Posts: 135
Click here for additional resources.
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
I inherited a spreadsheet where someone computed the average absolute value of the delta from one row to the next. For five rows you'd have four deltas. This looks similar to SD without doing the squaring bit to emphasize the furthest out. Since you guys did so well on the standard deviation question, I wondered if you know the name for this thing he did?

Edit: I found this was used in a report he called "Six Sigma-like". A little different because it's ... wrong.
[ January 27, 2006: Message edited by: Stan James ]

A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
Jeff Albertson
Ranch Hand

Joined: Sep 16, 2005
Posts: 1780
Sounds like Taxicab geometry: en.wikipedia.org/wiki/Norm_(mathematics)


There is no emoticon for what I am feeling!
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18570
    
    8

Originally posted by Stan James:
This looks similar to SD without doing the squaring bit to emphasize the furthest out. Since you guys did so well on the standard deviation question, I wondered if you know the name for this thing he did?[ January 27, 2006: Message edited by: Stan James ]
Variance.
Adam Price
Ranch Hand

Joined: Nov 11, 2005
Posts: 95
Variance - That was my first thought, also, but it isn't quite right - Variance would include the squaring, just not the square root.

Taxicab math - hmm - I am not seeing the relationship?


Do I understand correctly that you're talking about something like this?


This seems to me like (depending on what the field of application is) either the geometric growth factor, the "rate of change" or the slope of the graph. In my example,
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
Yeah, that's the algorithm. You didn't have a negative delta in your example to show he used abs(delta) but that's still it. I think he was trying to do six sigma and got sorta close. I ran this side by side with stdev() in Excel just to see how much more sentitive stdev() is to wider variations. Quite a lot.
Adam Price
Ranch Hand

Joined: Nov 11, 2005
Posts: 95
Originally posted by Stan James:
Yeah, that's the algorithm. You didn't have a negative delta in your example to show he used abs(delta) but that's still it. I think he was trying to do six sigma and got sorta close. I ran this side by side with stdev() in Excel just to see how much more sentitive stdev() is to wider variations. Quite a lot.


Yeah - it would still be the average rate of change (slope of the regression line) - it would just be a less accurate one. This sort of algorithm is used when you want to extrapolate beyond your actual observed data. My numbers float around a little bit, but not much, so we would be pretty confident tat we could make a good prediction at what the value would be at line number 239. If we had had some negative values included, we would would make the same guess, but be less confident that it is right. There are better ways of finding this slope - i.e. http://people.hofstra.edu/faculty/Stefan_Waner/calctopic1/regression.html
[ January 28, 2006: Message edited by: Adam Price ]
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Mean and STadard Deviation?!!