llar                  package:tsDyn                  R Documentation

_L_o_c_a_l_l_y _l_i_n_e_a_r _m_o_d_e_l

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

     Casdagli test of nonlinearity via locally linear forecasts

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

     llar(x, m, d = 1, steps = d, series, eps.min = sd(x)/2,
             eps.max = diff(range(x)), neps = 30, trace = 0)

     llar.predict(x, m, d=1, steps=d, series, n.ahead=1, 
     eps=stop("you must specify a window value"),
     onvoid=c("fail","enlarge"), r = 20, trace=1)

     llar.fitted(x, m, d=1, steps=d, series, eps, trace=0)

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

       x: time series 

m, d, steps: embedding dimension, time delay, forecasting steps 

  series: time series name (optional)

 n.ahead: n. of steps ahead to forecast 

eps.min, eps.max: min and max neighborhood size 

    neps: number of neghborhood levels along which iterate

     eps: neighborhood size 

  onvoid: what to do in case of an isolated point: stop or enlarge
          neghborhood size by an r%

       r: if an isolated point is found, enlarge neighborhood window by
          r%

   trace: tracing level: 0, 1 or more than 1 for 'llar', 0 or 1 for
          'llar.forecast'

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

     'llar' does the Casdagli test of non-linearity. Given the
     embedding state-space (of dimension 'm' and time delay 'd')
     obtained from time series 'series', for a sequence of distance
     values 'eps', the relative error made by forecasting time series
     values with a linear autoregressive model estimated on points
     closer than 'eps' is computed.  If minimum error is reached at
     relatively small length scales, a global linear model may be
     inappropriate (using current embedding parameters). This was
     suggested by Casdagli(1991) as a test for non-linearity.

     'llar.predict' tries to extend the given time series by 'n.ahead'
     points by iteratively  fitting locally (in the embedding space of
     dimension m and time delay d) a linear model. If the spatial
     neighborhood window is too small, your time series last point
     would be probably isolated. You can ask to automatically enlarge
     the window 'eps' by a factor of r% sequentially, until enough
     neighbours are found for fitting the linear model.

     'llar.fitted' gives out-of-sample fitted values from locally
     linear models.

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

     'llar' gives an object of class 'llar'. I.e., a list of
     components: 

       RMSE     vector of relative errors
       eps      vector of neighborhood sizes (in the same order of RMSE)
       frac     vector of fractions of the time series used for RMSE computation
       avfound  vector of average number of neighbours for each point in the time series

     which can be plotted using the 'plot' method, and transformed to a
     regular  'data.frame' with the 'as.data.frame' function.

     'llar.forecast' gives the vector of n steps ahead locally linear
     iterated forecasts.

     'llar.fitted' gives out-of-sample fitted values from locally
     linear models.

_W_a_r_n_i_n_g:

     For long time series, this can be slow, especially for relatively
     big neighborhood sizes.

_N_o_t_e:

     The C implementation was re-adapted from that in the TISEAN
     package ("ll-ar" routine, see references). However, here the
     euclidean norm is used, in place of the max-norm.

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

     Antonio, Fabio Di Narzo

_R_e_f_e_r_e_n_c_e_s:

     M. Casdagli, Chaos and deterministic versus stochastic nonlinear
     modelling, J. Roy. Stat. Soc. 54, 303 (1991)

     Hegger, R., Kantz, H., Schreiber, T., Practical implementation of
     nonlinear time series methods: The TISEAN package; CHAOS 9,
     413-435 (1999)

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

     res <- llar(log(lynx), m=3, neps=7)
     plot(res)

     x.new <-  llar.predict(log(lynx),n.ahead=100, m=3, eps=1,
     onvoid="enlarge", r=5)
     lag.plot(x.new, labels=FALSE)

     x.fitted <-  llar.fitted(log(lynx), m=3, eps=1)
     lag.plot(x.fitted, labels=FALSE)

