cumres {gof}R Documentation

Calculates GOF measures for for generalized linear models

Description

Currently linear regression models (lm) and logistic and poisson regression models are supported.

Usage

## S3 method for class 'lm':
cumres (model, ...)
## S3 method for class 'glm':
cumres (model,
         variable=c("predicted",colnames(model.matrix(model))),
         data=data.frame(model.matrix(model)),
         R=500, b=0, plots=min(R,50),
         seed=round(runif(1,1,1e9)),...)

Arguments

model Model object (lm or glm)
variable List of variable to order the residuals after
data data.frame used to fit model (complete cases)
R Number of samples used in simulation
b Moving average bandwidth (0 corresponds to infinity = standard cumulated residuals)
plots Number of realizations to save for use in the plot-routine
seed Random seed
... additional arguments

Value

Returns an object of class 'cumres'.

Author(s)

Klaus K. Holst

See Also

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

Examples

sim1 <- function(n=100, f=function(x1,x2) {10+x1+x2^2}, sd=1, seed=1) {
  if (!is.null(seed))
    set.seed(seed)
  x1 <- rnorm(n);
  x2 <- rnorm(n)
  X <- cbind(1,x1,x2)
  y <- f(x1,x2) + rnorm(n,sd=sd)
  d <- data.frame(y,x1,x2)
  return(d)
}
d <- sim1(100); l <- lm(y ~ x1 + x2,d)
system.time(g <- cumres(l, R=100, plots=50))
g
## Not run: plot(g)
g1 <- cumres(l, c("y"), R=100, plots=50)
g1
g2 <- cumres(l, c("y"), R=100, plots=50, b=0.5)
g2


[Package gof version 0.6-2 Index]