Model-diagnostics based on cumulative residuals

References

D.Y. Lin and L.J. Wei and Z. Ying (2002) Model-Checking Techniques Based on Cumulative Residuals. Biometrics, Volume 58, pp 1-12.

John Q. Su and L.J. Wei (1991) A lack-of-fit test for the mean function in a generalized linear model. Journal. Amer. Statist. Assoc., Volume 86, Number 414, pp 420-426.

See also

cox.aalen in the timereg-package for similar GoF-methods for survival-data.

Author

Klaus K. Holst <klaus@holst.it>

Examples

example(cumres)
#> #> cumres> sim1 <- function(n=100, f=function(x1,x2) {10+x1+x2^2}, sd=1, seed=1) { #> cumres+ if (!is.null(seed)) #> cumres+ set.seed(seed) #> cumres+ x1 <- rnorm(n); #> cumres+ x2 <- rnorm(n) #> cumres+ X <- cbind(1,x1,x2) #> cumres+ y <- f(x1,x2) + rnorm(n,sd=sd) #> cumres+ d <- data.frame(y,x1,x2) #> cumres+ return(d) #> cumres+ } #> #> cumres> d <- sim1(100); l <- lm(y ~ x1 + x2,d) #> #> cumres> system.time(g <- cumres(l, R=100, plots=50)) #> user system elapsed #> 0.018 0.000 0.018 #> #> cumres> g #> #> p-value(Sup) p-value(L2) #> predicted 0.26 0.37 #> x1 0.47 0.42 #> x2 0.00 0.00 #> #> Based on 100 realizations. #> #> cumres> ## No test: #> cumres> ##D plot(g) #> cumres> ## End(No test) #> cumres> g1 <- cumres(l, c("y"), R=100, plots=50) #> #> cumres> g1 #> #> p-value(Sup) p-value(L2) #> predicted 0.35 0.35 #> #> Based on 100 realizations. #> #> cumres> g2 <- cumres(l, c("y"), R=100, plots=50, b=0.5) #> #> cumres> g2 #> #> p-value(Sup) p-value(L2) #> predicted 0.21 0.26 #> #> Based on 100 realizations.