ang                  package:locfit                  R Documentation

_A_n_g_u_l_a_r _T_e_r_m _f_o_r _a _L_o_c_f_i_t _m_o_d_e_l.

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

     The 'ang()' function is used in a locfit model formula to specify
     that a variable should be treated as an angular or periodic term.
     The 'scale' argument of 'locfit()' is used to set the period.

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

     ang(x)

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

       x: numeric variable to be treated periodically.

_N_o_t_e:

     The 'scale' argument to 'locfit' is used to specify the period
     divided by 2pi of the term. The default is 'sacle=1', giving a
     period of  2pi.

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

     Loader, C. (1999). Local Regression and Likelihood. Springer, NY
     (Section 6.2).

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

     'locfit'.

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

     # generate an x variable, and a response with period 0.2
     x <- seq(0, 1, length=200)
     y <- sin(10*pi*x) + rnorm(200) / 5

     # compute the periodic local fit. Note the scale argument is period/(2pi)
     fit <- locfit(y ~ ang(x), scale=0.2/(2*pi))

     # plot the fit over a single period
     plot(fit)

     # plot the fit over the full range of the data
     plot(fit, xlim=c(0,1))

