| Title: | Unified Tools for Classical and Bootstrap Confidence Intervals |
|---|---|
| Description: | Provides a unified and consistent interface for computing classical and bootstrap confidence intervals for means, variances, proportions, variance ratios and regression coefficients. |
| Authors: | Rayan Siffe [aut, cre] |
| Maintainer: | Rayan Siffe <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.1.0 |
| Built: | 2026-05-13 09:38:16 UTC |
| Source: | https://github.com/rayansiffeo/ictools |
Computes confidence intervals for a population mean.
ic_pmean( x, conf.level = 0.95, type = c("two.sided", "upper", "lower"), method = c("t", "z"), sigma = NULL, na.rm = TRUE )ic_pmean( x, conf.level = 0.95, type = c("two.sided", "upper", "lower"), method = c("t", "z"), sigma = NULL, na.rm = TRUE )
x |
Numeric vector, matrix, or data.frame. |
conf.level |
Confidence level (default 0.95). |
type |
Character. "two.sided", "upper", or "lower". |
method |
Character. "t" (default) or "z". |
sigma |
Known population standard deviation (required if method = "z"). |
na.rm |
Logical. Whether to remove NA values. |
A list of class "ic_pmean" with mean estimate and confidence interval.
data <- c(5, 7, 8, 6, 9, 10) ic_pmean(data) ic_pmean(data, conf.level = 0.99) mat <- matrix(data, nrow = 2) ic_pmean(mat)data <- c(5, 7, 8, 6, 9, 10) ic_pmean(data) ic_pmean(data, conf.level = 0.99) mat <- matrix(data, nrow = 2) ic_pmean(mat)
Computes confidence intervals for a population proportion.
ic_prop( x, conf.level = 0.95, success = c(1, "yes", "true"), method = c("wilson", "wald", "clopper"), na.rm = TRUE )ic_prop( x, conf.level = 0.95, success = c(1, "yes", "true"), method = c("wilson", "wald", "clopper"), na.rm = TRUE )
x |
Numeric vector (0/1) or matrix of 0/1. |
conf.level |
Confidence level (default 0.95). |
success |
Value considered a success (default 1, "yes", "true"). |
method |
Character. "wilson", "wald", or "clopper". |
na.rm |
Logical. Whether to remove NA values. |
A list of class "ic_proportion" with proportion estimate and confidence interval.
data <- matrix(c(1, 0, 1, 1, 0, 1), nrow = 2) ic_prop(data) ic_prop(data, conf.level = 0.99)data <- matrix(c(1, 0, 1, 1, 0, 1), nrow = 2) ic_prop(data) ic_prop(data, conf.level = 0.99)
Computes confidence intervals for the ratio of two population variances.
ic_razon_var( x, y, conf.level = 0.95, method = c("f", "log", "bootstrap"), R = 2000, na.rm = TRUE )ic_razon_var( x, y, conf.level = 0.95, method = c("f", "log", "bootstrap"), R = 2000, na.rm = TRUE )
x |
Numeric vector or matrix (first sample). |
y |
Numeric vector or matrix (second sample). |
conf.level |
Confidence level (default 0.95). |
method |
Character. "f", "log", or "bootstrap". |
R |
Number of bootstrap replicates (default 2000). |
na.rm |
Logical. Whether to remove NA values. |
A list of class "ic_var_ratio" with ratio estimate and confidence interval.
data1 <- matrix(c(5, 7, 8, 6, 9, 10), nrow = 2) data2 <- matrix(c(4, 6, 7, 5, 8, 9), nrow = 2) ic_razon_var(data1, data2) ic_razon_var(data1, data2, conf.level = 0.99)data1 <- matrix(c(5, 7, 8, 6, 9, 10), nrow = 2) data2 <- matrix(c(4, 6, 7, 5, 8, 9), nrow = 2) ic_razon_var(data1, data2) ic_razon_var(data1, data2, conf.level = 0.99)
Computes confidence intervals for the coefficients of a linear model (lm).
ic_reg( model, conf.level = 0.95, method = c("classical", "bootstrap", "residual"), R = 2000 )ic_reg( model, conf.level = 0.95, method = c("classical", "bootstrap", "residual"), R = 2000 )
model |
An object of class |
conf.level |
Confidence level (defaults to 0.95). |
method |
Método para calcular el intervalo: "classical", "bootstrap" o "residual". |
R |
Número de réplicas bootstrap (solo para métodos bootstrap/residual). |
An object of class ic_reg containing the estimate and the
confidence interval.
# Create sample data test_data <- data.frame( y = c(5, 6, 7, 8, 9, 10), x1 = c(1, 2, 3, 4, 5, 6), x2 = c(2, 1, 3, 2, 4, 5) ) # Fit model and calculate CI fit <- lm(y ~ x1 + x2, data = test_data) ic_reg(fit)# Create sample data test_data <- data.frame( y = c(5, 6, 7, 8, 9, 10), x1 = c(1, 2, 3, 4, 5, 6), x2 = c(2, 1, 3, 2, 4, 5) ) # Fit model and calculate CI fit <- lm(y ~ x1 + x2, data = test_data) ic_reg(fit)
Computes confidence intervals for a population variance.
ic_var( x, conf.level = 0.95, type = c("two.sided", "upper", "lower"), na.rm = TRUE )ic_var( x, conf.level = 0.95, type = c("two.sided", "upper", "lower"), na.rm = TRUE )
x |
Numeric vector or matrix. |
conf.level |
Confidence level (default 0.95). |
type |
Character. "two.sided", "upper", or "lower". |
na.rm |
Logical. Whether to remove NA values. |
A list of class "ic_var" with variance estimate and confidence interval.
data <- matrix(c(5, 7, 8, 6, 9, 10), nrow = 2) ic_var(data) ic_var(data, conf.level = 0.99)data <- matrix(c(5, 7, 8, 6, 9, 10), nrow = 2) ic_var(data) ic_var(data, conf.level = 0.99)