| Type: | Package | 
| Title: | Data and Functions for R Companion to Political Analysis 3rd Ed | 
| Version: | 1.3.1 | 
| Description: | Bundles the datasets and functions featured in Philip H. Pollock and Barry C. Edwardshttps://edge.sagepub.com/pollock, "An R Companion to Political Analysis, 3rd Edition," Thousand Oaks, CA: Sage Publications. | 
| License: | CC0 | 
| LazyData: | TRUE | 
| RoxygenNote: | 7.3.2 | 
| Encoding: | UTF-8 | 
| Depends: | R (≥ 4.0) | 
| Imports: | beepr, car, descr, graphics, grDevices, haven, Hmisc, knitr, lmtest, methods, stats, survey, utils, weights | 
| Suggests: | hexbin, rgl, scatterplot3d, gdata | 
| NeedsCompilation: | no | 
| Packaged: | 2024-12-04 18:51:48 UTC; Barry Edwards | 
| Author: | Barry Edwards [aut, cre] | 
| Maintainer: | Barry Edwards <bce@uga.edu> | 
| Repository: | CRAN | 
| Date/Publication: | 2024-12-05 08:30:22 UTC | 
Confidence interval of a dataset variable's sample mean in table and figure
Description
Reports the confidence interval of a sample mean in table and plot. Default is 95% CI but use can raise or lower confidence level.
Usage
CImean(x, w, data, digits = 3, level = 95, pop.sd, printC = FALSE,
  plot = TRUE, main, xlab, xlim, ...)
Arguments
| x | A numeric variable, should be in dataset$var form unless dataset specified in optional data argument. | 
| w | (Optional) Sampling weights of variable (optional), must be numeric; should be in dataset$weightvar form unless dataset specified in optional data argument. | 
| data | (Optional) Name of dataset that contains x (and w) variable (optional). | 
| digits | (Optional) Number of decimal places reported in result (defaults to 3). | 
| level | (Optional) A single number equal to the desired confidence level (i.e. 95, 99, 90, etc.). Default value is 95 percent confidence level. | 
| pop.sd | (Optional) A single number equal to the known population standard deviation of x. This value is rarely know, but if it is, critical values for confidence interval are based on standard normal distribution. | 
| printC | (Optional) Do you want results printed to .html file in your working directory? Default is FALSE. Set to TRUE to print results. | 
| plot | (Optional) Do you want a plot of the confidence interval? Default is TRUE. | 
| main | (Optional) Change the main title of plot. Default title generated from level, x, and w. | 
| xlab | (Optional) Label for x-axis of confidence interval plot. | 
| xlim | (Optional) Modify x-axis limits of confidence interval plot. | 
| ... | (Optional) additional arguments passed to  | 
Value
Returns the confidence interval as a vector of numeric values (the lower and upper bounds).
RCPA3 Package Tutorial Videos
-  Confidence Intervals for Sample Means with RCPA3's CImean Function 16:16 
-  Complete Playlist of RCPA3 Package Tutorial Videos, includes video for this function and many more. 
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 8. 
- Philip H. Pollock and Barry C. Edwards, The Essentials of Political Analysis, 6th Edition (Thousand Oaks, CA: Sage Publications, 2020), pp. 184-186. ISBN-13: 978-1506379616; ISBN-10: 150637961. 
Online Resources
-  R Tutorials & Resources for Foundations of Inference, 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. 
Examples
 
  library(RCPA3)
  
  CImean(nes$age)
  
  ## Not run: 
  # using optional w, level, and data arguments
  CImean(x=nes$age, w=nes$wt, level=90)
  CImean(x=age, data=nes, level=95)
  
## End(Not run)
Confidence intervals of a dataset variable's sample proportions in table and figure
Description
Reports the confidence interval of sample proportions in table and plot. Default is 95% CI but use can raise or lower confidence level.
Usage
CIprop(x, w, data, digits = 3, level = 95, printC = FALSE, plot = TRUE,
  main, xlab, xlim, ...)
Arguments
| x | A nominal or ordinal variable (factor), should be in dataset$var form 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 x (and w) variable. | 
| digits | (Optional) Number of decimal places reported in result (defaults to 3). | 
| level | (Optional) A single number equal to the desired confidence level (i.e. 95, 99, 90, etc.). Default value is 95 percent confidence level. | 
| printC | (Optional) Do you want results printed to .html file in your working directory? Default is FALSE. Set to TRUE to print results. | 
| plot | (Optional) Do you want a plot of the confidence interval? Default is TRUE. | 
| main | (Optional) Change the main title of plot. Default title generated from level, x, and w. | 
| xlab | (Optional) Label for x-axis of confidence interval plot. | 
| xlim | (Optional) Modify x-axis limits of confidence interval plot. | 
| ... | (Optional) Additional arguments passed to  | 
Value
Returns a data frame that gives the lower bound, point estimate, and upper bounds of each value of x variable.
RCPA3 Package Tutorial Videos
-  Confidence Intervals for Sample Proportions with RCPA3's CIprop Function 18:29 
-  Complete Playlist of RCPA3 Package Tutorial Videos, includes video for this function and many more. 
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 8. 
- Philip H. Pollock and Barry C. Edwards, The Essentials of Political Analysis, 6th Edition (Thousand Oaks, CA: Sage Publications, 2020), pp. 184-186. ISBN-13: 978-1506379616; ISBN-10: 150637961. 
Online Resources
-  R Tutorials & Resources for Foundations of Inference, 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. 
Examples
 
  library(RCPA3)
  CIprop(nes$lifex.knowimmig)
  
  ## Not run: 
  # using optional w and data arguments
  CIprop(x=nes$lifex.knowimmig, w=nes$wt)
  CIprop(x=lifex.knowimmig, w=wt, data=nes)
  
## End(Not run)
Calculates Cramer's V
Description
Calculates Cramer's V, a measure of association to gauge the strength of the relationship between two nominal-level variables. A score of 0 indicates no relationship; a score of 1 indicates a perfect relationship.
Usage
CramersV(chi, r, c, n)
Arguments
| chi | A number equal to the Chi-Squared statistic | 
| r | A number equal to the number of rows | 
| c | A number equal to the number of columns | 
| n | A number equal to the sample size | 
Value
The Cramer's V statistic, a number between 0 and 1.
Examples
  library(RCPA3)
  
  CramersV(84.18, 2, 2, 1315)
  CramersV(chi=84.18, r=2, c=2, n=1315)
Generates box plots to compare interval-level dependent variable's distribution across categories of independent variable.
Description
Generates box plots for visual comparison of interval-level dependent variable's distribution across categories of independent variable. Includes option for weighting observations, modifying colors, variable widths. Box plot can be used to compare values of interval-level dependent variable by categories of an independent variable (a factor).
Usage
boxplotC(dv, iv, w, data, main, xlab, ylab, box.col, varwidth = TRUE, ivlabs,
  printC = FALSE, ...)
Arguments
| dv | Dependent variable, should be in dataset$var form unless dataset specified in optional data argument. | 
| iv | Independent variable, should be in dataset$var form 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 (optional). | 
| main | (Optional) Supply custom main label for plot; default uses names of dv and iv. | 
| xlab | (Optional) Supply custom x-axis label for plot; default uses name of iv. | 
| ylab | (Optional) Supply y-axis label for plot; default uses name of dv. | 
| box.col | (Optional) The name of color to use for box colors. Default is "gray80". | 
| varwidth | (Optional) Do you want the widths of boxes to be proportional to number of observations in each group? Default is TRUE; set  | 
| ivlabs | (Optional) A vector of labels for the iv values that are box lablels. | 
| printC | (Optional) Do you want to print box plot to .html file in working directory? (Default: FALSE) | 
| ... | Additional arguments passed to plotting functions,  | 
Value
No return, creates a plot.
RCPA3 Package Tutorial Videos
-  Making Box Plots with RCPA3's boxplotC Function 15:12, shows you how to use the RCPA3 Package's boxplotC function to create box plots that show the relationship between an interval-level dependent variables and a categorical independent variable. 
-  Complete Playlist of RCPA3 Package Tutorial Videos, includes video for this function and many more. 
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 5. 
- Philip H. Pollock and Barry C. Edwards, The Essentials of Political Analysis, 6th Edition (Thousand Oaks, CA: Sage Publications, 2020), pp. 53-55. ISBN-13: 978-1506379616; ISBN-10: 150637961. 
Online Resources
-  R Tutorials & Resources for Graphing Relationships and Describing Patterns, 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 political analysis. 
Examples
  library(RCPA3)
   
  # basic usage with variables as vectors
  boxplotC(dv=nes$ft.rep, iv=nes$partyid3)
  
  # with w and data arguments
  boxplotC(dv=ft.rep, iv=partyid3, w=wt, data=nes)
Dataset for Chapter 6 Exercises, An R Companion to Political Analysis, Third Edition
Description
A hypothetical dataset of human subject research
Usage
ch6ex
Format
A data frame with 100 rows and 7 variables.
- id
- Unique identification number for each subject 
- subject_name
- Last name of subject 
- age
- Age of subject in years 
- partyid
- Self-identified party identification from pretest 
- prior_classes
- Number of political science classes subject has completed 
- site_viewed
- Did subject view the candidate's old or new site in the experiment? 
- site_rating
- Subject's rating of candidate on feeling thermometer after viewing web site 
Source
Barry C. Edwards and Philip H. Pollock, III
Mean comparison analysis function, makes controlled comparisons, generates plots, performs ANOVA
Description
Mean comparison analysis, options for weighted observations and control variable. Also supports several plotting options for basic mean comparisons and controlled mean comparisons. Can conduct single and two-factor analysis of variance (ANOVA) to test differences among multiple means.
Usage
compmeansC(dv, iv, w, z, data, digits = 2, compact = FALSE, ivlabs, zlabs,
  anova = FALSE, printC = FALSE, plot = TRUE, main, xlab, ylab, ylim,
  plot.ci = FALSE, z.palette, legend.title)
Arguments
| dv | Dependent variable, should be in dataset$var form unless dataset specified in optional data argument. | 
| iv | Independent variable, should be in dataset$var form unless dataset specified in optional data argument. | 
| w | (Optional) Sampling weights of variable (optional), must be numeric; should be in dataset$weightvar form unless dataset specified in optional data argument. | 
| z | (Optional) Control 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 (optional). | 
| digits | (Optional) The number of decimal places reported in result (defaults to 2). | 
| compact | (Optional) Do you want compact version of controlled mean comparison table with N and Std. Dev. values omitted? Default is FALSE. Compact display only available for controlled comparisons. | 
| ivlabs | (Optional) A vector of names for the independent variable's values (to abbreviate the mean comparison table's row labels and iv labels on plots) | 
| zlabs | (Optional) A vector of names for the control variable's values (to abbreviate a controlled mean comparison table's column labels and z variable's labels on plots) | 
| anova | (Optional) Do you want to conduct analysis of variance (ANOVA)? Default is FALSE. | 
| printC | (Optional) Do you want results printed to .html file in your working directory? Default is FALSE. Set to TRUE to print results. | 
| plot | (Optional) Do you want a plot of the means? Default is TRUE (makes a bar plot). Additional options: 
 | 
| main | (Optional) Main label for plot, if missing, default main title generated. | 
| xlab | (Optional) x-axis label for plot, if missing, default label generated using iv name. | 
| ylab | (Optional) y-axis label for plot, if missing, default label generated using dv name. | 
| ylim | (Optional) Range of y-axis values on plot. | 
| plot.ci | (Optional) Do you want vertical 95 percent confidence intervals added to line plot of means? Default is FALSE. Only works when  | 
| z.palette | (Optional) For bar and line charts with control variables (z), the name of HCL color palette to use. Default is "LightGrays". See  | 
| legend.title | (Optional) Customize title of legend on plot used for controlling comparisons. | 
Value
Returns a mean comparison table as a matrix of values.
RCPA3 Package Tutorial Videos
-  Make Mean Comparisons with RCPA3's compmeansC Function 13:20, shows you how to use the RCPA3 Package's compmeansC function to compare values of an interval-level dependent variable across categories of an independent variable. 
-  Making Controlled Mean Comparisons with RCPA3's compmeansC Function 25:46 
-  Complete Playlist of RCPA3 Package Tutorial Videos, includes video for this function and many more. 
Textbook References
- Philip H. Pollock and Barry C. Edwards, An R Companion to Political Analysis, 3rd Edition (Thousand Oaks, CA: Sage Publications, Forthcoming 2022), Chapters 4, 5, 7, 10. 
- Philip H. Pollock and Barry C. Edwards, The Essentials of Political Analysis, 6th Edition (Thousand Oaks, CA: Sage Publications, 2020), pp.85-97, 150-156. ISBN-13: 978-1506379616; ISBN-10: 150637961. 
Online Resources
-  R Tutorials & Resources for Making Comparisons, Graphing Relationships and Describing Patterns, Making Controlled Comparisons, and Chi-Square Test and Analysis of Variance, 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. 
Examples
  library(RCPA3)
   
  compmeansC(dv=nes$ft.rep, iv=nes$partyid7, plot=FALSE)
  ## Not run: 
  # basic usage with a plot
  compmeansC(dv=nes$ft.rep, iv=nes$partyid7, w=nes$wt, plot=TRUE)
  
  # basic usage: data argument used
  compmeansC(dv=infant.mortality, iv=region, data=world, plot=FALSE)
  
  # with weights and z variable
  compmeansC(dv=nes$ft.rep, iv=nes$partyid7, w=nes$wt, z=nes$gender, plot="line")
  compmeansC(dv=nes$ft.gay, iv=nes$gender, z=nes$partyid3, compact=TRUE, plot=TRUE)
  
## End(Not run)
Correlation analysis for two or more numeric variables, with options for scatterplots, weighted observations, and inferential statistics.
Description
Given two or more numeric variables, correlateC reports correlation coefficients, along with inferential statistics (if requested), works with sampling weights. If more than two x variables are supplied, the function calculates correlation coefficients using pairwise complete observations (as opposed to limiting analysis to observations complete on all variables).
The wtd.cor function is imported from the weights package. See wtd.cor documentation for details.
Usage
correlateC(x, w, data, digits = 3, stats = FALSE, printC = FALSE,
  plot = FALSE, jitter = FALSE, ...)
