R/residuals.cubinf.R

Defines functions residuals.cubinf

Documented in residuals.cubinf

residuals.cubinf <-
function(object, type = c("deviance", "pearson", "response"), ...)
{
        type <- match.arg(type)
        y    <- object$y
        mu   <- object$fitted
        ics  <- object$ics
        if (ics==2) { ni <- object$ni; y <- y/ni} 
        resp <- y - mu
        family <- object$family
        if (is.character(family)) family <- get(family)
        family <- family()
        variance <- family$variance
        dev.resids <- family$dev.resids
        switch(type,
                pearson =  resp/sqrt(variance(mu)),
                deviance = {
                   w <- object$prior.w
                   if(is.null(w))  w <- rep(1, length(mu))
#                  dev <- object$control$dev 
#                  if (dev=="S+") 
#                    new.dev <- sum(dev.resids(y, mu, w))
#                  else {
                     new.dev <- object$rsdev 
#                  } 
                   new.dev
                }
                ,
                response = resp)
}

Try the robcbi package in your browser

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

robcbi documentation built on Aug. 22, 2023, 1:06 a.m.