Learn R Programming

rsq (version 0.6)

rsq.partial: Coefficient of Partial Determination

Description

Calculate the coefficient of partial determination, aka partial R^2, for both linear regression models, and generalized linear regression models.

Usage

rsq.partial(objF,objR=NULL,adj=FALSE)

Arguments

objF
an object of class "lm" or "glm", a result of a call to lm, glm, or glm.nb to fit the full model.
objR
an object of class "lm" or "glm", a result of a call to lm, glm, or glm.nb to fit the reduced model.
adj
logical; if TRUE, calculate the adjusted partial R^2.

Value

Returned values include adjustment and partial.rsq. When objR is not NULL, variable.full and variable.reduced are returned; otherwise variable is returned. is returned.

Details

When the fitting object of the reduced model is not specified, the partial R^2 of each term in the model will be calculated.

References

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

See Also

rsq.

Examples

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

bnfitr <- glm(y~color+weight,family=binomial)
rsq.partial(bnfit,bnfitr)

quasibn <- glm(y~color+spine+width+weight,family=quasibinomial)
rsq.partial(quasibn)

quasibnr <- glm(y~color+weight,family=binomial)
rsq.partial(quasibn,quasibnr)

Run the code above in your browser using DataLab