Learn R Programming

rsq (version 0.6)

vresidual: Variance-Function-Based Residual

Description

Calculate the residual which is defined on the basis of the variance function.

Usage

vresidual(y,yfit,family="binomial") vresidual.nb(y,yfit,theta=1)

Arguments

y
the response values;
yfit
the fitted values;
theta
$\theta$ of the negative binomial distribution;
family
a character string naming the family of the generalized linear model. (See family for details.)

Value

Details

They are internal functions called by vsse.

References

Zhang, D. (2016). A coefficient of determination for generalized linear models. The American Statistician, tentatively accepted.

Examples

Run this code
data(hcrabs)
attach(hcrabs)
y <- ifelse(num.satellites>0,1,0)
bnfit <- glm(y~color+spine+width+weight,family=binomial)
ypred <- bnfit$fitted.values

resid<-vresidual(y,ypred,family="binomial")
summary(resid)
head(resid)

Run the code above in your browser using DataLab