statcpp
C++17 Header-Only Statistics Library
Loading...
Searching...
No Matches
Classes | Namespaces | Functions
estimation.hpp File Reference

Estimation and confidence interval functions. More...

#include "statcpp/basic_statistics.hpp"
#include "statcpp/dispersion_spread.hpp"
#include "statcpp/continuous_distributions.hpp"
#include <algorithm>
#include <cmath>
#include <cstddef>
#include <stdexcept>
Include dependency graph for estimation.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  statcpp::confidence_interval
 Structure to store confidence interval results. More...
 

Namespaces

namespace  statcpp
 

Functions

template<typename Iterator >
double statcpp::standard_error (Iterator first, Iterator last)
 Calculate standard error of the mean.
 
template<typename Iterator , typename Projection >
double statcpp::standard_error (Iterator first, Iterator last, Projection proj)
 Calculate standard error of the mean (projection version)
 
template<typename Iterator >
double statcpp::standard_error (Iterator first, Iterator last, double precomputed_stddev)
 Calculate standard error of the mean (using precomputed standard deviation)
 
template<typename Iterator >
confidence_interval statcpp::ci_mean (Iterator first, Iterator last, double confidence=0.95)
 Calculate confidence interval for mean (t-distribution based)
 
template<typename Iterator , typename Projection >
confidence_interval statcpp::ci_mean (Iterator first, Iterator last, double confidence, Projection proj)
 Calculate confidence interval for mean (projection version)
 
template<typename Iterator >
confidence_interval statcpp::ci_mean_z (Iterator first, Iterator last, double sigma, double confidence=0.95)
 Calculate confidence interval for mean (z-distribution based, known variance)
 
confidence_interval statcpp::ci_proportion (std::size_t successes, std::size_t trials, double confidence=0.95)
 Calculate confidence interval for proportion (Wald method)
 
confidence_interval statcpp::ci_proportion_wilson (std::size_t successes, std::size_t trials, double confidence=0.95)
 Calculate confidence interval for proportion (Wilson method, recommended)
 
template<typename Iterator >
confidence_interval statcpp::ci_variance (Iterator first, Iterator last, double confidence=0.95)
 Calculate confidence interval for variance (chi-square distribution based)
 
template<typename Iterator1 , typename Iterator2 >
confidence_interval statcpp::ci_mean_diff (Iterator1 first1, Iterator1 last1, Iterator2 first2, Iterator2 last2, double confidence=0.95)
 Calculate confidence interval for difference of two-sample means (independent samples, pooled variance)
 
template<typename Iterator1 , typename Iterator2 >
confidence_interval statcpp::ci_mean_diff_welch (Iterator1 first1, Iterator1 last1, Iterator2 first2, Iterator2 last2, double confidence=0.95)
 Calculate confidence interval for difference of two-sample means (Welch method, not assuming equal variances)
 
template<typename Iterator >
double statcpp::margin_of_error_mean (Iterator first, Iterator last, double confidence=0.95)
 Calculate margin of error for mean.
 
template<typename Iterator , typename Projection >
double statcpp::margin_of_error_mean (Iterator first, Iterator last, double confidence, Projection proj)
 Calculate margin of error for mean (projection version)
 
double statcpp::margin_of_error_proportion (std::size_t successes, std::size_t n, double confidence=0.95)
 Calculate margin of error for proportion.
 
double statcpp::margin_of_error_proportion_worst_case (std::size_t n, double confidence=0.95)
 Calculate worst-case margin of error for proportion.
 
std::size_t statcpp::sample_size_for_moe_proportion (double margin_of_error, double confidence_level=0.95, double p_estimate=0.5)
 Calculate sample size for proportion estimation.
 
std::size_t statcpp::sample_size_for_moe_mean (double margin_of_error, double sigma, double confidence_level=0.95)
 Calculate sample size for mean estimation (known population standard deviation)
 
template<typename Iterator1 , typename Iterator2 >
confidence_interval statcpp::ci_mean_diff_pooled (Iterator1 first1, Iterator1 last1, Iterator2 first2, Iterator2 last2, double confidence=0.95)
 Calculate confidence interval for two-sample mean difference (assuming equal variances)
 
confidence_interval statcpp::ci_proportion_diff (std::size_t successes1, std::size_t n1, std::size_t successes2, std::size_t n2, double confidence=0.95)
 Calculate confidence interval for two-sample proportion difference.
 

Detailed Description

Estimation and confidence interval functions.

Provides standard error calculations, confidence interval estimation, margin of error and sample size calculations.

Definition in file estimation.hpp.