

kernel {ts}                                  R Documentation

_S_m_o_o_t_h_i_n_g _K_e_r_n_e_l _O_b_j_e_c_t_s

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

     The `"tskernel"' class is designed to represent dis-
     crete symmetric normalized smoothing kernels. These
     kernels can be used to smooth vectors, matrices, or
     time series objects.

_U_s_a_g_e_:

     kernel(coef, m, r, name)

     df.kernel(k)
     bandwidth.kernel(k)
     is.tskernel(k)

     print(k, digits = max(3,.Options$digits-3))
     plot(k)

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

    coef: the upper half of the smoothing kernel coeffi-
          cients (inclusive of coefficient zero) or the name
          of a kernel (currently `"daniell"', `"dirichlet"',
          `"fejer"' or `"modified.daniell"'.

       m: the kernel dimension. The number of kernel coeffi-
          cients is `2*m+1'.

    name: the name of the kernel.

       r: the kernel order for a Fejer kernel.

  digits: the number of digits to format real numbers.

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

     `kernel' is used to construct a general kernel or named
     specific kernels. The modified Daniell kernel halves
     the end coefficients (as used by S-PLUS).

     `df.kernel' returns the "equivalent degrees of freedom"
     of a smoothing kernel as defined in Brockwell and
     Davies (1991), p. 362, and `bandwidth.kernel' returns
     the equivalent bandwidth as defined in Bloomfield
     (1991), p. 201, with a continuity correction.

_V_a_l_u_e_:

     `kernel' returns a list with class `"tskernel"', and
     components the coefficients `coef' and the kernel
     dimension `m'. An additional attribute is `"name"'.

_A_u_t_h_o_r_(_s_)_:

     A. Trapletti; modifications by B.D. Ripley

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

     Bloomfield, P. (1976) Fourier Analysis of Time Series:
     An Introduction. Wiley.

     Brockwell, P.J. and Davis, R.A. (1991) Time Series:
     Theory and Methods. Second edition. Springer, pp.
     350-365.

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

     `kernapply'

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

     data(EuStockMarkets)    # Demonstrate a simple trading strategy for the
     x <- EuStockMarkets[,1]  # financial time series German stock index DAX.
     k1 <- kernel("daniell", 50)  # a long moving average
     k2 <- kernel("daniell", 10)  # and a short one
     plot(k1)
     plot(k2)
     x1 <- kernapply(x, k1)
     x2 <- kernapply(x, k2)
     plot(x)
     lines(x1, col = "red")    # go long if the short crosses the long upwards
     lines(x2, col = "green")  # and go short otherwise

     data(sunspot)     # Reproduce example 10.4.3 from Brockwell and Davies (1991)
     spectrum(sunspot.year, kernel=kernel("daniell", c(11,7,3)), log="no")

