pcor: Partial Correlation for Generalized Linear Models

View source: R/rsq.R

pcorR Documentation

Partial Correlation for Generalized Linear Models

Description

Calculate the partial correlation for both linear and generalized linear models.

Usage

pcor(objF,objR=NULL,adj=FALSE,type=c('v','kl','sse','lr','n'))

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.

type

the type of R-squared used:

'v' (default) – variance-function-based (Zhang, 2016), calling rsq.v;

'kl' – KL-divergence-based (Cameron and Windmeijer, 1997), calling rsq.kl;

'sse' – SSE-based (Efron, 1978), calling rsq.sse;

'lr' – likelihood-ratio-based (Maddala, 1983; Cox and Snell, 1989; Magee, 1990), calling rsq.lr;

'n' – corrected version of 'lr' (Nagelkerke, 1991), calling rsq.n.

Details

When the fitting object of the reduced model is not specified, the partial correlation of each covariate (excluding factor covariates with more than two levels) in the model will be calculated.

Value

The partial correlation coefficient is returned.

Author(s)

Dabao Zhang, Department of Statistics, Purdue University

References

Cameron, A. C. and Windmeijer, A. G. (1997) An R-squared measure of goodness of fit for some common nonlinear regression models. Journal of Econometrics, 77: 329-342.

Cox, D. R. and Snell, E. J. (1989) The Analysis of Binary Data, 2nd ed. London: Chapman and Hall.

Efron, B. (1978) Regression and ANOVA with zero-one data: measures of residual variation. Journal of the American Statistical Association, 73: 113-121.

Maddala, G. S. (1983) Limited-Dependent and Qualitative Variables in Econometrics. Cambridge University.

Magee, L. (1990) R^2 measures based on Wald and likelihood ratio joint significance tests. The American Statistician, 44: 250-253.

Nagelkerke, N. J. D. (1991) A note on a general definition of the coefficient of determination. Biometrika, 78: 691-692.

Zhang, D. (2017). A coefficient of determination for generalized linear models. The American Statistician, 71(4): 310-316.

See Also

rsq, rsq.partial.

Examples

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)

rsq documentation built on Oct. 22, 2023, 5:07 p.m.

Related to pcor in rsq...