Variance, standard deviation

Variance is divided into: the overall sample variance and variance;

  The overall variance calculation formula:
  
   For the population variance,
Variable,
For the population mean,
As the overall number of cases.
 
 
  In practice, when the overall mean is difficult to obtain , instead of the overall sample statistics applied parameters, corrected by the sample variance of the formula:
  S^2= ∑(X-) ^2 / (n-1)
  S ^ 2 is a sample variance, X is the variable,
Is the sample mean, n is the sample number of cases.
The standard deviation is the square of the variance;

 

 

arr =【2,1,5】

PivotTable pull on excel:

The overall variance: 2.888889 # = POWER (STDEVP (arr), 2)

Overall standard (vinylidene) difference: 1.699673 # = STDEVP (arr)

Variance: 4.333333 # = VAR (arr) # sample variance

Standard (vinylidene) difference: 2.081666 # = SQRT (VAR (arr)) # Sample standard deviation

 

 

 

python-numpy:

AS NP numpy Import 

ARR = [2,. 1,. 5]
arr_mean = np.mean (ARR)
arr_var = np.var (ARR, ddof = . 1 ) sample variance #
= np.std arr_std (ARR, ddof = . 1 ) # is the sample standard deviation ddof: n-ddof, ddof defaults to 0 

Print ( "average of:% f"% arr_mean)
Print ( "variance:% f"% arr_var)
Print ( "standard deviation:% f"% arr_std)

Average: 2.666667

Variance: 4.333333

Standard deviation: 2.081666

 

AS NP numpy Import 

ARR = [2,. 1,. 5]
arr_mean = np.mean (ARR)
arr_var = np.var (ARR) is equivalent to # arr_var = np.var (ARR, ddof = 0 ) # population variance

arr_std = np.std (ARR, ddof = 0 ) the overall standard deviation #
print ( "average of:% F"% arr_mean) 
print ( "variance:% F"% arr_var)
print ( "standard deviation:% f"% arr_std)

Average: 2.666667
variance: 2.888889
standard deviation: 1.699673

 

There is also a question: why unanimously on top of me and manual calculation (basis is calculated using the formula) is not on?

Guess you like

Origin www.cnblogs.com/Formulate0303/p/11641541.html