Page 48 - MATLAB Recipes for Earth Sciences
P. 48

3.3 Example of Empirical Distributions                           39

               var(corg)
             ans =
                 1.3595

           The standard deviation is the square root of the variance.

               std(corg)
             ans =
                 1.1660

           It is important to note that by default the functions var and std calculate the
           sample variance and standard deviation representing an unbiased estimate of
           the sample dispersion of the population. While using skewness to describe
           the shape of the distribution, we observe a negative skew close to zero:

               skewness(corg)
             ans =
                 -0.2529

           Finally, the peakedness of the distribution is described by the kurtosis. The
           result from the function kurtosis,
               kurtosis(corg)

             ans =
                 2.4670

           suggests that our distribution is slightly flatter than a gaussian distribution
           since its kurtosis is lower than three. Most of these functions have cor-
           responding versions for data sets containing gaps, such as nanmean and
           nanstd, which treat NaN·s as missing values. To illustrate the use of these
           functions we introduce a gap to our data set and compute the mean using
           mean and nanmean for comparison.

             corg(25,1) = NaN;
             mean(corg)
             ans =
                 NaN
               nanmean(corg)
             ans =
                 12.3371
           In this example the function mean follows the rule that all operations with
   43   44   45   46   47   48   49   50   51   52   53