regC | R Documentation |
Linear regression analysis function with many useful features. Standard output of results includes table of coefficients, table of residuals, and additional model information. Options for weighting observations, analysis of variance (ANOVA), performing post-estimation diagnostic tests, including testing normality of residuals and constant variance, and generating diagnostic plots of residuals.
regC(formula, w, data, digits = 3, anova = FALSE, norm.test = FALSE,
ncv.test = FALSE, linear.test = FALSE, reset.test = FALSE,
outlier.test = FALSE, vif = FALSE, printC = FALSE, res.plots = FALSE,
...)
formula |
should be in dataset$dv ~ datatset$iv1 + dataset$iv2 unless dataset specified in optional data argument. If weights are specified using w argument, the formula cannot contain functions or logical statements (all variables in the function must be named in the dataset). |
w |
(Optional) Sampling weights of variable, must be numeric; should be in dataset$weightvar form unless dataset specified in optional data argument. |
data |
(Optional) Name of dataset that contains dv, iv (and w) variables. |
digits |
(Optional) Number of decimal places reported in result (defaults to 2). |
anova |
(Optional) Do you want ANOVA table reporting F-test for all predictors? (default: FALSE) |
norm.test |
(Optional) Test assumption that regression residuals follow normal distribution (default: FALSE) |
ncv.test |
(Optional) Test assumption that regression residuals have constant variance (default: FALSE) |
linear.test |
(Optional) Report results of linearity test? (default: FALSE) |
reset.test |
(Optional) Report results of model specification test? (default: FALSE) |
outlier.test |
(Optional) Test whether outlier observations have outsized leverage on results (default: FALSE) |
vif |
(Optional) Report variance inflation factors to assess multicollinearity? (default: FALSE) |
printC |
(Optional) Do you want to print tables of results (and residuals plots if res.plots=TRUE) to .html file in working directory? (default: FALSE) |
res.plots |
(Optional) |
... |
(Optional) Additional arguments passed to |
Returns a lm or svyglm object.
Bivariate Regression Analysis with RCPA3 Package's regC Function 10:31
Multiple Regression Analysis with RCPA3 Package's regC Function 14:55
Analyzing Regression Residuals with RCPA3 Package's regC Function 12:41
Complete Playlist of RCPA3 Package Tutorial Videos, includes video for this function and many more.
Philip H. Pollock and Barry C. Edwards, An R Companion to Political Analysis, 3rd Edition (Thousand Oaks, CA: Sage Publications, Forthcoming 2022), Chapters 11, 12, 13.
Philip H. Pollock and Barry C. Edwards, The Essentials of Political Analysis, 6th Edition (Thousand Oaks, CA: Sage Publications, 2020), pp. 244-271. ISBN-13: 978-1506379616; ISBN-10: 150637961.
R Tutorials & Resources for Correlation and Bivariate Regression, Multiple Regression, and Analyzing Regression Residuals, compiled by Barry C. Edwards.
Sage Edge Resources for Political Analysis Series, for streaming videos, flashcards, and more student resources for textbooks by Pollock and Edwards, from Sage Publications.
Political Science Data Web Site: Find datasets for your own research and resources to help with the analysis.
library(RCPA3)
# basic usage
regC(states$vep20.turnout ~ states$hs.or.more)
# with w and data arguments
regC(nes$ft.unions ~ nes$ft.dem, w=nes$wt)
# multiple IV with some post-estimation tests
regC(peace.index ~ vdem.edi.score + hdi, data=world, norm.test=TRUE, ncv.test=TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.