CIprop {RCPA3} | R Documentation |
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)
# using optional w and data arguments
CIprop(x=nes$lifex.knowimmig, w=nes$wt)
CIprop(x=lifex.knowimmig, w=wt, data=nes)