BasicStatistics           package:fBasics           R Documentation

_B_a_s_i_c _S_t_a_t_i_s_t_i_c_s _S_u_m_m_a_r_y

_D_e_s_c_r_i_p_t_i_o_n:

     A collection and description of functions to compute  basic
     statistical properties. Missing functions in  R to calculate
     skewness and kurtosis are added, a  function which creates a
     summary statistics, and  functions to calculate column and row
     statistics. 

     The functions are:

       'skewness'     returns value of skewness,
       'kurtosis'     returns value of kurtosis,
       'basicStats'   computes an overview of basic statistical values,
       'rowStats'     calculates row statistics,
       'colStats'     calculates column statistics,
       'rowAvgs'      calculates row means,
       'colAvgs'      calculates column means,
       'rowVars'      calculates row variances,
       'colVars'      calculates column variances,
       'rowStdevs'    calculates row standard deviations,
       'colStdevs'    calculates column standard deviations,
       'rowSkewness'  calculates row skewness,
       'colSkewness'  calculates column skewness,
       'rowKurtosis'  calculates row kurtosis,
       'colKurtosis'  calculates column kurtosis,
       'rowCumsums'   calculates row cumulated Sums,
       'colCumsums'   calculates column cumulated Sums.

     For SPLUS Compatibility:

       'stdev'  Returns the standard deviation of a vector or matrix.

_U_s_a_g_e:

     skewness(x, ...)
     ## Default S3 method:
     skewness(x, na.rm = FALSE, ...)
     ## S3 method for class 'data.frame':
     skewness(x, ...)
     ## S3 method for class 'POSIXct':
     skewness(x, ...)
     ## S3 method for class 'POSIXlt':
     skewness(x, ...)

     kurtosis(x, ...)
     ## Default S3 method:
     kurtosis(x, na.rm = FALSE, ...)
     ## S3 method for class 'data.frame':
     kurtosis(x, ...)
     ## S3 method for class 'POSIXct':
     kurtosis(x, ...)
     ## S3 method for class 'POSIXlt':
     kurtosis(x, ...)

     basicStats(x, ci = 0.95, column = 1)

     rowStats(x, FUN, na.rm = FALSE, ...) 
     rowAvgs(x, na.rm = FALSE, ...)
     rowVars(x, na.rm = FALSE, ...)
     rowStdevs(x, na.rm = FALSE, ...)
     rowSkewness(x, na.rm = FALSE, ...)
     rowKurtosis(x, na.rm = FALSE, ...)
     rowCumsums(x, na.rm = FALSE, ...)

     colStats(x, FUN, na.rm = FALSE, ...) 
     colAvgs(x, na.rm = FALSE, ...)
     colVars(x, na.rm = FALSE, ...)
     colStdevs(x, na.rm = FALSE, ...)
     colSkewness(x, na.rm = FALSE, ...)
     colKurtosis(x, na.rm = FALSE, ...)
     colCumsums(x, na.rm = FALSE, ...)

     stdev(x, na.rm = FALSE))

_A_r_g_u_m_e_n_t_s:

      ci: confidence interval, a numeric value, by default 0.95,  i.e.
          95 percent. 

  column: [basicStats] - 
           which column should be selected from the input matrix, data
          frame or timeSeries object. By default an integer value set
          to 1. 

     FUN: the statistical function to be applied. 

   na.rm: a logical. Should missing values be removed? 

       x: a numeric vector, or a matrix for column statistics. 
           [basicStats] - 
           allows also a matrix, data.frame or timeSeries as input. In
          this case only the first column of data will be considered
          and a a warning will be printed.         

     ...: arguments to be passed. 

_V_a_l_u_e:

     'skewness', 'kurtosis' 
      returns the value of the statistics, a numeric value. 

     'basicsStats' 
      returns data frame with the following entries and row names:
     nobs, NAs, Minimum, Maximum , 1. Quartile, 3. Quartile, Mean,
     Median, Sum, SE Mean, LCL Mean, UCL Mean, Variance, Stdev,
     Skewness, Kurtosis. 

     'rowStats', 'rowAvgs', 'rowVars', 'rowStdevs',
      'rowSkewness', 'rowKurtosis', 'rowCumsum' 
       computes sample statistics by column. Missing values can be
     handled. 

     'colStats', 'colAvgs', 'colVars', 'colStdevs',
      'colSkewness', 'colKurtosis', 'colCumsum' 
       computes sample statistics by column. Missing values can be
     handled.

_N_o_t_e:

     R's-base package contains a function 'colMeans' with an additional
     argument 'dim=1'. Therefore, the function used  here to compute
     column means (averages) is named 'colAvgs'. 

     The function 'stdev' computes the standard deviation for a vector
     or matrix and was introduced for SPlus compatibility. Under R use
     the function 'sd'.

_A_u_t_h_o_r(_s):

     Diethelm Wuertz for the Rmetrics R-port.

_S_e_e _A_l_s_o:

     'colMeans', 'mean', 'median', 'var'.

_E_x_a_m_p_l_e_s:

     ## SOURCE("fBasics.A0-SPlusCompatibility")
     ## SOURCE("fBasics.A2-BasicStatistics")

     ## basicStats -
        xmpBasics("\nStart: Basic Statistics of log-Returns > ")
        # Data NYSE Composite Index:
        data(nyseres)
        basicStats(nyseres)  
          
     ## mean -
     ## var -
     ## skewness -
     ## kurtosis -
        xmpBasics("\nNext: Moments, Skewness and Kurtosis > ")
        # Mean, Variance:
        mean(nyseres)
        var(nyseres)
        # Skewness, Kurtosis:
        class(nyseres)
        skewness(nyseres[, 1])
        kurtosis(nyseres[, 1])   

