g01adf

g01adf © Numerical Algorithms Group, 2002.

Purpose

G01ADF Mean, variance, skewness, kurtosis etc, one variable, from frequency table

Synopsis

[xmean,s2,s3,s4,n,ifail] = g01adf(x,ifreq<,ifail>)

Description

 
 The input data consist of a univariate frequency distribution, 
 denoted by f , for i=1,2,...,k-1, and the boundary values of the 
             i                                                   
 classes x , for i=1,2,...,k. Thus the frequency associated with 
          i                                                     
 the interval (x ,x   ) is f , and the routine assumes that all 
                i  i+1      i                                  
 the values in this interval are concentrated at the point
 
                  y =(x   +x )/2,   i=1,2,...,k-1
                   i   i+1  i
 
 .
 
 The following quantities are calculated:
 
 (a)   total frequency,
                                   k-1  
                                   --   
                                n= >  f .
                                   --  i
                                   i=1  
 
 (b)   mean,
                                  k-1    
                                  --     
                                  >  f y 
                                  --  i i
                              _   i=1    
                              y= --------.
                                    n    
 
 (c)   standard deviation,
                               ______________
                              /  k-1         
                             /   --       _ 2
                            /    >  f (y -y) 
                           /     --  i  i    
                          /      i=1         
                    s =  /      -------------,  n>=2.
                     2 \/           (n-1)    
 
 (d)   coefficient of skewness,
                             k-1         
                             --       _ 3
                             >  f (y -y) 
                             --  i  i    
                             i=1         
                        s = -------------,  n>=2.
                         3           3   
                              (n-1)*s    
                                     2   
 
 (e)   coefficient of kurtosis,
                            k-1         
                            --       _ 4
                            >  f (y -y) 
                            --  i  i    
                            i=1         
                       s = --------------3,  n>=2.
                        4           4   
                             (n-1)*s    
                                    2   
 
 The routine has been developed primarily for groupings of a 
 continuous variable. If, however, the routine is to be used on 
 the frequency distribution of a discrete variable, taking the 
 values y ,...,y   , then the boundary values for the classes may 
         1      k-1                                              
 be defined as follows:
 
     (i) for k>2,    x  = (3y -y )/2
                      1      1  2
 
                     x  = (y   +y )/2, j=2,...,k-1
                      j     j-1  j     
 
                     x  = (3y   -y   )/2
                      k      k-1  k-2
 
     (ii) for k=2,   x  = y -a and x =y +a for any a>0.
                      1    1        2  1              
 

Parameters

g01adf

Required Input Arguments:

x (:)                                 real
ifreq (:)                             integer

Optional Input Arguments:                       <Default>

ifail                                 integer  -1

Output Arguments:

xmean                                 real
s2                                    real
s3                                    real
s4                                    real
n                                     integer
ifail                                 integer