anovarIntReg {intRegGOF}R Documentation

Integrated Regression Goodness of Fit

Description

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

Usage

  anovarIntReg(objH0, ..., covars = NULL, B = 499, 
    LINMOD = FALSE, INCREMENTAL = FALSE)
  ## S3 method for class 'anovarIntReg'
print(x,...)

Arguments

objH0

An object of class lm, glm or nls which will be considered as hull hypotheses model or the base reference mode when INCREMENTAL is set to TRUE

.

...

One or more objects of class lm, glm or nls

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 formula like ~x1+x2+....

B

Bootstrap resampling size.

LINMOD

When TRUE and if obj is an object of class print.intRegGOFprint.intRegGOFlm Linear Model matrix fitting equations are used.

INCREMENTAL

When is FALSE all models in ... are tested against objH0, while when TRUE each of the models are checked against the next one startin in objH0.

x

An object of class anovarIntReg.

Details

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}\sum^n_{i=1}(\hat y_{0i}-\hat y_{1i})I(x_i\le 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,\dots,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,\dots,k-1.

Value

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.

Note

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

Author(s)

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

See Also

lm, glm, nls, and intRegGOF.

Examples

  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) 

[Package intRegGOF version 0.85-5 Index]