Arguments
| x | A list of variables for correlation analysis, variables must be numeric. Should be entered as list(dataset$var1, dataset$var2, dataset$var3 ... ) form unless dataset specified in optional data argument. | 
| w | (Optional) Sampling weights variable, must be numeric; should be in dataset$weightvar form unless dataset specified in optional data argument. | 
| data | (Optional) Name of dataset that contains x (and w) variable (optional). | 
| digits | (Optional) Number of decimal places reported in result (defaults to 3). | 
| stats | (Optional) Do you want the inferential statistics (standard errors, t-statistics, and p-values)? Default is FALSE. Set to TRUE for inferential statistics. | 
| printC | (Optional) Do you want results printed to .html file in your working directory? Default is FALSE. Set to TRUE to print results. | 
| plot | (Optional) Do you want scatterplot(s)? Default is FALSE. | 
| jitter | (Optional) Do you want scatterplot pointed jittered? By default, points jittered when there are more than 500 observations, but you can set this arguments to TRUE/FALSE to override the default. | 
| ... | (Optional) Additional arguments passed to  | 
Details
Makes use of the wtd.cor function, part of the weights package.
Value
Returns the coefficients of correlation among x variables; if stats=TRUE, inferential statistics returned in tables as well.
RCPA3 Package Tutorial Videos
-  Complete Playlist of RCPA3 Package Tutorial Videos, includes video for this function and many more. 
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 11. 
- Philip H. Pollock and Barry C. Edwards, The Essentials of Political Analysis, 6th Edition (Thousand Oaks, CA: Sage Publications, 2020), pp. 240-244. ISBN-13: 978-1506379616; ISBN-10: 150637961. 
Online Resources
-  R Tutorials & Resources for Correlation and Bivariate Regression, 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. 
Examples
   library(RCPA3)
   
   correlateC(x=list(abortlaws, women.stateleg), data=states, plot=FALSE)
   
   ## Not run: 
   # with weighted observations and inferential statistics
   correlateC(x=list(nes$ft.rep, nes$ft.trump.pre, nes$ft.dem, nes$ft.biden.pre), 
              w=nes$wt, stats=TRUE)
   
## End(Not run)
Cross-tabulation analysis, option for weighting observations, makes controlled comparisons, generates plots, performs Chi-Square test, measures strength of association
Description
This is a workhorse function for analyzing the relationship between two variables measured at the nominal or ordinal-level (factors). Basic output is a cross-tabulation with column percentages and counts. Options include weighting observations, adding control variable for controlled cross-tabulation, several plotting options, conducting Chi-Square test of independence, and measuring strength of association.
Usage
crosstabC(dv, iv, w, z, data, digits = 2, compact = FALSE, dvlabs, ivlabs,
  zlabs, chisq = FALSE, lambda = FALSE, somers = FALSE,
  cramers = FALSE, printC = FALSE, plot = TRUE, plot.response, main,
  xlab, ylab, z.palette, legend.title)
Arguments
| dv | Dependent variable, should be in dataset$var form unless dataset specified in optional data argument. Should be a nominal or ordinal-level variable. | 
| iv | Independent variable, should be in dataset$var form unless dataset specified in optional data argument. Should be a nominal or ordinal-level variable. | 
| w | (Optional) Sampling weights of variable, must be numeric; should be in dataset$weightvar form unless dataset specified in optional data argument. | 
| z | (Optional) Control 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). | 
| compact | (Optional) Do you want compact display of cross-tabulation with row subtotals omitted? Default is FALSE. | 
| dvlabs | (Optional) A vector of names for the dependent variable's values (to abbreviate the cross-tabulation's row labels and dv labels on plots) | 
| ivlabs | (Optional) A vector of names for the independent variable's values (to abbreviate the cross-tabulation's column labels and iv labels on plots) | 
| zlabs | (Optional) A vector of names for the control variable's values (to abbreviate the controlled cross-tabulation's column labels and z variable labels on plots) | 
| chisq | (Optional) Do you want to conduct Chi-Square Test? If z argument specific, Chi-Square Test conducted on dv-iv relationship for each value of z. | 
| lambda | (Optional) Do you want Lambda reported? If z argument specified, Lambda reported for dv-iv relationship for each value of z. | 
| somers | (Optional) Do you want Somers' d reported? If z argument specific, Somers' D reported for dv-iv relationship for each value of z. | 
| cramers | (Optional) Do you want Cramer's V reported? If z argument specific, Cramer's V reported for dv-iv relationship for each value of z. | 
| printC | (Optional) Do you want to print cross-tabulation and plot (if plot is used) to .html file in working directory? (default: FALSE) | 
| plot | (Optional) Do you want a plot of the cross-tabulation? Default is TRUE (and makes a bar plot). Other plot options: 
 | 
| plot.response | (Optional) The dv value to be summarized on plot. To combine and plot multiple dv values, use transformC and create dummy variable to be plotted. Set  | 
| main | (Optional) Main label for plot | 
| xlab | (Optional) x-axislabel for plot | 
| ylab | (Optional) y-axis label for plot | 
| z.palette | (Optional) For bar and line plots with control variables (z), the name of HCL color palette to use. Default is "LightGrays". See  | 
| legend.title | (Optional) Title for legend shown if plot used with z argument. | 
Value
Returns a cross-tabulation
RCPA3 Package Tutorial Videos
-  Create Cross-Tabulations to Make Comparisons with RCPA3's crosstabC Function 13:31 
-  Plots for Cross-Tabulations with RCPA3's crosstabC Function 29:51 
-  Making Controlled Comparisons with RCPA3's crosstabC Function 28:34 
-  Complete Playlist of RCPA3 Package Tutorial Videos, includes video for this function and many more. 
Textbook References
- Philip H. Pollock and Barry C. Edwards, An R Companion to Political Analysis, 3rd Edition (Thousand Oaks, CA: Sage Publications, Forthcoming 2022), Chapters 4, 5, 7, 10. 
- Philip H. Pollock and Barry C. Edwards, The Essentials of Political Analysis, 6th Edition (Thousand Oaks, CA: Sage Publications, 2020), pp.85-97, 150-156, 215-231. ISBN-13: 978-1506379616; ISBN-10: 150637961. 
Online Resources
-  Tutorials & Resources for Making Comparisons, Graphing Relationships and Describing Patterns, Making Controlled Comparisons, and Chi-Square Test and Analysis of Variance, 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. 
Examples
 
  library(RCPA3)
  
  ## Not run: 
  crosstabC(dv=nes$death.penalty, iv=nes$partyid3)
  # with optional w, data, chisq, somers arguments
  crosstabC(dv=death.penalty, iv=partyid3, w=wt, data=nes, chisq=TRUE, somers=TRUE)
  
  # example with optional w, data, z, and plot="line" arguments
  crosstabC(dv=death.penalty, iv=partyid3, w=wt, data=nes, z=gender, plot="line")
  
