buysbal               package:pastecs               R Documentation

_B_u_y_s-_B_a_l_l_o_t _t_a_b_l_e

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

     Calculate a Buys-Ballot table from a time-series

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

     buysbal(x, y=NULL, frequency=12, units="years", datemin=NULL,
             dateformat="m/d/Y", count=FALSE)

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

       x: Either a vector with time values (in this case, `y' must be
          defined), or a regular time-series 

       y: If `x' is a vector with time values, `y' must contain
          corresponding observations 

frequency: The frequency of observations per year to use in the
          Buys-Ballot table. By default `frequency=12' which
          corresponds to monthly samples, and the resulting table has
          12 column, one per month 

   units: either `"years"' (by default), and time is not rescaled, or
          `"days"', and the time is rescaled to "years" with the
          function `daystoyears()' 

 datemin: A character string representing the first date, using a
          format corresponding to `dateformat'. For instance, with
          `datemin="04/23/1998"' and `dateformat="m/d/Y"', the first
          observation is assumed to be made the 23th April 1998. In R,
          it can also be a POSIXt date (see `?DataTimeClasses'). In
          this case, `dateformat' is not required and is ignored. By
          default, `datemin=NULL' 

dateformat: The format used for the date in `datemin'. For instance,
          `"d/m/Y"' or `"m/d/Y"' (by default). The distinction between
          "Y" and "y" is not important in Splus, but it is vital in R
          to use "y" for two-digit years (ex: 89) and "Y" for
          four-digits years (ex: 1989), or the date will not be
          correctly converted! In R, you can also use a POSIXt format
          specification like "%d-%m%Y" for instance (see `?strptime'
          for a complete description of POSIXt format specification. In
          both Splus and R, you can also use "mon" for abbreviated
          months like "mon d Y" for "Apr 20 1965", and "month" for
          fully-spelled months like "d month Y" for "24 September 2003" 

   count: If `FALSE' (by default), the Buys-Ballot table is calculated.
          If `TRUE', the function returns only the number of
          observations that are used in each cell of the Buys-Ballot
          table 

_D_e_t_a_i_l_s:

     A Buys-Ballot table summarizes data to highlight seasonal
     variations. Each line is one year and each column is a period of
     the year (12 months, 4 quarters, 52 weeks,...). A cell ij of this
     table contain the mean value for all observations made during the
     year i at the period j.

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

     A matrix containing either the Buys-Ballot table (`count=FALSE'),
     or the number of observations used to build the table
     (`count=TRUE')

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

     Frdric Ibanez (ibanez@obs-vlfr.fr), Philippe Grosjean
     (phgrosjean@sciviews.org)

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

     `daystoyears', `tsd'

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

     data(releve)
     buysbal(releve$Day, releve$Melosul, frequency=4, units="days",
             datemin="21/03/1989", dateformat="d/m/Y")
     buysbal(releve$Day, releve$Melosul, frequency=4, units="days",
             datemin="21/03/1989", dateformat="d/m/Y", count=TRUE)

