kernel                  package: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 discrete 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,getOption("digits")-3))
     plot(k)

_A_r_g_u_m_e_n_t_s:

    coef: the upper half of the smoothing kernel coefficients
          (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 coefficients 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), page
     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")

