pcor | R Documentation |
Calculate the partial correlation for both linear and generalized linear models.
pcor(objF,objR=NULL,adj=FALSE,type=c('v','kl','sse','lr','n'))
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. |
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.
The partial correlation coefficient is returned.
Dabao Zhang, Department of Statistics, Purdue University
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.
rsq, rsq.partial
.
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.