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

