rcorty / dglm

Double generalized linear models
0 stars 0 forks source link

NA handling should mirror lm() and glm() #1

Open rcorty opened 8 years ago

rcorty commented 8 years ago

dglm() should give residuals of the same dimension as lm() and glm(), given the same data and the same specification of NA handling.

x <- c(runif(n = 10), NA)
y <- c(NA, rnorm(n = 10, mean = x))

fit1 <- stats::lm(formula = y ~ x, 
                  na.action = na.exclude)
fit2 <- stats::glm(formula = y ~ x,
                   na.action = na.exclude)
fit3 <- dglm::dglm(formula = y ~ x,
                   dformula = ~ x,
                   na.action = na.exclude)

resid(object = fit1)
resid(object = fit2)
resid(object = fit3)