Recover Password

Or login with:

  • Facebookhttp://facebook.com/
  • Googlehttps://www.google.com/accounts/o8/id
  • Yahoohttp://yahoo.com/
get GPL
COST (GBP)
this unit 0.20
sub units 1.00
add licence
0

Standard Deviation

Calculates the standard deviation of a given population.
Controller: CodeCogs

buy now get GPL add to cart

Dependents

Info

Interface

C++

Stdev

 
template<class T> doublestdevintn
T*data
booltotal = false )
The standard deviation \sigma is defined by the square root of the bias-corrected variance

Physical scientists often use the term root-mean-square as a synonym for standard deviation when they refer to the square root of the mean squared deviation of a quantity from a given baseline. The standard deviation arises naturally in mathematical statistics through its definition in terms of the second central moment. However, a more natural but much less frequently encountered measure of average deviation from the mean that is used in descriptive statistics is the so-called mean deviation.

If the value of the boolean argument total is true, then the standard deviation is computed using the following formula:

References

MathWorld, http:mathworld.wolfram.com/StandardDeviation.html

Example 1

#include <codecogs/statistics/moments/standard_deviation.h>
#include <iostream>
int main()
{
  double x[5] = {2.5 , 6.2 , 8.0 , 9.6 , 3.8};
  double dev = Stats::Moments::stdev<double>(5, x);
  std::cout << "The population standard deviation is: " << dev << std::endl;
  return 0;
}
Output:
The population standard deviation is: 2.9192

Parameters

nthe size of the population
datathe actual population data given as an array
totalDefault value = false

Returns

the standard deviation mean of a given population

Authors

Anca Filibiu (August 2005)
Source Code

Source code is available when you agree to a GP Licence or buy a Commercial Licence.

Not a member, then Register with CodeCogs. Already a Member, then Login.


 

Page Comments

Peter10003\′s Photo
17 Nov 11, 6:48PM
(1 reply)
How to call Stdev for buckets within a long array
I have an array of (say) 2,000 numbers,

double x[2000]={0.123, 0.2144,-9.11, ... , -0.163];

and I want to break them into buckets of 100 numbers, thus 20 buckets.

How can I invoke the Stdev routine in Objective C, so I get 20 standard deviations.

Let's also say I have a startIndex[20] that has the beginnings of each bucket, e.g. 0, 100, 200, etc. I have this, since my bucket size changes, but in this simple case: startIndex[0] = 0, startIndex[1] =100, ...,startIndex[99]=1900

Is it this?:

double stdevBucket[20];

for (int i; i<20;i++)

stdevBucket[i]=[stdev Stdev : 100 dataX:x[startIndex[i]];
CodeCogs\′s Photo
18 Nov 11, 5:04PM
You're almost right (unless Objective C has a notation I'm not used to), so try
double stdevBucket[20];
  for(int i=0; i<20; i++)
    stdevBucket[i]= stdev(100, &dataX[i*20]);
 
 Format Excel Equations

  You must login to leave a messge