Provides a collection of intuitive and user-friendly functions for computing confidence intervals for common statistical tasks, including means, differences in means, proportions, and odds ratios. The package also includes tools for linear regression analysis and several real-world datasets intended for teaching and applied statistical inference.
The IPAG package provides a set of simple and pedagogical tools for statistical inference in R. It focuses on confidence intervals and concise linear regression summaries, with clear defaults and readable outputs.
The package is primarily intended for teaching purposes and applied work in economics, social sciences, and related fields.
IPAG provides wrapper functions around standard R statistical procedures, including:
All confidence intervals are computed at the 99% level by default, with the option to specify alternative confidence levels.
You can install the development version of IPAG from GitHub:
# install.packages("remotes")
remotes::install_github("gpiaser/IPAG")
Once available on CRAN, you will be able to install it with:
install.packages("IPAG")
mean_ci() computes a confidence interval for a population mean using a Student
t test.
library(IPAG)
x <- c(4.2, 5.1, 6.3, 5.8, 4.9)
mean_ci(x)
mean_diff_ci() computes a confidence interval for the difference in means
between two samples, either independent or paired.
x <- c(5.1, 4.9, 6.2, 5.8, 5.4)
y <- c(4.8, 4.7, 5.9, 5.2, 5.0)
mean_diff_ci(x, y)
prop_ci() computes an exact confidence interval for a population proportion
using binom.test()`.
prop_ci(trials = 100, successes = 45)
oddsratio_ci() computes an exact confidence interval for the odds ratio from a
2x2 contingency table, based on Fisher's exact test.
oddsratio_ci(a = 12, b = 5, c = 4, d = 15)
linear_regress() provides a concise summary of a linear regression fitted with
lm(). It reports the adjusted R-squared, the p-value of the overall Fisher test,
and a table of estimated coefficients with confidence intervals and significance
indicators.
data(Housing)
linear_regress(MEDV ~ RM + LSTAT, data = Housing)
The package includes several datasets commonly used for illustration and teaching:
Housing — hedonic housing prices (Harrison and Rubinfeld, 1978)Beauty — teaching evaluations and perceived attractivenessMcKinsey — teacher compensation and student performanceContentMarketing — determinants of content marketing effectivenessBosnia — microcredit program data from Bosnia and Herzegovina, used for impact evaluationcovid19 — cross-country COVID-related indicatorsEach dataset is documented and can be loaded using data().
All functions rely on well-established R functions such as
t.test(), binom.test(), lm(), and fisher.test().
Functions computing confidence intervals follow a consistent naming convention and return objects with simple S3 print methods.
Outputs are designed to be interpretable without requiring advanced knowledge of R object internals.
IPAG is designed for instructional and applied contexts where clarity and interpretability are prioritized over extensibility or computational efficiency. It is not intended as a substitute for more comprehensive statistical packages.
This package is distributed under the MIT License.