MyNixOS website logo
Description

Confidence Intervals.

Calculates classic and/or bootstrap confidence intervals for many parameters such as the population mean, variance, interquartile range (IQR), median absolute deviation (MAD), skewness, kurtosis, Cramer's V, odds ratio, R-squared, quantiles (incl. median), proportions, different types of correlation measures, difference in means, quantiles and medians. Many of the classic confidence intervals are described in Smithson, M. (2003, ISBN: 978-0761924999). Bootstrap confidence intervals are calculated with the R package 'boot'. Both one- and two-sided intervals are supported.

{confintr}

CRAN status R-CMD-check Codecov test coverage

Overview

{confintr} offers classic and/or bootstrap confidence intervals (CI) for the following parameters:

  • mean,
  • quantiles incl. median,
  • proportion,
  • variance and standard deviation,
  • IQR and MAD,
  • skewness and kurtosis,
  • R-squared and the non-centrality parameter of the F distribution,
  • Cramér's V and the non-centrality parameter of the chi-squared distribution,
  • odds ratio of a 2x2 table,
  • Pearson-, Spearman-, Kendall correlation coefficients,
  • mean differences, quantile and median differences.

Both one- and two-sided intervals are supported.

Different types of bootstrap intervals are available via {boot}, see vignette.

Installation

# From CRAN
install.packages("confintr")

# Development version
devtools::install_github("mayer79/confintr")

Usage

library(confintr)
set.seed(1)

# Mean
ci_mean(1:100)

# Two-sided 95% t confidence interval for the population mean
# 
# Sample estimate: 50.5 
# Confidence interval:
#     2.5%    97.5% 
# 44.74349 56.25651 

# Mean using the Bootstrap
ci_mean(1:100, type = "bootstrap")

#   Two-sided 95% bootstrap confidence interval for the population mean
# 	based on 9999 bootstrap replications and the student method
# 
# Sample estimate: 50.5 
# Confidence interval:
#     2.5%    97.5% 
# 44.72913 56.34685

# 95% value at risk
ci_quantile(rexp(1000), q = 0.95)

# 	Two-sided 95% binomial confidence interval for the population 95%
# 	quantile
# 
# Sample estimate: 2.954119 
# Confidence interval:
#     2.5%    97.5% 
# 2.745526 3.499928 

# Mean difference
ci_mean_diff(1:100, 2:101)

#	Two-sided 95% t confidence interval for the population value of mean(x)-mean(y)
#
# Sample estimate: -1 
# Confidence interval:
#      2.5%     97.5% 
# -9.090881  7.090881 

ci_mean_diff(1:100, 2:101, type = "bootstrap", seed = 1)

# Two-sided 95% bootstrap confidence interval for the population value of mean(x)-mean(y)
# based on 9999 bootstrap replications and the student method
#
# Sample estimate: -1 
# Confidence interval:
#      2.5%     97.5% 
# -9.057506  7.092050

# Further examples (without output)

# Correlation
ci_cor(iris[1:2], method = "spearman", type = "bootstrap")

# Proportions
ci_proportion(10, n = 100, type = "Wilson")
ci_proportion(10, n = 100, type = "Clopper-Pearson")

# R-squared
fit <- lm(Sepal.Length ~ ., data = iris)
ci_rsquared(fit, probs = c(0.05, 1))

# Kurtosis
ci_kurtosis(1:100)

# Mean difference
ci_mean_diff(10:30, 1:15)
ci_mean_diff(10:30, 1:15, type = "bootstrap")

# Median difference
ci_median_diff(10:30, 1:15)
Metadata

Version

1.0.2

License

Unknown

Platforms (77)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-freebsd
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64-windows
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows