lag                  package:stats                  R Documentation

_L_a_g _a _T_i_m_e _S_e_r_i_e_s

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

     Compute a lagged version of a time series, shifting the time base
     back by a given number of observations.

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

     lag(x, ...)

     ## Default S3 method:
     lag(x, k = 1, ...)

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

       x: A vector or matrix or univariate or multivariate time series

       k: The number of lags (in units of observations).

     ...: further arguments to be passed to or from methods.

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

     Vector or matrix arguments 'x' are coerced to time series.

     'lag' is a generic function; this page documents its default
     method.

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

     A time series object.

_N_o_t_e:

     Note the sign of 'k': a series lagged by a positive 'k' starts
     _earlier_.

_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:

     'diff', 'deltat'

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

     data(UKLungDeaths)
     lag(ldeaths, 12) # starts one year earlier

