R/overdispreg.test.R

Defines functions overdispreg.test

Documented in overdispreg.test

#[export]
overdispreg.test <- function(y, x) {
  mod <- Rfast::glm_poisson(x, y, tol = 1e-07)
  x <- model.matrix( y ~ ., data.frame(x) )
  mi <- exp(x %*% mod$be)
  s2 <- sum( (y - mi)^2  - y) / sqrt( 2 * sum(mi^2) ) 
  pvalue <- pnorm(s2, lower.tail = FALSE)
  res <- c(s2, pvalue)
  names(res) <- c("s2", "p-value")
  res
}


  

Try the Rfast2 package in your browser

Any scripts or data that you put into this service are public.

Rfast2 documentation built on Aug. 8, 2023, 1:11 a.m.