## End(Not run)
Debate Experiment dataset for R Companion to Political Analysis, Third Edition
Description
A dataset with variables about students who participated in an experiment. This dataset is used to demonstrate application of R to political analysis. See book Appendix for variable names and descriptions.
Usage
debate
Format
A data frame with 171 rows and 14 variables.
- obs
- Unique identification number for each subject 
- assignment
- Name of condition subject was assigned to 
- tv
- Did subject watch debate on TV? 1 = yes, 0 = no 
- debinfo
- Number correct answers on five question quiz about the debate. 
- catholic
- Is subject Catholic? 1 = yes, 0 = no 
- issues
- Which candidate do you agree with on policy issues? 
- integrity
- Which candidate has more integrity? 
- leadership
- Which candidate is more effective leader? 
- empathy
- Which candidate has more empathy? 
- sophdum
- Is respondent a sophomore? 1 = yes, 0 = no. 
- won
- Which candidate won the debate? 1 = Kennedy ... 4 = Tie ... 7 = Nixon 
- pid
- Self-reported partisan identification on standard 1-7 scale 
- ideology
- Self-reported political ideology on standard 1-7 scale 
- gender
- Subject's gender, 0 = male, 1 = female. 
Source
Jamie Druckman. See Appendix of printed textbook for further information.
Deprecated functions (and how to still use them)
Description
A number of functions we used in our R Companion to Political Analysis, 2nd Edition are not used in R Companion to Political Analysis, 3rd Edition. These deprecated functions have been superseded by new and improved functions in the 3rd Edition. This page lists the deprecated functions and provides reference information for anyone used to using these functions.
-  AdjR2 calculated adjusted R-Squared statistic. This function was called after estimating a (weighted) model that did not report adjusted R-Squared statistic. Adjusted R-Square is now calculated automatically by the regCandlogregCfunctions.
-  CI95 calculated the 95 percent confidence interval of a sample statistic (returning the upper and lower boundaries). The CIpropandCImeanfunctions generate confidence intervals for sample proportions and sample means (default confidence level=95). To find confidence interval of difference of sample proportions, usetestpropsC. To find confidence interval of difference of sample means, usetestmeansC.
-  CI99 calculated the 99 percent confidence interval of a sample statistic (returning the upper and lower boundaries). The CIpropandCImeanfunctions generate confidence intervals for sample proportions and sample means (use argument level=99). To find confidence interval of difference of sample proportions, usetestpropsCwith argument ci.level=99. To find confidence interval of difference of sample means, usetestmeansCwith argument ci.level=99.
-  colPercents calculated column percentages tables for multi-dimensional controlled cross-tabulations, based on function by John Fox. Was used by the xtabC function. Column percentages are calculated automatically by the crosstabCfunction.
-  compADPQ calculated a statistic for measure of association in cross-tabulation. This function was called by tablesomersDC function (also deprecated). The Somers' d measure of association is calculated by crosstabCfunction with somers=T argument.
-  compmeans was used for mean comparison analysis. The compmeans function was imported from descr package, See compmeansdocumentation for details. For mean comparison analysis, we now featurecompmeansCwhich extends the functionality of compmeans to controlled comparisons, graphings, and analysis of variance.
-  crosstab function was imported from the descr package. See crosstabdocumentation for details.
-  csv.get was used to import files in comma separated value (csv) format. This function was imported from the Hmisc package. See csv.getdocumentation for details.
-  cut2 was used to recode numeric variables into ordered factors. This function was imported from the Hmisc package. See cut2documentation for details.
-  describe was used to generate descriptive statistics. This function is imported from the Hmisc package. See describedocumentation for details.
-  ddply was used to generate summary statistics prior to graphing. The function was imported from the plyr package. See plyr package's ddply function documentation for details. 
-  freq was used for frequency distribution analysis. This function is imported from the descr package. See freqdocumentation for details.
-  imeansC produced a controlled mean comparison table. Rows defined by values of independent variable and columns defines by values of the control variable. 
-  iplotC generated an interaction plot used brkdn.plot function from plotrix package and svyby function from survey package. Warnings suppressed so the function creates plot without generating intermediate results used to create plot. 
-  plotmeans was used to plot mean values to visualize mean comparisons. This function was imported from the gplots package. See gplots package's plotmeans function documentation for details. 
-  plotmeansC plotted the mean values of a dependent variable at different values of nominal or ordinal independent variable. Made use of survey package and gplot package's plotmeans function. 
-  prop.testC was used to test differences of proportions. Deprecated function to test difference of proportions. 
-  SetTextContrastColor determined whether black or white better contrasted with a given color. Used by the Colorsfunction.
-  somersD calculated the Somers' D measure of association statistic. This function made use of the svytable function from the survey package. 
-  spss.get was used to import datasets in SPSS format. The spss.get function is imported from the Hmisc package. See spss.getdocumentation for details.
-  stata.get was used to import Stata-format datasets. The stata.get function is imported from the Hmisc package. See stata.getdocumentation for details.
-  svyboxplot was used to make a box plot with option for weighted observations. The svyboxplot function is imported from the survey package. See svyhistdocumentation for details.
-  svychisq conducted a Chi-Square test with weighted observations. This function reports chi-squared test statistic based on weighted dataset 
-  svychisq was used to implement a Chi-Square test with weighted observations. The svychisq function is imported from the survey package. See svychisqdocumentation for details.
-  svyglm was used to estimate logistic regression model with weighted observations. The svyglm function is imported from the survey package. See svyglmdocumentation for details.
-  svymean was used to calculate sample mean for weighted observations. The svymean function is imported from the survey package. See surveysummarydocumentation for details.
-  svytable was used to generate cross-tabulations with weighted observations. The svytable function is imported from the survey package. See survey package documentation for details. 
-  wtd.boxplot generated a box plot with option for weighted observations. Deprecated function to generate box plot 
-  wtd.chi.sq was used for a Chi-Square test with weighted observations. The wtd.chi.sq function is imported from the weights package. See wtd.chi.sqdocumentation for details.
-  wtd.t.test was used to conduct t-tests on sample means with weighted observations. This function is imported from the weights package. See wtd.t.testdocumentation for details.
-  wtd.ttestC was used to test difference of means using t-test. Deprecated function to test difference of means. 
-  xtabC did controlled cross tabulation analysis with optional weights. 
-  xtp generated cross-tabulation of two categorical variables and produced a mosaic plot. Made use of the crosstab function in the descr package. 
-  xtp.chi2 did cross tabulation analysis with Chi-Square test. This function made use of the crosstab function from the descr package 
Usage
AdjR2()
CI95()
CI99()
colPercents()
compADPQ()
compmeans()
crosstab()
csv.get()
cut2()
describe()
ddply()
freq()
imeansC()
iplotC()
plotmeans()
plotmeansC()
prop.testC()
SetTextContrastColor()
somersD()
spss.get()
stata.get()
svyboxplot()
svychisqC()
svychisq()
svyglm()
svymean()
svytable()
wtd.boxplot()
wtd.chi.sq()
wtd.t.test()
wtd.ttestC()
xtabC()
xtp()
xtp.chi2()
Value
Returned a list of statistics
Generates table of descriptive statistics for one or more variables in a dataset
Description
Prints a table of descriptive statistics for variable(s) specified with x argument. Works with variables measures at any level but output varies with level of measurement (e.g. you won't get standard deviation for a nominal variable). Option for weighting observations.
Usage
describeC(x, w, data, digits = 3, printC = FALSE)
Arguments
| x | A variable or list of variables, should be in dataset$var form 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 x (and w) variable. | 
| digits | (Optional) Number of decimal places reported in result (defaults to 3). | 
| printC | (Optional) Do you want to print table of descriptive statistics to .html file in working directory? (default: FALSE) | 
Value
Table of descriptive statistics
RCPA3 Package Tutorial Videos
-  Generate Descriptive Statistics with RCPA3 Package's describeC Function 17:40 
-  Complete Playlist of RCPA3 Package Tutorial Videos, includes video for this function and many more. 
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 2. 
- Philip H. Pollock and Barry C. Edwards, The Essentials of Political Analysis, 6th Edition (Thousand Oaks, CA: Sage Publications, 2020), pp. 39-55. ISBN-13: 978-1506379616; ISBN-10: 150637961. 
Online Resources
-  Tutorials & Resources for Descriptive Statistics, 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. 
Examples
 
  library(RCPA3)
  
  # descriptive statistics for qualitative variables
  describeC(x=world$region)
  
  ## Not run: 
  # descriptive statistics for numeric variable
  describeC(x=world$infant.mortality)
  
  # describe multiple variables in list, with optional w argument
  describeC(x=list(angry.about.things, approve.cong), w=wt, data=nes)
  
## End(Not run)
Calculates model fit statistics for a svyglm linear regression model
Description
Model fit statistics for a svyglm weighted linear regression model (not for weighted logistic regression).
Usage
fit.svyglm(svyglm, digits = 3)
Arguments
| svyglm | An object of type svyglm. This object is the output of the svyglm function as well as regC function with w argument. | 
| digits | Number of digits to report after decimal place, optional (default = 3). | 
Value
Returns a numeric vector of R-Squared and Adjusted R-sSquared statistics.
Examples
   library(RCPA3)
   
   
   ft.police.model <- regC(ft.police ~ race.ethnicity, w=wt, data=nes)
   fit.svyglm(ft.police.model)
   
Reports the frequency distribution of dataset variable with table and bar chart
Description
Generates frequency distribution table and bar chart to describe distribution of variable values. Based on freq function in descr package.
Usage
freqC(x, w, data, digits = 2, rowlabs, printC = FALSE, plot = TRUE, main,
  xlab, ylab, bar.col, ...)
Arguments
| x | The variable to be analyzed. If dataset not specified with data argument, should be a vector in form dataset$var. | 
| w | (Optional) Sample weights (must be numeric if used), If dataset not specified with data argument, should be in form dataset$weighvar | 
| data | (Optional) Name of dataset that contains x (and w) variable. | 
| digits | (Optional) Number of digits to display after decimal point (default=2). | 
| rowlabs | (Optional) Vector specifying custom text for labeling table rows and chart bars. The rowlabs vector must correspond to x variable's levels (if the variable has five levels, rowlabs must be length 5). Useful when default value labels are too long. | 
| printC | (Optional) Do you want to print frequency distribution table and bar chart (if plot is used) to .html file in working directory? (default: FALSE) | 
| plot | (Optional) Do you want a bar chart? (default set to TRUE) | 
| main | (Optional) Main title of bar chart. | 
| xlab | (Optional) The x-axis label of bar chart. | 
| ylab | (Optional) The y-axis label of bar chart. | 
| bar.col | (Optional) The name of color to use for bars. Default is "gray80". | 
| ... | (Optional) Additional arguments passed to  | 
Value
A frequency distribution table.
RCPA3 Package Tutorial Videos
-  Make Frequency Distribution Tables and Bar Charts with RCPA3 Package's freqC Function 15:33 
-  Complete Playlist of RCPA3 Package Tutorial Videos, includes video for this function and many more. 
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 2. 
- Philip H. Pollock and Barry C. Edwards, The Essentials of Political Analysis, 6th Edition (Thousand Oaks, CA: Sage Publications, 2020), pp. 39-55. ISBN-13: 978-1506379616; ISBN-10: 150637961. 
Online Resources
-  R Tutorials & Resources for Descriptive Statistics, 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. 
Examples
   library(RCPA3)
   
   # unordered factors
   freqC(x=region, data=world)
   
   # ordered factors
   freqC(x=threat.from.china, data=nes)
Imports common dataset file types into R environment
Description
If you don't complete file argument, you will be prompted to select file. Supports dataset file format like Stata, SPSS, Rdata, and csv files. It previews imported data and asks you to confirm before returning a data frame. You must assign the returned data frame to an object to work with it. If getC doesn't support a file type, it may suggest other functions and packages for importing that type of file.
Usage
getC(file, confirm = TRUE, ...)
Arguments
| file | (Optional) Path to file you want to get and load in your R session; if you do not specify file you will be prompted to select one. | 
| confirm | (Optional) Do you want to confirm getting file before function results returned? (default: TRUE) | 
| ... | (Optional) Additional arguments passed to loading function | 
Value
Dataset specified in file argument as a data frame. You must assign this returned data frame to an object to work with it.
RCPA3 Package Tutorial Videos
-  Complete Playlist of RCPA3 Package Tutorial Videos, includes video for this function and many more. 
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 15. 
- Philip H. Pollock and Barry C. Edwards, The Essentials of Political Analysis, 6th Edition (Thousand Oaks, CA: Sage Publications, 2020), pp. 321-327. ISBN-13: 978-1506379616; ISBN-10: 150637961. 
Online Resources
-  R Tutorials & Resources for Doing Your Own Political Analysis, 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. 
Examples
   library(RCPA3)
   
   # basic call will prompt user to choose file
   ## Not run:  
   getC()
   
## End(Not run)
Reference information on graphics parameters, like colors, line types, plotting characters
Description
Students can use these functions as quick references on some of R's plotting options.
The Colors function produces plot of colors available in R. Colored cells labels with numeric value that corresponds to that color. No values supplied to function.
The lineType function displays line types for R plots. No values supplied to function.
The plotChar function displays plotting characters available in R. No values supplied to function.
Usage
Colors()
lineType()
plotChar()
Value
No value returned
No value returned
No return
Examples
  Colors()
  lineType()
  plotChar()
Creates histogram to show distribution of interval (numeric) variable's values
Description
Generates frequency distribution table of binned values and a histogram to describe distribution of variable values.
Usage
histC(x, w, data, breaks, digits = 2, printC = FALSE, plot = TRUE, main,
  xlab, ylab, bar.col, ...)
Arguments
| x | The variable to be analyzed. If dataset not specified with data argument, should be a vector in form dataset$var. | 
| w | (Optional) Sample weights (must be numeric if used), If dataset not specified with data argument, should be in form dataset$weighvar | 
| data | (Optional) Name of dataset that contains x (and w) variable. | 
| breaks | (Optional) Specify how to break the x variable into bins. Options include the number of breaks, a vector specifying the breakpoints, or the name of an algorithm that generates breakpoints. Default value is "Sturges" (other algorithms are "Scott" and "FD", see details in  | 
| digits | (Optional) Number of digits to display after decimal points (default is 2). | 
| printC | (Optional) Do you want the histogram and binned frequencies table printed to working directory? (default: FALSE) | 
| plot | (Optional) Do you want the histogram graphic? (default: TRUE) | 
| main | (Optional) Customize main title for histogram. | 
| xlab | (Optional) Custom label for x-axis of histogram. | 
| ylab | (Optional) Custom label for y-axis of histogram. | 
| bar.col | (Optional) Color for histogram bars; default is "gray80". | 
| ... | (Optional) Additional arguments passed to  | 
Value
A frequency distribution table of binned x variable values.
RCPA3 Package Tutorial Videos
-  Complete Playlist of RCPA3 Package Tutorial Videos, includes video for this function and many more. 
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 2. 
- Philip H. Pollock and Barry C. Edwards, The Essentials of Political Analysis, 6th Edition (Thousand Oaks, CA: Sage Publications, 2020), pp. 39-55. ISBN-13: 978-1506379616; ISBN-10: 150637961. 
Online Resources
-  R Tutorials & Resources for Descriptive Statistics, 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. 
Examples
   library(RCPA3)
   
   histC(x=states$covid.cases.per1000)
   
Converts linear predictor to probability
Description
Calculates predicted probability for a given logged odds value. This function calculates predicted probability for a given logged odds value, often useful for plotting or reporting predicted probabilities.
Usage
inverse.logit(logged_odds)
Arguments
| logged_odds | A numeric value, or vector of numeric values. | 
Value
Returns predicted probability corresponding the the logged odds value, a numeric value between 0 and 1.
Examples
   library(RCPA3)
   
   inverse.logit(0)
   inverse.logit(-5:5)
Calculates Lambda, a measure of association for a cross-tabulation.
Description
Given a table of conditional frequencies, the lambda function calculates and returns Lambda, a measure of association between two categorical variables (factors). Lambda is equal to the proportion of errors reduced by knowledge of the independent variable.
Usage
lambda(tab, digits = 3, detailed = FALSE)
Arguments
| tab | The conditional frequencies of a cross-tabulation. The dependent variable should correspond to rows and the independent variable, to columns. | 
| digits | Number of decimal places of Lambda reported (defaults to 3). | 
| detailed | Do you want detailed report on how lambda value calculated? (default is FALSE). | 
Value
Returns the value of Lambda.
Examples
  library(RCPA3)
  
  conditional.frequencies <- table(dv=states$lgbtq.equality.3cat, iv=states$religiosity3)
  lambda(tab=conditional.frequencies, detailed=TRUE)
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  | 
Value
Returns a glm (unweighted models) or svyglm (weighted models) object.
RCPA3 Package Tutorial Videos
-  Logistic Regression Analysis with RCPA3 Package's logregC Function 13:36 
-  Complete Playlist of RCPA3 Package Tutorial Videos, includes video for this function and many more. 
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
-  R Tutorials & Resources for Logistic Regression, 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. 
Examples
  library(RCPA3)
  
  ## Not run: 
  # 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)
  
## End(Not run)
Logistic regression model fit statistics
Description
Logistic regression model statistics, reported by logregC with fit.stats=TRUE argument, can be used for both weighted and unweighted logregC models.
Usage
logregR2(model, digits = 3)
Arguments
| model | An estimated logistic regression model (a glm or svyglm object) | 
| digits | Number of digits to be displayed after decimal points | 
Value
Returns list of statistics about model (a "LogRegR2" class object)
Examples
   library(RCPA3)
   
   
   logit.model <- logregC(states$battleground2020 ~ states$vep16.turnout)
   logregR2(logit.model)
   
NES dataset for R Companion to Political Analysis, Third Edition
Description
The American National Election Survey polls individuals about their political beliefs and behavior. This dataset is used to demonstrate application of R to political analysis. See book Appendix for variable names and descriptions.
Usage
nes
Format
A data frame with 8280 rows and 429 variables.
- abortion.imp
- PRE: Importance of abortion issue to R 
- abortion.legal
- PRE: STD Abortion: self-placement 
- abortion.scotus
- PRE: SUMMARY: Abortion rights Supreme Court 
- active.duty.mil
- PRE: Armed forces active duty 
- address.yrs
- PRE: Years R lived at address 
- age
- PRE: SUMMARY: Respondent age 
- agree.facts
- PRE: How important that people agree on basic facts 
- allow.refugees
- POST: SUMMARY: Favor/oppose allowing refugees to come to US 
- american.id.import
- POST: How important is being American to R's identity 
- angry.about.things
- PRE: How angry R feels about how things are going in the country 
- approve.aca
- POST: SUMMARY: Approve/disapprove Affordable Care Act 
- approve.cong
- PRE: SUMMARY: Approval of Congress handling its job 
- approve.gov.covid
- PRE: SUMMARY: Approve or disapprove R's governor handling COVID-19 
- approve.local.covid
- PRE: SUMMARY: Approve or disapprove local government handling COVID-19 
- approve.pres.covid
- PRE: SUMMARY: Approve or disapprove President handling COVID-19 
- approve.pres.econ
- PRE: SUMMARY: Approve or disapprove President handling economy 
- approve.pres.hc
- PRE: SUMMARY: Approve or disapprove President handling health care 
- approve.pres.imm
- PRE: SUMMARY: Approve or dissaprove President handling immigration 
- approve.pres.ir
- PRE: SUMMARY: Approve or disapprove President handling foreign relations 
- approve.pres.job
- PRE: SUMMARY: Approve or disapprove President handling job 
- ban.assault.rif
- POST: SUMMARY: Favor/oppose banning 'assault-style' rifles 
- been.arrested
- POST: Has R ever been arrested 
- bible.god.man
- PRE: Is Bible word of God or men 
- biden.cares
- PRE: Democratic Presidential candidate trait: really cares 
- biden.honest
- PRE: Democratic Presidential candidate trait: honest 
- biden.knowledge
- PRE: Democratic Presidential candidate trait: knowledgeable 
- biden.libcon7
- PRE: 7pt scale liberal-conservative: Democratic Presidential candidate 
- biden.strlead
- PRE: Democratic Presidential candidate trait: strong leadership 
- birthright.citizens
- PRE: SUMMARY: Favor or oppose ending birthright citizenship 
- blacks.gotless
- POST: Agree/disagree: blacks have gotten less than they deserve 
- blacks.pastdiff
- POST: Agree/disagree: past slavery & discrimination make it difficult for blacks 
- blacks.tryharder
- POST: Agree/disagree: if blacks tried harder they'd be as well off as whites 
- blacks.workforit
- POST: Agree/disagree: blacks should work their way up without special favors 
- border.wall
- PRE: SUMMARY: Favor or oppose building a wall on border with Mexico 
- born.in.usa
- PRE: Rs: born US, Puerto Rico, or some other country 
- buy.back.rifles
- POST: Favor/oppose government buy back of 'assault-style' rifles 
- campaign.news.carlson
- PRE: Mention: TV PROG - Tucker Carlson Tonight (Fox) 
- campaign.news.colbert
- PRE: Mention: TV PROG - The Late Show with Stephen Colbert 
- campaign.news.hannity
- PRE: Mention: TV PROG - Hannity (Fox) 
- campaign.news.maddow
- PRE: Mention: TV PROG - The Rachel Maddow Show (MSNBC) 
- campaign.news.none
- PRE: Media sources R used to follow presidential campaign: none 
- campaign.news.papers
- PRE: Media sources R used to follow presidential campaign: newspapers 
- campaign.news.radio
- PRE: Media sources R used to follow presidential campaign: radio news 
- campaign.news.tv
- PRE: Media sources R used to follow presidential campaign: tv programs 
- campaign.news.web
- PRE: Media sources R used to follow presidential campaign: internet sites 
- campaign.spendlim
- POST: Limits on campaign spending 
- campaigns.interest
- PRE: How interested in following campaigns 
- cant.get.ahead
- POST: Because of rich and powerful it's difficult for the rest to get ahead 
- care.who.wins
- PRE: How much R cares who wins Presidential Election [revised] 
- case.id
- 2020 Case ID 
- censor.self
- PRE: How often self censor 
- changed.names
- PRE: R name ever changed 
- child.behave
- POST: Which child trait more important: considerate or well-behaved 
- child.manners
- POST: Which child trait more important: curiosity or good manners 
- child.obey
- POST: Which child trait more important: obedience or self-reliance 
- child.respect
- POST: Which child trait more important: independence or respect 
- citizenship.path
- POST: SUMMARY: Favor/oppose providing path to citizeship 
- civ12.argue
- POST: Has R in past 12 months: gotten into a political argument 
- civ12.comment
- POST: Has R in past 12 months: posted comment online about political issue 
- civ12.community
- POST: Has R in past 12 months: worked w/others to deal w/issue facing community 
- civ12.cong
- POST: Has R in past 12 months: contacted member of US Senate or House of Rep 
- civ12.fedoff
- POST: Has R in past 12 months: contacted non-elected official in federal govt 
- civ12.fedpol
- POST: Has R in past 12 months: contacted federal elected official 
- civ12.giveorg
- POST: Has R in past 12 months: given money to other organization 
- civ12.giverelig
- POST: Has R in past 12 months: given money to religious organization 
- civ12.march
- POST: Has R in past 12 months: joined a protest march, rally, or demonstration 
- civ12.meeting
- POST: Has R in past 12 months: attend mtg about issue facing community/schools 
- civ12.petition
- POST: Has R in past 12 months: sign internet or paper petition 
- civ12.stateoff
- POST: Has R in past 12 months: contacted non-elected official in state/local gov 
- civ12.statepol
- POST: Has R in past 12 months: contacted elected official on state/local level 
- civ12.vol
- POST: Has R in past 12 months: done any volunteer work 
- climate.ch.weather
- POST: How much is climate change affecting severe weather/temperatures in US 
- climate.import
- POST: How important is issue of climate change to R 
- community.yrs
- PRE: How long lived in this community YRS 
- consumer.politics
- POST: How often bought or boycotted product/service for social/political reasons 
- contacted.gotv
- POST: Anyone talk to R about registering or getting out to vote 
- covid.election
- PRE: Options for election if COVID-19 continues 
- covid.fed
- PRE: SUMMARY: Federal government response to COVID-19 
- covid.made.lab
- POST: Was the coronavirus (COVID-19) was developed intentionally in a lab or not 
- covid.reopening
- PRE: SUMMARY: Re-opening too quickly or too slowly 
- covid.restrictions
- PRE: Limits placed on public activity due to COVID-19 too strict or not 
- covid.science.help
- POST: How important should science be for decisions about COVID-19 
- death.penalty
- PRE: SUMMARY: R favor/oppose death penalty 
- def.spend.7pt
- PRE: 7pt scale defense spending: self-placement 
- deficit.reduce
- POST: Importance of reducing deficit 
- dem.libcon7
- PRE: 7pt scale liberal-conservative: Democratic party 
- deport.children
- PRE: SUMMARY: Should children brought illegally be sent back or allowed to stay 
- deport.unauth
- POST: SUMMARY: Favor/oppose returning unauthorize immigrants to native country 
- discrim.vs.asians
- POST: Discrimination in the US against Asians 
- discrim.vs.blacks
- POST: Discrimination in the US against blacks 
- discrim.vs.christians
- POST: Discrimination in the US against Christians 
- discrim.vs.glb
- POST: Discrimination in the US against Gays and Lesbians 
- discrim.vs.hispanics
- POST: Discrimination in the US against Hispanics 
- discrim.vs.men
- POST: Discrimination in the US against men 
- discrim.vs.muslims
- POST: Discrimination in the US against Muslims 
- discrim.vs.trans
- POST: Discrimination in the US against transgender people 
- discrim.vs.whites
- POST: Discrimination in the US against whites 
- discrim.vs.women
- POST: Discrimination in the US against women 
- diversity.good.usa
- POST: SUMMARY: Increasing diversity made US better/worse place to live 
- divided.govt
- PRE: Party Control or split government 
- donations.change.votes
- POST: Congress change votes because of donation to campaign 
- econ.current
- PRE: Current economy good or bad 
- econ.lastyear
- PRE: SUMMARY: National economy better or worse in last year 
- econ.mobility.now
- POST: SUMMARY: Economic mobility 
- econ.nextyear
- PRE: SUMMARY: Economy better or worse in next 12 months 
- econ.worry
- PRE: How worried about national economy 
- educ.5cat
- PRE: SUMMARY: Respondent 5 Category level of education 
- education
- PRE: Highest level of Education 
- elect.asians
- POST: How important that more Asians get elected to political office 
- elect.blacks
- POST: How important that more blacks get elected to political office 
- elect.hispanics
- POST: How important that more Hispanics get elected to political office 
- elect.lgbt
- POST: How important that more LGBT people get elected to political office 
- elect.women
- POST: How important that more women get elected to political office 
- elections.govt.attn
- PRE: Elections make government pay attention 
- envir.or.biz
- PRE: 7pt scale environment-business tradeoff: self-placement 
- equal.opp
- POST: Society should make sure everyone has equal opportunity 
- facebook.polpost
- POST: How often post political content on Facebook 
- facebook.use
- POST: How often use Facebook 
- faced.gender.discrim
- POST: How much discrimination has R faced because of gender 
- faced.race.discrim
- POST: How much discrimination has R faced personally because or race/ethnicity 
- fed.bw.better
- POST: SUMMARY: Federal government treats blacks or whites better 
- fedspend.aidpoor
- PRE: SUMMARY: Federal Budget Spending: aid to the poor 
- fedspend.border
- PRE: SUMMARY: Federal Budget Spending: Tightening border security 
- fedspend.crime
- PRE: SUMMARY: Federal Budget Spending: dealing with crime 
- fedspend.environ
- PRE: SUMMARY: Federal Budget Spending: protecting the environment 
- fedspend.highways
- PRE: SUMMARY: Federal Budget Spending: building and repairing highways 
- fedspend.schools
- PRE: SUMMARY: Federal Budget Spending: public schools 
- fedspend.socsec
- PRE: SUMMARY: Federal Budget Spending: Social Security 
- fedspend.welfare
- PRE: SUMMARY: Federal Budget Spending: welfare programs 
- feminist
- POST: Does R consider themself a feminist or anti-feminist 
- feminist.import
- POST: How important is being a feminist 
- finance.lastyear
- PRE: R how much better or worse off financially than 1 year ago 
- finance.nextyear
- PRE: R how much better or worse off financially next year 
- financial.worried
- PRE: How worried is R about current financial situation 
- ft.asian.am
- POST: Feeling thermometer: Asian-Americans 
- ft.asians
- POST: Feeling thermometer: Asians 
- ft.biden.post
- POST: Feeling thermometer: Democratic Presidential candidate: Joe Biden 
- ft.biden.pre
- PRE: Feeling Thermometer: Joe Biden, Democratic Presidential candidate 
- ft.bigbiz
- POST: Feeling thermometer: big business 
- ft.blacks
- POST: Feeling thermometer: blacks 
- ft.blm
- POST: Feeling thermometer: Black Lives Matter 
- ft.capitalists
- POST: Feeling thermometer: capitalists 
- ft.cdc
- POST: Feeling thermometer: Center for Disease Control (CDC) 
- ft.christian.fund
- POST: Feeling thermometer: Christian fundamentalists 
- ft.christians
- POST: Feeling thermometer: Christians 
- ft.congress
- POST: Feeling thermometer: congress 
- ft.conservatives
- POST: Feeling thermometer: conservatives 
- ft.dem
- PRE: Feeling Thermometer: Democratic Party 
- ft.fauci
- POST: Feeling thermometer: Dr. Anthony Fauci 
- ft.fbi
- POST: Feeling thermometer: Federal Bureau of Investigation (FBI) 
- ft.feminists
- POST: Feeling thermometer: feminists 
- ft.gays.lesbians
- POST: Feeling thermometer: gay men and lesbians 
- ft.harris.post
- POST: Feeling thermometer: Democratic Vice Presidential candidate: Kamala Harris 
- ft.harris.pre
- PRE: Feeling Thermometer: Kamala Harris, Democratic Vice-Presidential candidate 
- ft.hispanics
- POST: Feeling thermometer: Hispanics 
- ft.ice
- POST: Feeling thermometer: Immigration and Customs Enforcement (ICE) agency 
- ft.illegal.imm
- POST: Feeling thermometer: illegal immigrants 
- ft.jews
- POST: Feeling thermometer: Jews 
- ft.journalists
- POST: Feeling thermometer: journalists 
- ft.liberals
- POST: Feeling thermometer: liberals 
- ft.metoo
- POST: Feeling thermometer: #MeToo movement 
- ft.muslims
- POST: Feeling thermometer: Muslims 
- ft.nato
- POST: Feeling thermometer: North Atlantic Treaty Organization (NATO) 
- ft.nra
- POST: Feeling thermometer: National Rifle Association (NRA) 
- ft.obama
- PRE: Feeling Thermometer: Barack Obama 
- ft.pence.post
- POST: Feeling thermometer: Republican Vice Presidential candidate: Mike Pence 
- ft.pence.pre
- PRE: Feeling Thermometer: Mike Pence, Republican Vice-Presidential candidate 
- ft.police
- POST: Feeling thermometer: police 
- ft.pp
- POST: Feeling thermometer: Planned Parenthood 
- ft.rep
- PRE: Feeling Thermometer: Republican Party 
- ft.rural
- POST: Feeling thermometer: rural Americans 
- ft.scientists
- POST: Feeling thermometer: scientists 
- ft.scotus
- POST: Feeling thermometer: U.S. Supreme Court 
- ft.socialists
- POST: Feeling thermometer: socialists 
- ft.transgender
- POST: Feeling thermometer: transgender people 
- ft.trump.post
- POST: Feeling thermometer: Republican Presidential candidate: Donald Trump 
- ft.trump.pre
- PRE: Feeling Thermometer: Donald Trump, Republican Presidential candidate 
- ft.un
- POST: Feeling thermometer: United Nations (UN) 
- ft.unions
- POST: Feeling thermometer: labor unions 
- ft.whites
- POST: Feeling thermometer: whites 
- ft.who
- POST: Feeling thermometer: World Health Organization (WHO) 
- gay.adopt
- PRE: Should gay and lesbian couples be allowed to adopt 
- gay.job.discrim
- PRE: SUMMARY: Favor/oppose laws protect gays lesbians against job discrimination 
- gay.marriage
- PRE: R position on gay marriage 
- gay.req.service
- PRE: SUMMARY: Services to same sex couples 
- gender
- PRE: What is your (R) sex? [revised] 
- gov.asst.blacks
- PRE: 7pt scale gov assistance to blacks scale: self-placement 
- govt.act.ineq
- POST: SUMMARY: Favor/oppose government trying to reduce income inequality 
- govt.act.warm.str
- PRE: Government action about rising temperatures (STRENGTH) 
- govt.act.warming
- PRE: Government action about rising temperatures 
- govt.corrupt
- PRE: How many in government are corrupt 
- govt.guar.job
- PRE: 7pt scale guaranteed job-income scale: self-placement 
- govt.hc.7pt
- PRE: 7pt scale gov-private medical insurance scale: self-placement 
- govt.help.hc
- POST: SUMMARY: Increase/decrease government spending to help pay for health care 
- govt.run.byfew
- PRE: Government run by a few big interests or for benefit of all 
- govt.services.7pt
- PRE: 7pt scale spending & services: self-placement 
- govt.under.media
- PRE: How concerned government might undermine media 
- govt.wastes.money
- PRE: Does government waste much tax money 
- govtreg.moreless
- POST: Would it be good for society to have more or less government regulation 
- grand.born.usa
- PRE: How many grandparents born outside the US 
- grew.up.where
- PRE: Where R grew up 
- gun.bg.checks
- POST: SUMMARY: Favor/oppose background checks for gun puchases 
- gun.buying
- POST: Should federal government make it more difficult or easier to buy a gun 
- gun.issue.imp
- POST: How important is issue of gun access to R 
- guns.owned
- PRE: How many Guns owned 
- happy.about.things
- PRE: How happy R feels about how things are going in the country 
- hardvote2020
- POST: How difficult was it for R to vote 
- harrassed.work
- POST: Has R experienced harrassment at work 
- harrassed.work.oft
- POST: How often has R experienced harrassment at work 
- has.daughter
- POST: Does R have any sons or daughters - one or more daughters 
- has.nokids
- POST: Does R have any sons or daughters - no sons and no daughters 
- has.son
- POST: Does R have any sons or daughters - one or more sons 
- have.health.ins
- PRE: Does R have health insurance 
- hc.pay.bills
- PRE: How likely R able to pay all health care costs in next 12 months 
- health
- PRE: Health of R 
- health.lose.ins
- PRE: R concerned about losing health insurance 
- health.pay.costs
- PRE: R concerned about paying for health care 
- help.with.science
- POST: How much do people need help from experts to understand science 
- hh.covid.symp
- PRE: Anyone in household COVID-19 based on symptoms 
- hh.covid.test
- PRE: Anyone in household tested pos for COVID-19 
- hh.family.mem
- PRE: R living with how many family members 
- hh.income
- PRE-POST: SUMMARY: Total (family) income 
- hh.income.pre
- PRE: SUMMARY: Total (family) income 
- hh.landline
- PRE: Is there a working HH landline phone 
- hh.num.child
- PRE: How many children in HH age 0-17 
- hh.partner.status
- PRE: Domestic partnership status 
- hh.union.mem
- PRE: Anyone in HH belong to labor union 
- housing.payments
- PRE: How likely R able to make all housing payments in next 12 months 
- hydrox.treat.covid
- POST: Evidence that hydroxychloroquine is effective treatment for COVID-19 or no 
- immig.crime
- POST: SUMMARY: effect of illegal immiration on crime rate 
- immig.levels
- POST: What should immigration levels be 
- immig.policy
- PRE: US government policy toward unauthorized immigrants 
- immig.take.jobs
- POST: How likely immigration will take away jobs 
- imp.govt.checks
- PRE: How important branches of government keep one another from too much power 
- imp.media.crit
- PRE: How important that news organizations free to criticize 
- imp.off.conseq
- PRE: How important elected officials face serious consequences for misconduct 
- imports.limit
- POST: SUMMARY: Favor/oppose new limits on imports 
- income.gap.change
- PRE: SUMMARY: How much larger is income gap today 
- income.gap.today
- PRE: Income gap today more or less than 20 years ago 
- ineq.worryless
- POST: We'd be better off if worried less about equality 
- intl.force
- PRE: Force to solve international problems 
- invest.stocks
- PRE: Money invested in Stock Market 
- laws.contrib.indiv
- POST: Congress pass laws that benefit contributor individuals 
- laws.contrib.org
- POST: Congress pass laws that benefit contributor organization 
- leader.compromise
- PRE: Prefer government official who compromises or sticks to principles 
- libcon3
- PRE: 3pt scale liberal-conservative self-placement 
- libcon7
- PRE: 7pt scale liberal-conservative self-placement 
- life.sat
- PRE: How satisfied is R with life 
- lifex.buyusa
- POST: Life experience: does R choose products because they are made in America 
- lifex.flyflag
- POST: Life experience: has R displayed American flag on house in past year 
- lifex.foodstamps
- POST: Life experience: has R ever received food stamps or other public assistanc 
- lifex.huntfish
- POST: Life experience: has R gone hunting or fishing in past year 
- lifex.knowimmig
- POST: Life experience: does R know someone moved to U.S. from another country 
- lifex.oweloans
- POST: Life experience: does R currently owe money on student loans 
- lifex.retireacct
- POST: Life experience: does R a have pension or retirement account 
- lifex.ridebus
- POST: Life experience: has R used public transportation in past year 
- lifex.sharkbite
- POST: Life experience: has R ever been bitten by a shark 
- lqb.friendfam
- POST: R has family/neighbors/coworkers/friends who are gay, lesbian or bisexual 
- marital
- PRE: Marital status 
- medical.putoff
- PRE: Put off checkup and vaccines 
- metoo.toofar
- POST: SUMMARY: Attention to sexual harrassment as gone too far/not far enough 
- middle.class.ext
- POST: Is R lower middle class, middle class, upper middle class? [EGSS] 
- min.wage.change
- POST: Should the minimum wage be raised, kept the same, or lowered 
- morals.adjust
- POST: The world is changing & we should adjust view of moral behavior 
- morechance.okay
- POST: Not a big problem if some have more chance in life 
- moreless.govt
- POST:SUMMARY: Less or more government 
- opioid.addiction
- POST: SUMMARY Should federal govt do more/less about opioid drug addiction 
- oth.race.concern
- POST: How often does R have concerned feelings for other racial/ethnic groups 
- oth.race.feel
- POST: How often R imagines how they would feel before criticizing other groups 
- oth.race.persp
- POST: How often does R try to understand perpective of other racial/ethnic group 
- oth.race.protect
- POST: How often R feels protective of someone due to race or ethnicity 
- paid.parent.leave
- PRE: SUMMARY: Require employers to offer paid leave to parents of new children 
- parents.born.usa
- PRE: Native status of parents 
- party.register
- PRE-POST: SUMMARY: Party of registration 
- partyid3
- PRE: Party ID, 3 categories 
- partyid7
- PRE: SUMMARY: Party ID 
- partyid.importance
- PRE: Party identity importance 
- people.fed.lies
- POST: Much of what people hear in schools and media are lies by those in power 
- people.too.sens
- PRE: Need to be more sensitive talking or people too easily offended 
- person.get.ahead
- POST: How much opportunity in America for average person to get ahead 
- pol.asian.infl
- POST: How much influence do Asians have in US politics 
- pol.black.infl
- POST: How much influence do blacks have in US politics 
- pol.dontcare
- POST: [STD] Public officials don't care what people think 
- pol.for.insiders
- POST: Our political system only works for insiders with money and power 
- pol.hispanic.infl
- POST: How much influence do Hispanics have in US politics 
- pol.hurt.fam
- POST: How much have political differences hurt relationships w/family 
- pol.nosay
- POST: [STD] Have no say about what goverment does 
- pol.oligarchy
- POST: Business and politics controlled by few powerful people 
- pol.toocomplex
- POST: [REV] Politics/government too complicated to understand 
- pol.understand
- POST: [REV] How well does R understand important political issues 
- pol.white.infl
- POST: How much influence do whites have in US politics 
- polact.givecand
- POST: R contribute money to individual candidate running for public office 
- polact.giveoth
- POST: R contribute to any other group that supported or opposed candidates 
- polact.giveparty
- POST: R contribute money to political party during this election year 
- polact.meetings
- POST: R go to any political meetings, rallies, speeches, dinners 
- polact.onlinemeet
- POST: R attend online political meetings, rallies, speeches, fundraisers 
- polact.othwork
- POST: R do any (other) work for party or candidate 
- polact.postsign
- POST: R wear campaign button or post sign or bumper sticker 
- polact.talkpol
- POST: R ever discuss politics with family or friends 
- polact.talkvote
- POST: R talk to anyone about voting for or against a party or candidate 
- police.bw.better
- POST: SUMMARY: Police treat blacks or whites better 
- police.stop.lastyr
- POST: During past 12 months, R or any family members stopped by police 
- police.useforce
- POST: How often do police officers use more force than necessary 
- political.violence
- PRE: SUMMARY: Political violence compared to 4 yrs ago 
- politics.attention
- PRE: How often does R pay attention to politics and elections 
- polquiz.fedspend
- PRE: On which program does Federal government spend the least 
- polquiz.german
- POST: Office recall: German Chancellor - Angela Merkel [coded/scheme 1] 
- polquiz.housemaj
- PRE: Party with most members in House before election 
- polquiz.russian
- POST: Office recall: Russian President - Vladimir Putin [coded/scheme 1] 
- polquiz.scotus
- POST: Office recall: SCOTUS Chief Justice - John Roberts [coded/scheme 1] 
- polquiz.sen.term
- PRE: How many years in full term for US Senator 
- polquiz.senatemaj
- PRE: Party with most members in Senate before election 
- polquiz.speaker
- POST: Office recall: Speaker of the House - Nancy Pelosi [coded/scheme 1] 
- polquiz.vp
- POST: Office recall: Vice-President - Mike Pence [coded] 
- postmat.1a
- POST: Post materialism most important 1A 
- postmat.1b
- POST: Post materialism next most important 1B 
- postmat.2a
- POST: Post materialism most important 2A 
- postmat.2b
- POST: Post materialism next most important 2B 
- pref.hiring.blacks
- POST: SUMMARY: Favor/oppose preferential hiring/promotion of blacks 
- pres.ask.foreign
- PRE: Appropriate/inappropriate Pres ask foreign countries to investigate rivals 
- pres.nochecks
- PRE: SUMMARY: Helpful/harmful if Pres didn't have to worry about congress/courts 
- presvote2020
- PRE-POST: SUMMARY: 2020 Presidential vote 
- primary.voter
- PRE: Did R vote in a Presidential primary or caucus 
- protestors.conduct
- PRE: SUMMARY: Protestors actions been mostly violent or peaceful 
- race.ethnicity
- PRE: SUMMARY: R self-identified race/ethnicity 
- reddit.polpost
- POST: How often post political content on Reddit 
- reddit.use
- POST: How often use Reddit 
- reg.greenhouse
- POST: SUMMARY: Favor/oppose increased regulation on greenhouse emissions 
- region
- SAMPLE: Census region 
- relig.ever.attend
- PRE: Ever attend church or religious services 
- relig.how.often
- PRE: Attend religious services how often 
- religion
- PRE: What is present religion of R 
- religion.group
- PRE: SUMMARY: Major group religion summary 
- religion.imp
- PRE: Is religion important part of R life [revised] 
- religious.id
- PRE: Religious identification 
- rep.libcon7
- PRE: 7pt scale liberal-conservative: Republican party 
- restrict.journalists
- PRE: SUMMARY: Favor or oppose restricting journalist access 
- rural.getmore
- POST: SUMMARY: People in rural areas get more/less from government 
- rural.influence
- POST: SUMMARY: People in rural areas have too much/too little influence 
- rural.respect
- POST: SUMMARY: People in rural areas get too much/too little respect 
- rural.urban
- POST: Does R currently live in a rural or urban area 
- rural.urban.id
- POST: How important is urban or rural to R's identity 
- russia.int.election
- PRE: Likelihood of Russian interference in upcoming election 
- russia.interfere
- POST: Did Russia try to interfere in 2016 presidential election or not 
- separate.children
- POST: SUMMARY: Favor/oppose separating children of detained immigrants 
- sexual.orient
- PRE: Sexual orientation of R [revised] 
- smoke.cig.life
- POST: R smoked 100 cigarettes in life 
- smoke.cig.now
- POST: R currently smoking 
- social.class
- POST: How would R describe social class [EGSS] 
- speak.english
- PRE: How important to speak English in US 
- split.ticket
- PRE: Split-ticket voting 
- state
- SAMPLE: Sample location FIPS state 
- stateabbr
- SAMPLE: Sample location state postal abbreviation 
- survey.serious
- PRE: How often took survey seriously 
- talkpol.week
- POST: How many days in past week discussed politics with family or friends 
- tax.rich
- POST: Favor or oppose tax on millionaires 
- terrorism.worry
- POST: DHS: How worried about terrorist attack in near future 
- threat.from.china
- POST: How much is China a threat to the United States 
- threat.from.germany
- POST: How much is Germany a threat to the United States 
- threat.from.iran
- POST: How much is Iran a threat to the United States 
- threat.from.japan
- POST: How much is Japan a threat to the United States 
- threat.from.mexico
- POST: How much is Mexico a threat to the United States 
- threat.from.russia
- POST: How much is Russia a threat to the United States 
- trad.fam.values
- POST: Fewer problems if there was more emphasis on traditional family values 
- trade.agreements
- POST: SUMMARY: Favor/oppose free trade agreements 
- trade.good.ir
- POST: SUMMARY: Increasing trade good/bad for international relationships 
- trade.jobs.abroad
- POST: SUMMARY: International trade increaded/decreased jobs abroad 
- trade.jobs.usa
- POST: SUMMARY: International trade increased/decreased jobs in US 
- trans.friendfam
- POST: R has family/neighbors/coworkers/friends who are transgender 
- trans.military
- POST: SUMMARY: Favor/oppose transender people serve in military 
- trans.policy
- PRE: SUMMARY: Transgender policy 
- treat.people.fair
- POST: If people were treated more fairly we would have fewer problems 
- trump.acquittal
- PRE: SUMMARY: Favor or oppose Senate acquittal decision 
- trump.cares
- PRE: Republican Presidential Candidate trait: really cares 
- trump.corruption
- PRE: SUMMARY: Corruption increased or decreased since Trump 
- trump.deport.more
- POST: Did Trump administration deport more immigrants or did Obama 
- trump.honest
- PRE: Republican Presidential Candidate trait: honest 
- trump.impeachment
- PRE: SUMMARY: Favor or oppose House impeachment decision 
- trump.knowledge
- PRE: Republican Presidential Candidate trait: knowledgeable 
- trump.libcon7
- PRE: 7pt scale liberal-conservative: Republican Presidential candidate 
- trump.strlead
- PRE: Republican Presidential Candidate trait: strong leadership 
- trump.ukraine
- PRE: Did Trump ask Ukraine to investigate rivals 
- trust.dc
- PRE: How often trust government in Washington to do what is right [revised] 
- trust.election.off
- PRE: Trust election officials 
- trust.experts
- POST: SUMMARY: Trust ordinary people/experts for public policy 
- trust.media
- PRE: How much trust in news media 
- trust.people
- PRE: How often can people be trusted 
- turnout2020
- PRE-POST: SUMMARY: Voter turnout in 2020 
- twitter.polpost
- POST: How often post political content on Twitter 
- twitter.use
- POST: How often use Twitter 
- unemploy.lastyear
- PRE: SUMMARY: Unemployment better or worse in last year 
- unemploy.nextyear
- PRE: More or less unemployment in next year 
- unemploy.rate.now
- POST: What is the current unemployment rate 
- univ.basic.income
- POST: SUMMARY: Favor/oppose federal program giving citizens $12K/year 
- urban.unrest
- PRE: Best way to deal with urban unrest 
- usa.better
- POST: SUMMARY: US better or wose than most other countries 
- usa.on.track
- PRE: Are things in the country on right track 
- usa.stay.home
- PRE: SUMMARY: Country would be better off if we just stayed home 
- usa.stronger
- PRE: During last year, US position in world weaker or stronger 
- vaccine.schools
- POST: SUMMARY: Favor/oppose requiring vaccines in schools 
- vaccines.autism
- POST: Does most scientific evidence show vaccines cause autism or not 
- vaccines.risk
- POST: SUMMARY: Health benefits of vaccinations outweigh risks 
- violence.justified
- PRE: Justified to use violence 
- vote.pres.str
- POST: Preference strong for Presidential candidate for whom R vote 
- vote.when.decide
- POST: How long before election R made decision Presidential vote [coded] 
- votes.accurate
- PRE: Votes counted accurately 
- votes.faircount
- POST: How often are votes counted fairly 
- voting.duty.choice
- PRE: SUMMARY: Voting as duty or choice 
- voting.felons
- PRE: SUMMARY: Favor/oppose allowing felons to vote 
- voting.id
- PRE: SUMMARY: Favor/oppose requiring ID when voting 
- voting.mail
- PRE: SUMMARY: Favor/oppose vote by mail 
- voting.rts.denied
- PRE: How often people denied right to vote 
- waitvote2020
- POST: How long was wait time at polling place 
- whenvote2020
- POST: When R voted in 2020 election 
- whites.revdiscrim
- POST: How likely whites unable to find jobs because employers hiring minorities 
- wom.complain.prob
- POST: Do women complaining about discrimination cause more problems 
- wom.control.men
- PRE: Women seek to gain power by getting control over men 
- wom.equal.spfav
- POST: Do women demanding equality seek special favors 
- wom.interp.sexist
- PRE: Women interpret innocent remarks as sexist 
- women.stay.honme
- POST: SUMMARY: Better/worse if man works and woman takes care of home 
- work.employer
- PRE: Describe R's employment 
- work.hoursweek
- PRE: How many hours R worked per week 
- work.lastweek
- PRE: R worked for pay last week 
- work.mom.bond
- POST: SUMMARY: Easier/harder for working mother to bond with child 
- work.status
- PRE: SUMMARY: R occupation status 1 digit 
- world.like.usa
- POST: Better if rest of world more like America 
- world.temp.rising
- POST: Have world temperatuers have risen on average or last 100 years or not 
- wt
- Full sample pre-election weight 
- wt.post
- Full sample post-election weight 
Source
2020 American National Election Survey. See Appendix of printed textbook for further information
Translate logistic regression coefficients into odds ratios with confidence interval
Description
Generates odds-ratios based on logistic regression model coefficients, reported by logregC with orci=TRUE argument
Usage
orci(model, digits = 3)
Arguments
| model | An estimated logistic regression model | 
| digits | Number of digits after decimal to display | 
Value
Returns odds rations and confidence intervals in columns (a matrix class object)
Examples
   library(RCPA3)
   
   
   logit.model <- logregC(states$battleground2020 ~ states$vep16.turnout)
   orci(logit.model)
   
Imported Functions Made Available to Package Users
Description
A number of functions we used in our R Companion to Political Analysis, 2nd Edition are not used in R Companion to Political Analysis, 3rd Edition. For backwards compatibility, we have some functions that simply pass through arguments to a function in another package (allowing user to call them without loading additional packages).
The scatterplot function is imported from the car package.
See scatterplot documentation for details.
The svyby function is imported from the survey package.
See svyby documentation for details.
The svydesign function is imported from the survey package.
See svydesign documentation for details.
The svyplot function is imported from the survey package.
See svyplot documentation for details.
Usage
scatterplot(...)
svyby(...)
svydesign(...)
svyplot(...)
Arguments
| ... | See source package help files for details on function usage. | 
Value
A svyby class object, see svyby documentation for details.
A survey.design class object, see svydesign documentation for details.
Compares full v. reduced logistic regression models with Chi-Squared test
Description
Compares full and reduced logistic regression models with Chi-Square Test to assess whether additional variables of full model are statistically significant.
Usage
pchisqC(reduced, full, digits = 3)
Arguments
| reduced | The reduced logistic regression model as an object. This is model with fewer independent variables. | 
| full | The full logistic regression model as an object. This is model with more independent variables. | 
| digits | (Optional) The number of digits to display after decimal point, default is 3. | 
Value
The chi-squared statistic, df, and p-value as a vector of numbers to test null hypothesis that full model no better than reduced model.
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. 
Examples
   library(RCPA3)
   
   ## Not run: 
   model_full <- logregC(battleground2020 ~ vep16.turnout + adv.or.more, data=states)
   model_reduced <- logregC(battleground2020 ~ vep16.turnout, data=states)
   
   pchisqC(reduced=model_reduced, full=model_full)
   
## End(Not run)
Prints table of results to a .html file in local working directory
Description
Prints table or summary of results to a .html file in local working directory. Converting Console format tables to .html tables helps users quickly create publication- and presentation-ready tables. The .html file's name is displayed as Console message.
Current date added to Table.Output.html file name to keep output organized. You can print output directly from Companion functions using printC=TRUE argument (where available).
Usage
printC(objx, file)
Arguments
| objx | A table or data frame. The table must be html-ready, not all Console output is organized in tables. If objx is not a html-ready table,  | 
| file | (Optional) The path/file name for .html output. If not specified, function will output to .html file in your working directory. | 
Value
No return to R. The formatted objx is outputted to a .html file in working directory.
RCPA3 Package Tutorial Videos
-  Complete Playlist of RCPA3 Package Tutorial Videos, includes video for this function and many more. 
Textbook Reference
- Philip H. Pollock and Barry C. Edwards, An R Companion to Political Analysis, 3rd Edition (Thousand Oaks, CA: Sage Publications, Forthcoming 2022), Chapter 1. 
Examples
   library(RCPA3)
   
   example.table <- freqC(x=world$vdem.4cat, plot=FALSE)
   # running printC will generate a .html file in your working directory
## Not run: 
   printC(example.table, file=tempfile(fileext = ".html"))
## End(Not run)
Generates random sample of nationally representative surnames
Description
Generates a random sample of surnames of any length. Surnames and probabilities from Census Bureau, see <https://www.census.gov/topics/population/genealogy/data/2010_surnames.html>. Used to illustrate random sampling methods.
Usage
random.names(n)
Arguments
| n | The number of random surnames to be generated | 
Value
A vector of surnames
RCPA3 Package Tutorial Videos
* [Complete Playlist of RCPA3 Package Tutorial Videos](https://www.youtube.com/playlist?list=PL3jY4WDTUxoNqrxSSQH4q7XPLPYipeNCu), includes video for this function and many more.
Examples
   library(RCPA3)
   
   random.names(10)
Linear regression analysis (OLS regression), with options for weighted observations, diagnostic tests, and plots of residuals
Description
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.
Usage
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,
  ...)
Arguments
| 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  | 
Value
Returns a lm or svyglm object.
RCPA3 Package Tutorial Videos
-  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. 
Textbook References
- 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. 
Online Resources
-  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. 
Examples
  library(RCPA3)
  
  ## Not run:  
  # 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)
  
## End(Not run)
Plots probability and cumulative density functions (PDFs and CDFs) of sample statistics
Description
Visualize expected sampling distributions for sample statistics. You can plot the probability and cumulative density functions for statistics based on either the normal distribution or a t-distribution.
The sampdistC function also generates the confidence interval (default 95%) for a sample statistic which is useful for obtaining the CI of a summary statistic (when you're not estimating it from the dataset yourself).
Usage
sampdistC(stat, se, t.df, plot.cdf = FALSE, ci = 95, digits = 3,
  printC = FALSE)
Arguments
| stat | A numeric statistic, the point estimate of a parameter based on a sample of observations, like a sample mean or a sample proportion. | 
| se | The standard error of the statistic, must be a positive number. | 
| t.df | (Optional) If critical values for sampling distribution should be based on t-distribution (generally true when statistic is a mean), set t.df to the number of degrees of freedom (typically n-1). | 
| plot.cdf | (Optional) Do you want to plot the cumulative density function? Default = FALSE (for probability density function). | 
| ci | (Optional) Specify desired confidence level for confidence interval as a percentage. Set ci=FALSE to suppress CI table (default: 95) | 
| digits | (Optional) Number of digits after decimal to display in CI table (default: 3) | 
| printC | (Optional) Do you want to sampling distribution plot to .html file in working directory? (default: FALSE) | 
Value
None (makes a plot)
RCPA3 Package Tutorial Videos
-  Viewing Sampling Distributions with RCPA3's sampdistC Function 21:51 
-  Complete Playlist of RCPA3 Package Tutorial Videos, includes video for this function and many more. 
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 8. 
- Philip H. Pollock and Barry C. Edwards, The Essentials of Political Analysis, 6th Edition (Thousand Oaks, CA: Sage Publications, 2020), Chapter 6. ISBN-13: 978-1506379616; ISBN-10: 150637961. 
Online Resources
-  R Tutorials & Resources for Foundations of Inference, 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. 
Examples
 
  library(RCPA3)
  sampdistC(stat=10, se=1)
  
  ## Not run: 
  # based on normal distributions
  sampdistC(stat=10, se=1, plot.cdf=TRUE)
  
  # based on t-distribution with 15 degrees of freedom
  sampdistC(stat=8, se=2, t.df=15)
  sampdistC(stat=8, se=2, t.df=15, plot.cdf=TRUE)
  
## End(Not run)
Sorts dataset observations by user-defined criteria to return case-level information
Description
Returns case-level information in order specified by user. You can sort by additional criteria to break ties. Useful for learning about units of analysis and selecting cases for qualitative research designs.
Usage
sortC(id, by, data, thenby, descending = TRUE, limit, confirm = TRUE,
  printC = FALSE)
Arguments
| id | A variable in the dataset (data) that identfies individual cases, typically the name of states, countries, etc. | 
| by | Variable the cases should be sorted by. | 
| data | (Optional) Dataset to be sorted. | 
| thenby | (Optional) Criteria for sorting cases after sorting with the "by" variable. Useful if many cases tied on first criteria. | 
| descending | (Optional) Should the cases be sorted in descending order? By default, set to TRUE. When sorting ordered factors, check that the levels higher numerically correspond to the sort order you have in mind. | 
| limit | (Optional) The number of rows to report. If there are many observations to be sorted, you may want to limit output to 5, 10, etc. rows. | 
| confirm | (Optional) If function is going to return long table of results (more than 20 rows), you'll be asked for confirmation (use  | 
| printC | (Optional) Do you want to print table of sorted observations to to .html file in working directory? (default: FALSE) | 
Value
A data frame of sorted observations.
RCPA3 Package Tutorial Videos
-  Sort and View Case-Level Information with the sortC Function 12:22 
-  Complete Playlist of RCPA3 Package Tutorial Videos, includes video for this function and many more. 
Textbook References
- Philip H. Pollock and Barry C. Edwards, An R Companion to Political Analysis, 3rd Edition (Thousand Oaks, CA: Sage Publications, Forthcoming 2022), Chapters 2, 6. 
- Philip H. Pollock and Barry C. Edwards, The Essentials of Political Analysis, 6th Edition (Thousand Oaks, CA: Sage Publications, 2020), pp. 122-123. ISBN-13: 978-1506379616; ISBN-10: 150637961. 
Online Resources
-  R Tutorials & Resources for Descriptive Statistics, 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. 
Examples
   library(RCPA3)
   
   # basic usage
   sortC(id=state, by=abortlaws, data=states)
   
## Not run: 
   # options to limit results and sort in ascending order
   sortC(id=country, by=gini.index, descending=FALSE, limit=10, data=world)
   
   # sort by and thenby 
   sortC(id=country, by=vdem.4cat, thenby=gini.index, descending=c(FALSE, FALSE), 
         data=world, confirm=FALSE)
   sortC(id=country, by=vdem.4cat, thenby=gini.index, descending=c(FALSE, TRUE), 
         data=world, confirm=FALSE)
 
## End(Not run)
States dataset for R Companion to Political Analysis, Third Edition
Description
A dataset with variables about the 50 states. This dataset is used to demonstrate application of R to political analysis. See book Appendix for variable names and descriptions.
Usage
states
Format
A data frame with 50 rows and 149 variables.
- abortion.rate
- Number of abortions per 1000 women 15-44, 2008 
- abortlaws
- Number of restrictions on abortion 
- abortlaws.3cat
- Restrictiveness of state abortion laws, 3 ordinal categories 
- adv.or.more
- Percentage of 25+ population with graduate or professional degree 
- alcohol
- Alcohol consumption (gal/capita) 2007 
- attend.pct
- Percentage freq attend relig serv (Pew) 
- ba.or.more
- Percentage of 25+ population with bachelor's degree or more 
- battleground2020
- Battleground in 2020 election? 
- biden2020
- Two-party vote share for Biden in 2020 election 
- biden2020.ev
- Electoral College votes for Biden in 2020 election 
- biz.tax.rank
- State business tax climate ranking 
- biz.tax.score
- State business tax climate rating 
- black.percent
- Percentage of population black or African American 
- black.stateleg
- Percent of state legislators who are African American 
- brady.rank
- Brady Campaign ranking 
- brady.score
- Brady Campaign score 
- broadband
- Percentage of households with broadband Internet subscription 
- carfatal
- Motor vehicle fatalities (per 100,000 pop) 
- carfatal07
- Motor vehicle fatalities per 100,000 pop (2007) 
- cig.tax
- Cigarette tax per pack 
- cig.tax.3cat
- Cigarette tax per pack, 3 ordinal categories 
- cigarettes
- Packs bimonthly per adult pop 
- citizen.ideology
- Citizen ideology index 
- clinton2016
- Vote share for Clinton in 2016 election 
- cong.dem
- Percentage of state's 2020 congressional delegation that is Democratic 
- cook.index
- Higher scores more Dem 
- cook.index3
- 3 quantiles of cook_index 
- corrections.incarc.rate
- Population incarcerated per 100,000 state residents 
- corrections.total.rate
- Population under correctional supervision per 100,000 state residents 
- covid.cases
- COVID cases (as of June 2021) 
- covid.cases.per1000
- COVID cases per 1,000 persons (as of June 2021) 
- covid.deaths
- COVID deaths (as of June 2021) 
- covid.deaths.per1000
- COVID deaths per 1,000 persons (as of June 2021) 
- covid.response.max
- Maximum of COVID response stringency index 
- covid.response.mean
- Mean of COVID response stringency index 
- covid.vaccinated
- Percentage of population fully vaccinated against COVID (as of June 2021) 
- crime.rate.burglary
- Burglary rate, per 100,000 population 
- crime.rate.murder
- Murder and non-negligent manslaughter rate, per 100,000 population 
- crime.rate.property
- Property crime rates, per 100,000 population 
- crime.rate.violent
- Violent crime rate, per 100,000 population 
- deathpen.executions
- Executions since 1976 
- deathpen.exonerations
- Death penalty exonerations since 1973 
- deathpen.status
- Does state retain death penalty? 
- defexpen
- Federal defense expenditures per capita 
- dem.stateleg
- Percent of state legislators who are Democrats 
- density
- Population per square mile 
- division
- Census division 
- drug.death.rate
- Drug overdose death rate per 100,000 adults 
- earmarks.pcap
- Earmarks per capita (in dollars) 
- foreign.born
- Percentage of population born outside the United States 
- gay.policy
- Billman's policy scale 
- gay.policy2
- RECODE of gay_policy (Billman's policy scale) 
- gay.policy.con
- Does state have 'most conservative' gay policies? 
- gay.support
- Lax-Phillips opinion index 
- gay.support3
- Gay rights: public support 
- giffords.grade
- Letter grade of state's gun control laws, from Giffords Law Center 
- giffords.rank
- Ranking of state's gun control laws, from Giffords Law Center 
- gini.2016
- GINI index score 
- gini.rank.2016
- Income equality ranking 
- govt.worker
- Precentage workforce government workers (2012) 
- gun.bgchecks
- Background checks per 100,000 pop (2012) 
- gun.dealers
- Gun dealers per 100,000 pop 
- gun.deaths.100k
- Gun deaths per 100k 
- gun.murders
- Gun murder rate (2010) 
- gunlaws
- Number of state gun control laws 
- gunlaws.3cat
- Number of state gun control laws, 3 ordinal categories 
- gunsammo.rank
- Ranking of best states for gun owners 
- hh.income
- Median household income (dollars) 
- hispanic.percent
- Percentage of poulation Hispanic or Latino (of any race) 
- hispanic.stateleg
- Percent of state legislators who are Hispanic/Latino 
- hr.nominate.mean
- Mean NOMINATE score of state's House delegation 
- hs.or.more
- Percentage of 25+ population attained at least high school diploma or equivalent 
- hs.yrs.ss
- Years of social studies required to graduate high school 
- infant.mortality
- Number of infant deaths per 1,000 live births 
- judge.selection
- Method used to select appellate court judges 
- judges.elected
- Does state elect appellate court judges? 
- land.area
- Size of state in square miles 
- legalclimate
- State legal climate rating 2015 
- legalclimate.rank
- State legal climate ranking 2015 
- legis.conservatism
- Rating of conservatism of state legislature 
- legis.prof.rank
- State legislative professionalism rank for 2015 
- legis.prof.score
- State legislative professionalism score for 2015 
- lgbtq.equality.3cat
- Ordinal ranking of state policies for LQBTQ equality 
- lgbtq.equality.laws
- Number of laws passed that advance LQBTQ equality 
- median.age
- Median age (years) 
- medicaid.expansion
- State action on Medicaid expansion pursuant to ACA 
- min.wage
- State minimum wage 
- obesity.percent
- Percentage of adults with a body mass index of 30.0 or higher 
- opioid.rx.rate
- Retail opioid prescriptions dispensed per 100 persons 
- over64
- Percentage of population 65 years and over 
- polarization.house
- Polarization in State Legislatures, Lower chambers 
- polarization.senate
- Polarization in State Legislatures, Upper chambers 
- policy.innovation.rate
- Policy adoption rate score 
- pop2016
- State population, 2016 (in 100k) 
- pop.18.24
- Percentage of population 18 to 24 years old 
- population
- State population in 2020 
- population.change
- Percentage increase/decrease in population from 2010 to 2020 
- pot.policy
- State marijuana laws in 2017 
- poverty.rate
- Percentage of people in poverty 
- prcapinc
- Per capita income 
- preg.teen.rate
- Number of pregnancies per 1,000 women aged 15-19 
- preg.uninten.rate
- Unintended pregnancy rate per 1,000 women 15-44 
- prochoice.percent
- Percentage of adults who say abortion should be legal in all/most cases 
- public.conservative
- Percentage adults self-identifying as conservative 
- public.liberal
- Percentage adults self-identifying as liberal 
- public.moderate
- Percentage adults self-identifying as moderate 
- region
- Census region 
- relig.Cath
- Percentage Catholic (2012) 
- relig.Prot
- Percentage Protestant (2012) 
- relig.high
- Percentage high religiosity (2012) 
- relig.import
- Percent religion "A great deal of guidance" 
- relig.import.2016
- Overall index of religiosity 
- relig.low
- Percentage low religiosity (2012) 
- religiosity
- Relig observance-belief scale (Pew) 
- religiosity3
- Religiosity 
- rtw
- Right to work state? 
- schools.avg.salary
- Average salary of public school teachers 
- schools.spend
- Expenditure per student in average daily attendance 
- schools.st.ratio
- Students enrolled per teacher 
- secularism
- Secularism scale (Pew) 
- secularism3
- 3 quantiles of secularism 
- smokers
- Data_Value 
- south
- Southern state? 
- speak.english.only
- Percentage of population that only speaks English 
- state
- State Name 
- state.govt.rank
- Overall quality of state government administrative functions 
- stateid
- Two-letter abbreviation of state name 
- suicide.rate
- Number of deaths due to intentional self-harm per 100,000 population 
- tax.source
- State's primary revenue source 
- term.limits
- Does state have term limits for legislators? 
- trump2016
- Vote share for Trump in 2016 election 
- trump2016.ev
- Electoral College votes for Trump in 2016 election 
- trump2020
- Two-party vote share for Trump in 2020 election 
- trump2020.ev
- Electoral college votes for Trump in 2020 election 
- turnout.20vs16
- Difference in voter turnout in 2020 compared to 2016 
- under18
- Percentage of population under age 18 
- unemployment
- State unemployment rate 
- uninsured
- No health insurance coverage 
- unionized
- Percent of workers who are union members 
- unionized.4cat
- Ordinal-level measurement of state's percentage union membership 
- urban
- Percent urban population 
- vep16.turnout
- Percent turnout of voting eligible population in 2016 
- vep18.turnout
- Percent turnout of voting eligible population in 2018 
- vep20.turnout
- Percent turnout of voting eligible population in 2020 
- volunteer.hrs.pc
- Volunteer hours per resident 
- volunteer.rate
- Volunteer rate 
- voter.id.law
- Voter identification law in effect in 2017 
- white.percent
- Percentage of population white 
- women.stateleg
- Percent of state legislators who are women 
Source
Data sources vary. See Appendix of printed textbook for further information.
Calculates the Somers' d measure of association for a cross-tabulation.
Description
Given a table of conditional frequencies, tablesomersDC calculates and returns Somers' D, a measure of association between two ordinal-level variables.
Usage
tablesomersDC(tab, dep = 1, digits = 3)
Arguments
| tab | The conditional frequencies of a cross-tabulation. The dependent and independent variable in cross-tabulation should be be ordinal-level (ordered factors). | 
| dep | which dimension stands for the dependent variable (1 = ROWS, 2 = COLS), default is 2. | 
| digits | Number of decimal places reported in result (defaults to 3). | 
Value
Returns the value of Somers' D.
Examples
  library(RCPA3)
  
  conditional.frequencies <- table(dv=states$lgbtq.equality.3cat, iv=states$religiosity3)
  tablesomersDC(tab=conditional.frequencies)
One and two-sample difference of means tests (t-tests) with confidence intervals.
Description
Conducts one and two-sample difference of means tests (t-tests). Options for weighting observations, known population standard deviation, equal or unequal variances, paired observations.
Usage
testmeansC(x1, x2, w, data, dv, iv, digits = 2, var.equal = FALSE,
  paired = FALSE, pop.sd = FALSE, var.test = FALSE, printC = FALSE,
  ci.table = TRUE, ci.level = 95, ci.plot = TRUE, main, xlab, xlim, ...)
Arguments
| x1 | The first variable to be compared (mean of x1 will be compared to mean of x2). Must be numeric variable. Should be in the form dataset$var, unless dataset specified with data argument. | 
| x2 | The variable (or number) to which x1 is compared. Should be in the form dataset$var, unless dataset specified with data argument. You can set x2 equal to a number to conduct a one sample means test. For example, to test whether x1 could have population mean of 50, you'd set x2 = 50. | 
| w | (Optional) Weights variable (optional). Should be in the form dataset$var, unless dataset specified with data argument. | 
| data | (Optional) The dataset that contains x1, x1 and x2, or dv and iv. | 
| dv | The dependent variable. Must be numeric variable. Should be in the form dataset$var, unless dataset specified with data argument. | 
| iv | The independent variable. Should have two distinct values (like treatment and control). Should be in the form dataset$var, unless dataset specified with data argument. | 
| digits | (Optional) Number of digits to report after decimal place, optional (default: 3). | 
| var.equal | (Optional) With two-sample tests, do you want to assume equal variances? (default: FALSE) | 
| paired | (Optional) With two-sample tests, are the observations paired? (default: FALSE) | 
| pop.sd | (Optional) If the population standard deviation is known, you can specify it. | 
| var.test | (Optional) If set to TRUE, will test the assumption that two sample variance are equal using an F test. Default is FALSE. The var.test option implemented for both weighted and unweighted analysis. If you are not using sample weights, you can supplement this F test with additional tests such as  | 
| printC | (Optional) Do you want results printed to .html file in your working directory? Default is FALSE. Set to TRUE to print results. | 
| ci.table | (Optional) Confidence level for calculating the confidence interval of the difference of means, defaults to 95. Set to F or FALSE to omit confidence interval from results. | 
| ci.level | (Optional) Desired confidence level, as percentage (default: 95) | 
| ci.plot | (Optional) Do you want a plot of the confidence interval of the difference of means? (default: TRUE) | 
| main | (Optional) Main title for plot of confidence interval of difference | 
| xlab | (Optional) Label for x-axis of plot of confidence interval of difference | 
| xlim | (Optional) A vector (of length 2) specifying the range of the x-axis, useful to zoom in on CI. | 
| ... | (Optional) Additional arguments passed to  | 
Value
No return
RCPA3 Package Tutorial Videos
-  Testing Means with RCPA3 Package's testmeansC Function 12:22 
-  Complete Playlist of RCPA3 Package Tutorial Videos, includes video for this function and many more. 
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 9. 
- Philip H. Pollock and Barry C. Edwards, The Essentials of Political Analysis, 6th Edition (Thousand Oaks, CA: Sage Publications, 2020), pp.201-215. ISBN-13: 978-1506379616; ISBN-10: 150637961. 
Online Resources
-  R Tutorials & Resources for Hypothesis Tests with One and Two Samples, 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. 
Examples
   library(RCPA3)
   
   ## Not run:  
   # one sample test against hypothesized value
   testmeansC(x1=world$literacy, x2=80)
   
   # with x1 and x2 
   testmeansC(x1=ft.trump.post, x2=ft.pence.post, w=wt, data=nes)
   
   # with paired x1 and x2
   testmeansC(x1=nes$ft.pence.post, x2=nes$ft.pence.pre, w=nes$wt, paired=TRUE)
   # with dv and iv 
   testmeansC(dv=nes$ft.bigbiz, iv=nes$gender, w=nes$wt)
   
## End(Not run)
Tests the difference between two sample proportions, or difference between sample proportion and hypothesized value, with options for weighted observations, confidence intervals
Description
Difference of proportions test with optional sample weights. Reports P-value of two-tailed significance test. Currently limited to testing one response from one dataset. If you want to compare x1 from dataset1 and x2 from dataset2, you can create new dataframe to test as dv ~ iv where dv is vector of x1 and x2 values and iv is vector identifying the source (i.e. dataset1 and dataset2). If you want to compare different responses, such as "Yes" value for x1 and "Agree" value for x2, you will need to transform one of the variables so they have comparable response values.
Usage
testpropsC(x1, x2, w, data, dv, iv, digits = 3, response, printC = FALSE,
  ci.table = TRUE, ci.level = 95, ci.plot = TRUE, main, xlab, xlim, ...)
Arguments
| x1 | A categorical variable | 
| x2 | Value or variable to compare x1 against. | 
| w | (Optional) Weights variable. | 
| data | (Optional) Specify name of dataset (data frame) with x1 and x2 variables (or dv and iv). | 
| dv | Dependent variable | 
| iv | Independent variable, should have only two unique values. For comparison purposes, group1 will be first level of iv and group2 will be the second level of iv. To change order of groups, you can modify levels(iv). | 
| digits | (Optional) Number of digits to report after decimal place, optional (default: 3). | 
| response | (Optional) Identify the response value you wish to compare. If not specified, the function will compare first value of the dv (or x1 variable). If you want to group multiple responses together, use transformC to make dummy variable. | 
| printC | (Optional) Do you want results printed to .html file in your working directory? Default is FALSE. Set to TRUE to print results. | 
| ci.table | (Optional) Do you want a table reporting confidence interval of the difference of proportions? (default: TRUE) | 
| ci.level | (Optional) Desired confidence level, as percentage (default: 95) | 
| ci.plot | (Optional) Do you want a plot of the confidence interval of the difference of proportions? (default: TRUE) | 
| main | (Optional) Main title for plot of confidence interval of difference | 
| xlab | (Optional) Label for x-axis of plot of confidence interval of difference | 
| xlim | (Optional) A vector (of length 2) specifying the range of the x-axis, useful to zoom in on CI. By default,  | 
| ... | (Optional) Additional arguments passed to plot function for the CI plot | 
Value
No return
RCPA3 Package Tutorial Videos
-  Testing Proportions with RCPA3 Package's testpropsC Function 27:33 
-  Complete Playlist of RCPA3 Package Tutorial Videos, includes video for this function and many more. 
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 9. 
- Philip H. Pollock and Barry C. Edwards, The Essentials of Political Analysis, 6th Edition (Thousand Oaks, CA: Sage Publications, 2020), pp.201-215. ISBN-13: 978-1506379616; ISBN-10: 150637961. 
Online Resources
-  R Tutorials & Resources for Hypothesis Tests with One and Two Samples, 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. 
Examples
   library(RCPA3)
   
   ## Not run: 
   # one sample test: x1 variable against hypothesized value (of x2)
   testpropsC(x1=nes$gun.bg.checks, x2=.500, w=nes$wt, response="1. Favor a great deal", 
              xlim=c(0, .2))
   # two sample test x1 versus x2
   testpropsC(x1=approve.local.covid, x2=approve.pres.covid, w=wt, data=nes, 
              response="1. Approve strongly", xlim=c(0, .2))
   
   # test of proportions dv by iv
   testpropsC(dv=marital, iv=gender, w=wt, data=nes, response="3. Widowed", 
              xlim=c(-.10, 0))
   
## End(Not run)
Returns new variables by transforming existing dataset variables (e.g. dummy variables, standardized variables, rank orders)
Description
Given a variable x, the transformC function generates and returns a tranformed version of x. For example, transformC can take a variable x and return standardized x, or the log of x.
Usage
transformC(type, x, data, response, cutpoints, groups, confirm = TRUE, ...)
Arguments
| type | The type of transformation to be made to x. Options include: 
 | 
| x | The variable to be transformed, a variable that already exists, should be in dataset$var form unless dataset specified in optional data argument. | 
| data | (Optional) Name of dataset that contains x variable. | 
| response | (Optional) For  | 
| cutpoints | (Optional) For  | 
| groups | (Optional) For  | 
| confirm | (Optional) By default,  | 
| ... | (Optional) Additional arguments pass to  | 
Value
A transformed version of x variable, a vector with the same length as x, unless type="dummy.set" in which case transformC returns a data.frame.
RCPA3 Package Tutorial Videos
-  Transforming Variables with RCPA3 Package's transformC Function 22:40 
-  Complete Playlist of RCPA3 Package Tutorial Videos, includes video for this function and many more. 
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 3. 
- Philip H. Pollock and Barry C. Edwards, The Essentials of Political Analysis, 6th Edition (Thousand Oaks, CA: Sage Publications, 2020), pp. 55-64. ISBN-13: 978-1506379616; ISBN-10: 150637961. 
Online Resources
-  R Tutorials & Resources for Creating and Transforming Variables, 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. 
Examples
  library(RCPA3)
  
  # don't use confirm=FALSE until you've tested the function call
  transformC("percent.rank", nes$ft.dem, confirm=FALSE)
  transformC("rank", nes$ft.dem, confirm=FALSE)
  transformC("whole", runif(min=0,max=100,n=20), confirm=FALSE)
Welcomes new users to package with basic information, option to reset user's working environment
Description
Welcomes users to RCPA3 package for An R Companion to Political Analysis, 3rd Edition and provides basic information about using Companion functions and datasets.
Usage
welcome(reset = FALSE)
Arguments
| reset | (Optional) Do you want to remove objects from your workspace and restore default graphical parameters? Default is FALSE. Removing workspace objects and restoring default graphical parameters can help undo some unintended side-effects of past work. | 
Value
No value returned
RCPA3 Package Tutorial Videos
-  Complete Playlist of RCPA3 Package Tutorial Videos, includes video for this function and many more. 
Textbook Reference
- Philip H. Pollock and Barry C. Edwards, An R Companion to Political Analysis, 3rd Edition (Thousand Oaks, CA: Sage Publications, Forthcoming 2022), Chapter 1. 
Online Resources
-  R Tutorials & Resources for Getting Started with R, 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. 
Examples
 
  library(RCPA3)
  
  # Welcome message from RCPA3 package.
  ## Not run: 
  welcome()
  
## End(Not run)
An interactive game to practice using R functions.
Description
A fun, interactive game to practice using R functions. Players must execute functions to make widgets per strict specifications to win the game. The Widget Factory needs your help!
Usage
widgetFactory()
Value
No value returned
RCPA3 Package Tutorial Videos
-  Complete Playlist of RCPA3 Package Tutorial Videos, includes video for this function and many more. 
Textbook Reference
- Philip H. Pollock and Barry C. Edwards, An R Companion to Political Analysis, 3rd Edition (Thousand Oaks, CA: Sage Publications, Forthcoming 2022), Chapter 1. 
Online Resource
-  Tutorials & Resources for Using R for Data Analysis, compiled by Barry C. Edwards 
Examples
 
library(RCPA3)
 
# Play the Widget Factory game
## Not run: 
widgetFactory()
## End(Not run)
World dataset for R Companion to Political Analysis, Third Edition
Description
A dataset with variables about countries in the world. This dataset is used to demonstrate application of R to political analysis. See book Appendix for variable names and descriptions.
Usage
world
Format
A data frame with 169 rows and 206 variables.
- arda.code
- Country numerical code 
- bribe.judge
- Prevalence of bribing judges 
- bribe.police
- Prevalence of bribing police 
- broadband
- Broadband subscription per 100 people 
- business.starts
- Number of new corporations registered annually 
- cabrv
- Three-letter abbreviation of country name 
- carbon.footprint
- National carbon footprint 
- ccode
- Numeric country code based on the ISO-3166-1 standard 
- ciaedex
- Percent of GDP spent on education 
- ciagdpag
- Composition of GDP: Agricultural sector 
- ciagdpin
- Composition of GDP: Industrial sector 
- ciagdpsv
- Composition of GDP: Service sector 
- civil.war
- Civil war intensity 
- co2.percap
- Carbon dioxide emissions per capita 
- colony
- Colony of what country? 
- compulsory.voting
- Does country require citizens to vote? 
- confidence
- Confidence in institutions scale 
- conflict.index
- Level of violent conflict in country 
- conflict.internal
- Number of internal conflict without foreign invention 
- conflict.internat
- Number of internal conflict with foreign invention 
- corp.tax.rate
- Corporate tax rate 
- corrupt.perception
- Corruption perception index 
- country
- Country/territory name 
- coup.attempts
- Number of attempted coups d'etat since 1950 
- coups
- Number of successful coups d'etat since 1950 
- covid.cases.permil
- Total COVID cases per million 
- covid.deaths.per.million
- Total COVID deaths per million 
- covid.response.max
- Maximum of COVID response stringency index 
- covid.response.mean
- Mean of COVID response stringency index 
- covid.vaccinated
- Percentage of population fully vaccinated against COVID 
- death.penalty.status
- Legal status of death penalty 
- debt.percent.gdp
- Public debt as a percentage of GDP 
- dem.other
- Percentage of other democracies in region 
- dem.other5
- Percentage of other democracies in region 
- district.size3
- Average number of members per district 
- dnpp.3
- Effective number of parliamentary parties 
- dpi.cemo
- Is chief executive a military officer? 
- dpi.system
- National political system 
- durable
- Number of years since the last regime transition 
- eco.footprint
- Total ecological footprint 
- econ.compete
- Global economic competitiveness 
- econ.freedom
- Rating of overall economic freedom 
- econ.freedom.5cat
- Rating of overall economic freedom, 5 ordinal categories 
- educ.f.avgyrs
- Average Schooling Years, Female 
- educ.f.none
- Percentage of Females with No Schooling 
- educ.m.avgyrs
- Average Schooling Years, Male 
- educ.m.none
- Percentage of Males with No Schooling 
- educ.quality
- Average rating of quality of educational system 
- effectiveness
- Government effectiveness scale 
- eiu.democ.4cat
- Level of democracy, 4 ordinal categories 
- eiu.democ.bin
- Is country a democracy? 
- eiu.democ.score
- Rating of democracy 
- election.integrity
- Integrity of country's electoral system 
- election.violence.post
- Were there riots and protest after election? 
- election.violence.pre
- Were there riots and protest before election? 
- energy.renew.percent
- Percentage of country's energy that is non-fossil fuel 
- enpp3.democ
- Effective number of parliamentary parties 
- enpp3.democ08
- Effective number of parliamentary parties 
- enpp.3
- Effective number of parliamentary parties 
- envir.treaty
- Number of environmental treaties agreed to 
- eu
- EU member state 
- fdi.inflow
- Inflow of foreign direct investment (in millions of US dollars) 
- fertility
- Number children born per woman 
- fh.democ.3cat
- Rating of democracy, 3 ordinal categories 
- fh.democ.score
- Freedom House rating of democracy 
- fh.internet.3cat
- Level of Internet freedom in country, 3 ordinal categories 
- fh.internet.score
- Measure of Internet freedom 
- frac.eth
- Ethnic factionalization 
- frac.eth2
- Ethnic factionalization 
- frac.eth3
- Ethnic factionalization 
- frac.lang
- Language factionalization 
- frac.relig
- Religious factionalization 
- gas.production
- Gas production (in millions of barrels of oil equivalent) 
- gdp.growth
- Annual economic growth rate 
- gdp.percap
- Gross domestic product per capita (in U.S. dollars) 
- gdp.percap.5cat
- Gross domestic product per person, 5 ordinal categories 
- gender.equal3
- Gender empowerment 
- gender.inequality
- Index of gender inequality 
- gini.index
- GINI index (of income inequality) 
- global.social
- Social globalization 
- govt.help.cap
- Capacity of state to provide for needy citizens 
- govt.integrity
- Rating of government integrity 
- govt.per.gdp
- Government spending (all types) as a percentage of GDP 
- govt.quality
- The quality of government 
- gri
- Index of government restrictions on religion 
- grp.name
- Name of government preferred religion 
- grp.score
- Index of government religious preference 
- happiness
- Average happiness in country 
- hdi
- Human development index 
- hiv.percent
- Percentage of population aged 15-49 with HIV 
- homicide.rate
- Intentional homicides per 100,000 persons 
- hospital.beds
- Number of hospital beds per thousand people 
- human.flight
- Human flight and brain drain from country 
- icc.treaty.ratified
- Has country ratified treaty for International Criminal Court? 
- immigrants.percent
- Percentage of population born in another county 
- imprisonment.rate
- Number incarcerated per 100,000 persons 
- income.tax.rate
- Income tax rate 
- indep.judiciary
- Does country have an independent judiciary? 
- indy
- Year of independence 
- infant.mortality
- Number infants dying before age one per 1,000 live births 
- inflation
- Annual inflation rate 
- internet.users
- Percentage of population that uses the Internet 
- judicial.effectiveness
- Rating of effectiveness of country's judiciary 
- judicial.indep.wef
- Average rating of judicial independence 
- laws.protect.prop
- Legal protections for private property rights 
- legal.origin
- Legal origin of commercial code of country 
- legal.quality
- Measure of quality of country's legal institutions 
- life.expectancy
- Life expectancy at birth 
- lifeex.f
- Life expectancy at birth among females 
- lifeex.m
- Life expectancy at birth among males 
- literacy
- Literacy rate 
- media.access.cand
- Does country provide free or subsidized media access for political candidates? 
- media.access.parties
- Does country provide free or subsidized media access for political parties? 
- median.age
- Median age in years 
- migration.net
- Net migration 
- muslim
- Are Muslims predominate religious group? 
- ocean.health
- Measure of health of oceans adjacent to country 
- oecd
- OECD member state? 
- oil
- Oil production, in barrels per day 
- oil.production
- Oil production, in metric tons 
- organized.crime
- Impact of organized crime on the economy 
- peace.5cat
- Peacefulness of country, 5 ordinal categories 
- peace.index
- Peacefulness of country 
- pmat12.3
- Post-materialism 
- pol.terror.scale.ai
- Political terror scale 
- pol.terror.scale.hrw
- Political terror scale 
- polity.score
- Rating of democracy 
- pop.0.14
- Percentage of population age 0-14 
- pop.15.64
- Percentage of population age 15-64 
- pop.65.older
- Percent of population age 65 and older 
- pop.growth
- Percentage population growth/decline annually 
- pop.urban
- Percentage of the population living in urban areas 
- population
- Size of national population 
- population.3cat
- Size of national population, 3 ordinal categories 
- population.density
- Number of people per square kilometer 
- poverty
- Percentage of the population below the poverty line 
- pr.sys
- Proportional representation system? 
- press.freedom.fh
- Freedom of the country's press 
- press.freedom.rsf
- Freedom of the country's press 
- protact3
- Protest activity 
- refugees.from
- Refugees from the country who live in other countries 
- refugees.impact
- Impact of population displacement on country 
- refugees.in
- Refugees from other countries in the country 
- regime.type3
- Regime type 
- region
- Region name 
- regionun
- United Nations region 
- religion
- Largest religion by proportion 
- reserved.seats
- Does country reserve seats in national legislature for any group? 
- rights.assn
- Freedom of assembly and association 
- rights.dommov
- Freedom of domestic movement 
- rights.formov
- Freedom of foreign movement 
- rights.injud
- Independence of the judiciary 
- rights.law.index
- Measure of violations of human right and rule of law 
- rights.relfree
- Freedom of Religion 
- rights.speech
- Freedom of speech 
- rights.treaties
- Number of international human rights treaties ratified 
- rights.wecon
- Women's economic rights 
- rights.wopol
- Women's political rights 
- rights.worker
- Worker's rights 
- schools.internet
- Average rating of internet availability in schools 
- self.employed
- Percentage of labor force that is self-employed 
- sexratio
- Sex ratio at birth 
- shi
- Social hostility toward religion 
- soldiers.percent
- Percentage of labor force in the military 
- soldiers.total
- Total number of people in the military 
- spendeduc
- Public expenditure on education as a percentage of GDP 
- spendhealth
- Public expenditure on health as a percentage of GDP 
- spendmil.wdi
- Public expenditure on the military as a percentage of GDP 
- tariff.rate
- Tariff rate on imports 
- taxes.percent.gdp
- Taxes (all forms) as a percentage of GDP 
- terror.index.voh
- Impact of terrorism on the county 
- trade.percent.gdp
- International trade as percentage of GDP 
- typerel
- Predominant religion 
- unemployment
- Percentage of labor force that is unemployed 
- unexp.rd
- Public expenditure on research and development as a percentage of GDP 
- unfempf
- Ratio of female to male formal employment rates 
- unin.inc
- Inequality-adjusted income index 
- unineduc
- Inequality-adjusted education index 
- unions
- Union density 
- unjourn
- Number of verified cases of journalists imprisoned 
- unlit
- Adult literacy rate 
- unmobcov
- Percentage covered by a mobile phone network 
- unmort.f
- Number of adult female deaths per 1,000 females 
- unmort.m
- Number of adult male deaths per 1,000 males 
- unnewsp
- Daily newspapers per thousand people 
- unnoncom
- Death rates from non-communicable diseases 
- unpop30
- Projected 2030 population in millions 
- unremitp
- Per capita remittance inflows in US dollars 
- unremitt
- Remittance inflows as a percentage of GDP 
- unsathlt
- Percentage satisfied with their personal health 
- unsati
- Overall life satisfaction 
- unsatif
- Overall life satisfaction among females 
- unsatjob
- Percentage satisfied with their job 
- unsatliv
- Percentage satisfied with their standard of living 
- unseced
- Percentage with at least secondary education 
- vdem.2cat
- Is country a democracy or autocracy? 
- vdem.4cat
- Ordinal ranking of democracy, 4 categories 
- vdem.edi.score
- Electoral democracy index 
- vdem.ldi.score
- Liberall democracy index 
- vi.rel3
- Percent saying religion very important 
- violence.cost
- Economic cost of violence on national economy 
- votevap10s
- Turnout of voting age population in 2010s 
- womenleg
- Percent women in lower house of legislature 
- womyear
- Year women first enfranchised 
- womyear2
- Year women first enfranchised 
- youngleg
- Percentage of lower house of legislature aged 40 years or younger 
Source
Sources vary. See Appendix of printed textbook for further information.
Calculates Correlation Coefficient Between Two Numeric Variables Makes use of the wtd.cor function, part of the weights package.
Description
Given two numeric variables, wtd.cor reports correlation coefficient, works with sampling weights. 
The wtd.cor function is imported from the weights package. See wtd.cor documentation for details.
Usage
wtd.cor(x1, x2, w = NULL, data, digits = 3, stats = FALSE, ...)
Arguments
| x1 | A variable (must be numeric), should be in dataset$var form unless dataset specified in optional data argument. | 
| x2 | Another variable, different than x1 (must be numeric), should be in dataset$var form 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 x (and w) variable. | 
| digits | (Optional) Number of decimal places reported in result (defaults: 3). | 
| stats | (Optional) Do you want inferential statistics for correlation coefficient? (default: FALSE) | 
| ... | (Optional) Additional arguments passed to weights::wtd.cor function. | 
Value
Returns the coefficient of correlation between x1 and x2 variables, a numeric value.
Examples
   library(RCPA3)
   
   wtd.cor(x1=nes$ft.rep, x2=nes$ft.pence.pre, w=nes$wt)
   wtd.cor(x1=ft.dem, x2=ft.harris.pre, w=wt, data=nes)
Creates a Histogram Showing Distribution of Variable Values With Option for Weights Makes use of the wtd.hist function, part of the weights package.
Description
Takes in variable and generates histogram plot to show the distribution of its values, works with sampling weights.
The wtd.hist function is imported from the weights package. See wtd.stats documentation for details.
Usage
wtd.hist(x, w = NULL, data, breaks, ...)
Arguments
| x | A variable (must be numeric), should be in dataset$var form unless dataset specified in optional data argument. | 
| w | Sampling weights of variable (optional), must be numeric; should be in dataset$weightvar form unless dataset specified in optional data argument. | 
| data | (Optional) Name of dataset that contains x (and w) variable. | 
| breaks | (Optional) Specifies the breakpoints between bins of the histogram. See  | 
| ... | (Optional) Additional arguments passed to weights::wtd.hist function. | 
Value
Generate a histogram plot.
Examples
   library(RCPA3)
   
   wtd.hist(x=nes$age, w=nes$wt)
Generates Kurtosis Statistic with Option to Weight Observations
Description
Generates Kurtosis Statistic with Option to Weight Observations
Usage
wtd.kurtosis(x, w, data, digits = 3)
Arguments
| x | Variable (a numeric vector) | 
| w | (Optional) Weights variable | 
| data | (Optional) Dataset, can be used to abbreviate x to variable name | 
| digits | (Optional) Number of digits after decimal point (default: 3) | 
Value
Returns the kurtosis of the variable, a numeric value.
Examples
   library(RCPA3)
   
   wtd.kurtosis(x=nes$age, w=nes$wt)
   wtd.kurtosis(x=nes$age)
Calculates Mean of Variable With Option for Weights
Description
Takes in variable and calculates its mean, works with sampling weights.
Makes use of the wtd.mean function, part of the Hmisc package. See wtd.stats documentation for details.
Usage
wtd.mean(x, w = NULL, data, digits = 3, ...)
Arguments
| x | A variable (must be numeric), should be in dataset$var form 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 x (and w) variable. | 
| digits | (Optional) Number of decimal places reported in result (defaults to 3). | 
| ... | (Optional) Additional arguments passed to Hmisc::wtd.mean function. | 
Value
Returns the mean of the variable, a numeric value.
Examples
   library(RCPA3)
   
   wtd.mean(nes$ft.socialists, w=nes$wt)
   wtd.mean(nes$ft.socialists)
   
   wtd.mean(nes$age, w=nes$wt)
   wtd.mean(nes$age)
Find Median of Variable with Option to Weight Observations
Description
Takes in variable and finds median, works with sampling weights. Makes use of the wtd.quantile function, part of the Hmisc package.
Usage
wtd.median(x, w = NULL, data, ...)
Arguments
| x | A variable | 
| w | (Optional) Sampling weights of variable | 
| data | (Optional) Name of dataset that contains x (and w) variable | 
Value
Returns the median value of the variable
Examples
   library(RCPA3)
   
   wtd.median(x=nes$approve.pres.hc, w=nes$wt)
   wtd.median(x=nes$approve.pres.hc)
Find Mode of Variable with Option to Weight Observations
Description
Takes in variable and finds mode, works with sampling weights. Makes use of the freq function, part of the descr package.
Usage
wtd.mode(x, w, data, ...)
Arguments
| x | A variable | 
| w | (Optional) Sampling weights of variable | 
| data | (Optional) A dataset | 
| ... | (Optional) Additional arguments pass to descr::freq function | 
Value
Returns the modal value(s) of the variable, if mode exists
Examples
   library(RCPA3)
   
   wtd.mode(x=nes$angry.about.things, w=nes$wt)
   wtd.mode(x=nes$angry.about.things)
   
   wtd.mode(x=nes$discrim.vs.men, w=nes$wt)
   wtd.mode(x=nes$discrim.vs.men)
Finds the Quantile Values of Variable With Option for Weights
Description
Takes in variable and calculates desired quantile values, works with sampling weights. Makes use of the wtd.quantile function from the Hmisc package. See wtd.stats documentation for details.
Usage
wtd.quantile(x, w = NULL, data, q = c(5, 10, 25, 50, 75, 90, 95),
  digits = 3, ...)
Arguments
| x | A variable (must be numeric), should be in dataset$var form 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 x (and w) variable. | 
| q | (Optional) The quantiles you want calculated as a number or vector of numbers. Input as percentages. For median only, q=50. For quartiles, q=c(25, 50, 75). | 
| digits | (Optional) Number of decimal places reported in result (defaults to 3). | 
| ... | (Optional) Additional arguments passed to Hmisc::wtd.quantile function. | 
Value
Returns quantile values of a variable, a vector of numeric values.
Examples
   library(RCPA3)
   
   wtd.quantile(x=nes$ft.police, q=c(25, 50, 75), w=nes$wt)
   wtd.quantile(x=nes$ft.police, q=c(25, 50, 75))
Calculates Standard Deviation of Variable With Option for Weights
Description
Takes in variable and calculates standard deviation, works with sampling weights. Makes use of the wtd.var function, part of the Hmisc package.
Usage
wtd.sd(x, w = NULL, data, digits = 3, ...)
Arguments
| x | A variable (must be numeric), should be in dataset$var form 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 x (and w) variable. | 
| digits | (Optional) Number of decimal places reported in result (defaults to 3). | 
| ... | (Optional) Additional arguments passed to Hmisc::wtd.var function. | 
Value
Returns the standard deviation of the variable, a numeric value.
Examples
   library(RCPA3)
   
   wtd.sd(x=nes$ft.socialists, w=nes$wt)
   wtd.sd(x=nes$ft.socialists)
Calculates Skewness of Numeric Variable with Option to Weight Observations
Description
Calculates Skewness of Numeric Variable with Option to Weight Observations
Usage
wtd.skewness(x, w, data, digits = 3)
Arguments
| x | Variable (must be a numeric vector) | 
| w | (Optional) Weights variable | 
| data | (Optional) Dataset | 
| digits | (Optional) Number of digits after decimal point (default: 3) | 
Value
Returns the skewness of the variable, a numeric value.
Examples
   library(RCPA3)
   
   
   wtd.skewness(x=nes$ft.socialists, w=nes$wt)
   wtd.skewness(x=nes$ft.socialists)
   
Calculates Variance of Variable With Option for Weights
Description
Takes in variable and calculates its variance, works with sampling weights. Makes use of the wtd.var function from the Hmisc package. See wtd.stats documentation for details.
Usage
wtd.var(x, w = NULL, data, digits = 3, ...)
Arguments
| x | A variable (must be numeric), should be in dataset$var form 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 x (and w) variable. | 
| digits | (Optional) Number of decimal places reported in result (defaults to 3). | 
| ... | (Optional) Additional arguments passed to Hmisc::wtd.var function. | 
Value
Returns the variance of the variable, a numeric value.
Examples
   library(RCPA3)
   
   wtd.var(x=nes$ft.socialists, w=nes$wt)
   wtd.var(x=nes$ft.socialists)