Learn R Programming

lmtest (version 0.2-2)

raintest: Rainbow-Test

Description

raintest performs the Rainbow-Tests on linearity.

Usage

raintest(formula, data=list())

Arguments

formula
a symbolic describtion for the model to be tested
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

Value

  • A list with class "htest" containing the following components:
  • statisticthe value of the test statistic.
  • p.valuethe p-value of the test.
  • methoda character string indicating what type of test was performed.
  • data.namea character string giving the name(s) of the data.

Details

The basic idea of the Rainbow-Test is that even if the true relationship is nonlinear, over a subsample of data given a good linear fit can be achieved. 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 a F distribution with df1 and df2 degree of freedom. This particular procedure compares a subsample consisting of all data points without the upper and lower quartile (of time index), thus 50data points. If the true relationship is concave or convex, the null hypothesis should be rejected.

References

Kraemer, W., Sonnberger, H. (1986): The linear regression model under test

See Also

lm

Examples

Run this code
x <- c(1:30)
y <- x^2 + rnorm(30,0,2)
formular <- y ~ x
rain <- raintest(formular)
qf(0.95, rain$parameter[1], rain$parameter[2])

Run the code above in your browser using DataLab