monthplot               package:stats               R Documentation

_P_l_o_t _a _S_e_a_s_o_n_a_l _o_r _o_t_h_e_r _S_u_b_s_e_r_i_e_s _f_r_o_m _a _T_i_m_e _S_e_r_i_e_s

_D_e_s_c_r_i_p_t_i_o_n:

     These functions plot seasonal (or other) subseries of a time
     series. For each season (or other category), a time series is
     plotted.

_U_s_a_g_e:

     monthplot(x, ...)

     ## S3 method for class 'stl':
     monthplot(x, labels = NULL, ylab = choice, choice = "seasonal",
               ...)

     ## S3 method for class 'StructTS':
     monthplot(x, labels = NULL, ylab = choice, choice = "sea", ...)

     ## S3 method for class 'ts':
     monthplot(x, labels = NULL, times = time(x), phase = cycle(x),
                  ylab = deparse(substitute(x)), ...)

     ## Default S3 method:
     monthplot(x, labels = 1:12,
               ylab = deparse(substitute(x)),
               times = 1:length(x),
               phase = (times - 1)%%length(labels) + 1, base = mean,
               axes = TRUE, type = c("l", "h"), box = TRUE,
               add = FALSE, ...)

_A_r_g_u_m_e_n_t_s:

       x: Time series or related object.

  labels: Labels to use for each 'season'.

    ylab: y label.

   times: Time of each observation.

   phase: Indicator for each 'season'.

    base: Function to use for reference line for subseries.

  choice: Which series of an 'stl' or 'StructTS' object?

     ...: Arguments to be passed to the default method or graphical
          parameters.

    axes: Should axes be drawn (ignored if 'add=TRUE')?

    type: Type of plot.  The default is to join the points with lines,
          and '"h"' is for histogram-like vertical lines.

     box: Should a box be drawn (ignored if 'add=TRUE'?

     add: Should thus just add on an existing plot.

_D_e_t_a_i_l_s:

     These functions extract subseries from a time series and plot them
     all in one frame.  The 'ts', 'stl', and 'StructTS' methods use the
     internally recorded frequency and start and finish times to set
     the scale and the seasons.  The default method assumes
     observations come in groups of 12 (though this can be changed).

     If the 'labels' are not given but the 'phase' is given, then the
     'labels' default to the unique values of the 'phase'.  If both are
     given, then the 'phase' values are assumed to be indices into the
     'labels' array, i.e., they should be in the range from 1 to
     'length(labels)'.

_V_a_l_u_e:

     These functions are executed for their side effect of drawing a
     seasonal subseries plot on the current graphical window.

_A_u_t_h_o_r(_s):

     Duncan Murdoch

_R_e_f_e_r_e_n_c_e_s:

     Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988) _The New S
     Language_. Wadsworth & Brooks/Cole.

_S_e_e _A_l_s_o:

     'ts', 'stl', 'StructTS'

_E_x_a_m_p_l_e_s:

     require(graphics)

     ## The CO2 data
     fit <- stl(log(co2), s.window = 20, t.window = 20)
     plot(fit)
     op <- par(mfrow = c(2,2))
     monthplot(co2, ylab = "data", cex.axis = 0.8)
     monthplot(fit, choice = "seasonal", cex.axis = 0.8)
     monthplot(fit, choice = "trend", cex.axis = 0.8)
     monthplot(fit, choice = "remainder", type = "h", cex.axis = 0.8)
     par(op)

     ## The CO2 data, grouped quarterly
     quarter <- (cycle(co2) - 1) %/% 3
     monthplot(co2, phase = quarter)

     ## see also JohnsonJohnson

