Integrated Regression Goodness of Fit to test the adequacy of different model to represent the regression function for a given data.

1 2 3 | ```
anovarIntReg(objH0, ..., covars = NULL, B = 499,
LINMOD = FALSE, INCREMENTAL = FALSE)
print.anovarIntReg(x,...)
``` |

`objH0` |
An object of class |

.

`...` |
One or more objects of class |

`covars` |
Names of continuous (numerical) variates used to
compute Integrated Regression. They should be variables contained
in the data frame used to compute the regression fit. When NULL it
is obtained as the max. number of different covariates in all tested
models. It also can be a |

`B` |
Bootstrap resampling size. |

`LINMOD` |
When |

`INCREMENTAL` |
When is |

`x` |
An object of class |

This function implements the test

*
H_0:m\in M_0 \ \textrm{vs} \ H_1:m\in M_1
*

for two different models *M_0*, *M_1* using the
Integrated Regression Goodness of Fit as os done in `intRegGOF`

,
but instead of the accumulation of the residual of a givem model, in
this case, the accumuation of the difference in the fits is considered:

*
R^w_n(x)=n^{-1/2}∑^n_{i=1}(\hat y_{0i}-\hat y_{1i})I(x_i≤ x).
*

The test statistics considered are $K_n$ and $W^2_n$.

If `objH0`

and `objH1`

are `lm`

, `glm`

or `nls`

fits for the models in classes *M_0* and
*M_1* respectively, then `anovarIntReg(objH0,objH1)`

computes
test *H_0:m\in M_0* vs *H_1:m\notin M_1*. When
`anovarIntReg(objH0,objH1,...,objHk)`

is executed (notice
that by default `INCREMENTAL=FALSE`

) we obtain a table with
the statistics *K_n* and *W^2_n* and its associated
*p*-values for each of the tests *H_0:m\in M_0* vs
*H_i:m\notin M_i* being *i=1,…,k*. On the other hand,
if the parameter `INCREMENTAL`

is set to `TRUE`

, the
command returns the results for the tests *H_i:m\in M_i* vs
*H_{i+1}:m\notin M_{i+1}* being *i=1,…,k-1*.

This function returns an object of class `anovarIntReg`

, a
matrix like `structure`

whose rows refers to models and
columns to statistics and its *p*-values. It also has
an attribute `heading`

to support printing the object.

This method requires more testing, and careful study of the effect of factors (discrete random variables) when fitting the model.

Jorge Luis Ojeda Cabrera (jojeda@unizar.es).

`lm`

, `glm`

, `nls`

,
and `intRegGOF`

.

1 2 3 4 5 6 7 8 | ```
n <- 50
d <- data.frame( X1=runif(n),X2=runif(n))
d$Y <- 1 - 2*d$X1 - 5*d$X2 + rnorm(n,sd=.125)
a0 <- lm(Y~1,d)
a1 <- lm(Y~X1,d)
a2 <- lm(Y~X1+X2,d)
anovarIntReg(a0,a1,a2,B=50)
anovarIntReg(a0,a1,a2,B=50,INCREMENTAL=TRUE)
``` |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

All documentation is copyright its authors; we didn't write any of that.