raintest               package:lmtest               R Documentation

_R_a_i_n_b_o_w _T_e_s_t

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

     Rainbow test for linearity.

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

     raintest(formula, fraction = 0.5, order.by = NULL, center = NULL,
        data=list())

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

 formula: a symbolic description for the model to be tested.

fraction: numeric. The percentage of observations in the subset is
          determined by 'fraction*n' if 'n' is the number of
          observations in the model.

order.by: either a formula or a string. A formula with a single
          explanatory variable like '~ x'. The observations in the
          model are ordered by the size of 'x'. If set to 'NULL' (the
          default) the observations are assumed to be ordered (e.g. a
          time series). If set to '"mahalanobis"' then the observations
          are ordered by their Mahalanobis distance of the data.

  center: numeric. If 'center' is smaller than 1 it is interpreted as
          percentages of data, i.e. the subset is chosen that
          'n*fraction' observations are around observation number
          'n*center'. If 'center' is greater than 1 it is interpreted
          to be the index of the center of the subset. By default
          'center' is 0.5.

          If the Mahalanobis distance is chosen 'center' is taken to be
          the mean regressor, but can be specified to be a
          'k'-dimensional vector if 'k' is the number of regressors and
          should be in the range of the respective regressors.

    data: an optional data frame containing the variables in the model.
          By default the variables are taken from the environment which
          'raintest' is called from.

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

     The basic idea of the Rainbow test is that even if the true
     relationship is non-linear, a good linear fit can be achieved on a
     subsample in the "middle" of the data. The null hypothesis is
     rejected whenever the overall fit is significantly inferious to
     the fit of the subsample. The test statistic under H_0 follows an
     F distribution with 'parameter' degrees of freedom.

     Examples can not only be found on this page, but also on the help
     pages of the data sets 'bondyield', 'currencysubstitution',
     'growthofmoney', 'moneydemand', 'unemployment', 'wages'.

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

     A list with class '"htest"' containing the following components: 

statistic: the value of the test statistic.

 p.value: the p-value of the test.

parameter: degrees of freedom.

  method: a character string indicating what type of test was
          performed.

data.name: a character string giving the name(s) of the data.

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

     J.M. Utts (1982), The Rainbow Test for Lack of Fit in Regression.
     _Communications in Statistics - Theory and Methods_ *11*,
     1801-1815

     W. Krmer & H. Sonnberger (1986), _The Linear Regression Model
     under Test_. Heidelberg: Physica

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

     'lm'

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

     x <- c(1:30)
     y <- x^2 + rnorm(30,0,2)
     rain <- raintest(y ~ x)
     rain
     ## critical value
     qf(0.95, rain$parameter[1], rain$parameter[2])

