g01aaf

g01aaf © Numerical Algorithms Group, 2002.

Purpose

G01AAF Mean, variance, skewness, kurtosis etc, one variable, from raw data

Synopsis

[xmean,s2,s3,s4,xmin,xmax,wtsum,wt,iwt,ifail] = g01aaf(x<,wt,iwt,ifail>)

Description

 
 The data consist of a single sample of n observations, denoted by
 x , with corresponding weights, w , for i=1,2,...,n.
  i                               i                 
 
 If no specific weighting is required, then each w  is set to 1.
                                                  i           
 
 The quantities computed are:
 
 (a)  The sum of the weights 
                                  n    
                                  --   
                               W= >  w .
                                  --  i
                                  i=1  
 
 (b)  Mean 
                                  n      
                                  --     
                                  >  w x 
                                  --  i i
                              _   i=1    
                              x= --------.
                                    W    
 
 (c)  Standard deviation
                                  ______________
                                 /  n           
                                /   --       _ 2
                               /    >  w (x -x) 
                              /     --  i  i    
                             /      i=1         
                       s =  /      -------------,
                        2 \/             d      
                  n    
                  --  2
                  >  w 
                  --  i
                  i=1  
      where d=W- ------.
                   W   
 
 (d)  Coefficient of skewness
                                n           
                                --       _ 3
                                >  w (x -x) 
                                --  i  i    
                                i=1         
                           s = -------------.
                            3         3     
                                   d*s      
                                      2     
 
 (e)  Coefficient of kurtosis
                               n           
                               --       _ 4
                               >  w (x -x) 
                               --  i  i    
                               i=1         
                          s = --------------3.
                           4         4     
                                  d*s      
                                     2     
 
 (f)  Maximum and minimum elements of the sample.
 
 (g)  The number of observations for which w >0, i.e., the number 
                                            i                    
      of valid observations. Suppose m observations are valid, 
      then the quantities in (c), (d) and (e) will be computed if 
      m>=2, and will be based on m-1 degrees of freedom. The other
      quantities are evaluated provided m>=1.
 

Parameters

g01aaf

Required Input Arguments:

x (:)                                 real

Optional Input Arguments:                       <Default>

wt (:)                                real     zeros(length(x),1)
iwt                                   integer  0
ifail                                 integer  -1

Output Arguments:

xmean                                 real
s2                                    real
s3                                    real
s4                                    real
xmin                                  real
xmax                                  real
wtsum                                 real
wt (:)                                real
iwt                                   integer
ifail                                 integer