raintest  R Documentation 
Rainbow test for linearity.
raintest(formula, fraction = 0.5, order.by = NULL, center = NULL, data=list())
formula 
a symbolic description for the model to be tested
(or a fitted 
fraction 
numeric. The percentage of observations in the subset is
determined by

order.by 
Either a vector 
center 
numeric. If If the Mahalanobis distance is chosen 
data 
an optional data frame containing the variables in the model.
By default the variables are taken from the environment which

The basic idea of the Rainbow test is that even if the true
relationship is
nonlinear, 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 worse than the fit for 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
.
A list with class "htest"
containing the following components:
statistic 
the value of the test statistic. 
p.value 
the pvalue 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. 
J.M. Utts (1982), The Rainbow Test for Lack of Fit in Regression. Communications in Statistics – Theory and Methods 11, 2801–2815.
W. Krämer & H. Sonnberger (1986), The Linear Regression Model under Test. Heidelberg: Physica
lm
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])
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.