Next                package:quantmod                R Documentation

_A_d_v_a_n_c_e _a _T_i_m_e _S_e_r_i_e_s

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

     Create a new series with all values advanced forward one period.
     The value of period 1, becomes the value at period 2, value at 2
     becomes the original value at 3, etc.  The opposite of 'Lag'. 
     'NA' is used to fill.

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

     Next(x, k = 1)

     ## S3 method for class 'quantmod.OHLC':
     Next(x,k=1)

     ## S3 method for class 'zoo':
     Next(x,k=1)

     ## S3 method for class 'data.frame':
     Next(x,k=1)

     ## S3 method for class 'numeric':
     Next(x,k=1)

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

       x: vector or series to be advanced 

       k: periods to advance 

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

     Shift series k-periods up, appending 'NA's to end of series.

     Specifically designed to handle 'quantmod.OHLC' and 'zoo' series
     within the 'quantmod' workflow.

     If no S3 method is found, a call to 'lag' in 'base' is made, with
     the indexing reversed to shift the time series forward.

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

     The original 'x' appended with 'k' 'NA's and missing the leading
     'k' values.

     The returned series maintains the number of obs. of the original.

     Unlike 'Lag', only one value for 'k' is allowed.

_N_o_t_e:

     This function's purpose is to get the "next" value of the data you
     hope to forecast, e.g. a stock's closing value at t+1. 
     Specifically to be used within the 'quantmod' framework of
     'specifyModel', as a functional wrapper to the LHS of the model
     equation.

     It is not magic - and thus will not get tomorrow's values...

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

     Jeffrey A. Ryan

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

     'specifyModel', 'Lag'

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

     Stock.Close <- c(102.12,102.62,100.12,103.00,103.87,103.12,105.12)
     Close.Dates <- as.Date(c(10660,10661,10662,10665,10666,10667,10668),origin="1970-01-01")
     Stock.Close <- zoo(Stock.Close,Close.Dates)

     Next(Stock.Close)       #one period ahead
     Next(Stock.Close,k=1)   #same

     merge(Next(Stock.Close),Stock.Close)

     ## Not run: 
     # a simple way to build a model of next days
     # IBM close, given todays. Technically both
     # methods are equal, though the former is seen
     # as more intuitive...ymmv
     specifyModel(Next(Cl(IBM)) ~ Cl(IBM))
     specifyModel(Cl(IBM) ~ Lag(Cl(IBM)))
     ## End(Not run)

