logregC: Logistic regression analysis with options for weighted...

View source: R/logregC.r

logregCR Documentation

Logistic regression analysis with options for weighted observations, odds ratio reports, model fit statistics, and plots of residuals

Description

Logistic regression analysis function with many useful features. Its standard output included a table of coefficients, table of deviance residuals, and summary of additional model information. Options include weighting observations, additional reports on odds ratios, ANOVA, multiple measures of model fit, proportional reduction in error, and diagnostic plots of residuals.

Usage

logregC(formula, w, data, digits = 3, orci = FALSE, fit.stats = FALSE,
  anova = FALSE, pre = FALSE, printC = FALSE, res.plots = FALSE, ...)

Arguments

formula

should be in dataset$dv ~ datatset$iv1 + dataset$iv2 unless dataset specified in optional data argument.

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).

orci

(Optional) Do you want table reporting odds ratios for coefficients with confidence intervals? (default: FALSE)

fit.stats

(Optional) Do you want a table of assorted model fit statistics? (default: FALSE)

anova

(Optional) Do you want ANOVA table reported? (default: FALSE)

pre

(Optional) Do you want table reporting proportion reduction in error achieved by model? This is a Lambda-style measure of model fit. (default: FALSE)

printC

(Optional) Do you want results printed to .html file in your working directory? Default is FALSE. Set to TRUE to print results.

res.plots

(Optional) Do you want a set of diagnostic plots of model residuals? (default: FALSE)

...

(Optional) Additional arguments passed to glm function (unweighted models) or svyglm function (weighted models).

Value

Returns a glm (unweighted models) or svyglm (weighted models) object.

RCPA3 Package Tutorial Videos

Textbook References

  • Philip H. Pollock and Barry C. Edwards, An R Companion to Political Analysis, 3rd Edition (Thousand Oaks, CA: Sage Publications, Forthcoming 2022), Chapter 14.

  • Philip H. Pollock and Barry C. Edwards, The Essentials of Political Analysis, 6th Edition (Thousand Oaks, CA: Sage Publications, 2020), Chapter 9. ISBN-13: 978-1506379616; ISBN-10: 150637961.

Online Resources

Examples

  library(RCPA3)
  
  
  # basic usage with variable vectors
  logregC(states$battleground2020 ~ states$vep16.turnout)
  
  # with post-estimation analysis
  logregC(states$battleground2020 ~ states$vep16.turnout, orci=TRUE, fit.stats=TRUE, 
          anova=TRUE, pre=TRUE, res.plots=TRUE)
  

RCPA3 documentation built on May 29, 2024, 12:19 p.m.

Related to logregC in RCPA3...