|
statcpp
C++17 Header-Only Statistics Library
|
Namespaces | |
| namespace | detail |
| Internal helper functions. | |
Classes | |
| struct | aggregation_result |
| Aggregation result per group. More... | |
| struct | ancova_result |
| Structure storing ANCOVA (Analysis of Covariance) results. More... | |
| struct | anova_row |
| Structure representing a row in the ANOVA table. More... | |
| struct | bootstrap_result |
| Structure to store bootstrap estimation results. More... | |
| struct | complete_case_result |
| Complete case analysis result. More... | |
| struct | confidence_interval |
| Structure to store confidence interval results. More... | |
| struct | contingency_table_result |
| Contingency table (cross-tabulation) result. More... | |
| struct | cv_result |
| Structure to store cross-validation results. More... | |
| struct | dendrogram_node |
| Dendrogram node. More... | |
| struct | five_number_summary_result |
| Five-number summary result. More... | |
| struct | frequency_entry |
| Frequency table entry. More... | |
| struct | frequency_table_result |
| Frequency table result. More... | |
| struct | glm_residuals |
| GLM residuals structure. More... | |
| struct | glm_result |
| GLM result structure. More... | |
| struct | group_result |
| Grouping result. More... | |
| struct | hazard_rate_result |
| Hazard rate result. More... | |
| struct | is_random_engine |
| Type trait to determine if a type is a random engine. More... | |
| struct | is_random_engine< std::knuth_b > |
| Specialization for std::knuth_b. More... | |
| struct | is_random_engine< std::minstd_rand > |
| Specialization for std::minstd_rand. More... | |
| struct | is_random_engine< std::minstd_rand0 > |
| Specialization for std::minstd_rand0. More... | |
| struct | is_random_engine< std::mt19937 > |
| Specialization for std::mt19937. More... | |
| struct | is_random_engine< std::mt19937_64 > |
| Specialization for std::mt19937_64. More... | |
| struct | is_random_engine< std::ranlux24 > |
| Specialization for std::ranlux24. More... | |
| struct | is_random_engine< std::ranlux24_base > |
| Specialization for std::ranlux24_base. More... | |
| struct | is_random_engine< std::ranlux48 > |
| Specialization for std::ranlux48. More... | |
| struct | is_random_engine< std::ranlux48_base > |
| Specialization for std::ranlux48_base. More... | |
| struct | kaplan_meier_result |
| Kaplan-Meier estimation result. More... | |
| struct | kmeans_result |
| K-means clustering result. More... | |
| struct | label_encoding_result |
| Label encoding result. More... | |
| struct | logrank_result |
| Log-rank test result. More... | |
| struct | mcar_test_result |
| Little's MCAR test result. More... | |
| struct | missing_pattern_info |
| Missing pattern information. More... | |
| struct | multiple_imputation_result |
| Multiple imputation result. More... | |
| struct | multiple_regression_result |
| Structure to store multiple regression analysis results. More... | |
| struct | odds_ratio_result |
| Odds ratio result. More... | |
| struct | one_way_anova_result |
| Structure storing one-way ANOVA results. More... | |
| struct | outlier_detection_result |
| Outlier detection result. More... | |
| struct | pca_result |
| PCA result. More... | |
| struct | permutation_result |
| Structure to store permutation test results. More... | |
| struct | posthoc_comparison |
| Structure storing individual pairwise comparison result in post-hoc tests. More... | |
| struct | posthoc_result |
| Structure storing post-hoc comparison results. More... | |
| struct | power_result |
| Power analysis result. More... | |
| struct | prediction_interval |
| Structure to store prediction interval results. More... | |
| struct | quartile_result |
| Quartile result. More... | |
| struct | regularized_regression_result |
| Structure to store regularized regression results. More... | |
| struct | relative_risk_result |
| Relative risk result. More... | |
| struct | residual_diagnostics |
| Structure to store residual diagnostics results. More... | |
| struct | risk_difference_result |
| Risk difference result. More... | |
| struct | sensitivity_analysis_result |
| Sensitivity analysis result (single parameter) More... | |
| struct | simple_regression_result |
| Structure to store simple regression analysis results. More... | |
| struct | test_result |
| Structure to store statistical test results. More... | |
| struct | tipping_point_result |
| Tipping point analysis result. More... | |
| struct | two_way_anova_result |
| Structure storing two-way ANOVA results. More... | |
| struct | validation_result |
| Data validation result. More... | |
Typedefs | |
| using | default_random_engine = std::mt19937_64 |
| Default random engine type (Mersenne Twister 64-bit version) | |
Enumerations | |
| enum class | linkage_type { single , complete , average , ward } |
| Linkage types. More... | |
| enum class | effect_size_magnitude { negligible , small , medium , large } |
| Enumeration for effect size magnitude. More... | |
| enum class | link_function { identity , logit , probit , log , inverse , cloglog } |
| Link function types. More... | |
| enum class | distribution_family { gaussian , binomial , poisson , gamma_family } |
| Distribution family. More... | |
| enum class | missing_mechanism { mcar , mar , mnar , unknown } |
| Missing mechanism types. More... | |
| enum class | alternative_hypothesis { two_sided , less , greater } |
| Enumeration representing the type of alternative hypothesis. More... | |
Functions | |
| one_way_anova_result | one_way_anova (const std::vector< std::vector< double > > &groups) |
| Perform one-way analysis of variance. | |
| two_way_anova_result | two_way_anova (const std::vector< std::vector< std::vector< double > > > &data) |
| Perform two-way analysis of variance (with replication) | |
| posthoc_result | tukey_hsd (const one_way_anova_result &anova_result, const std::vector< std::vector< double > > &groups, double alpha=0.05) |
| Perform Tukey's Honestly Significant Difference (HSD) test. | |
| posthoc_result | bonferroni_posthoc (const one_way_anova_result &anova_result, double alpha=0.05) |
| Perform Bonferroni method for multiple comparisons. | |
| posthoc_result | dunnett_posthoc (const one_way_anova_result &anova_result, std::size_t control_group=0, double alpha=0.05) |
| Perform Dunnett's test for multiple comparisons against a control group. | |
| posthoc_result | scheffe_posthoc (const one_way_anova_result &anova_result, double alpha=0.05) |
| Perform Scheffe's method for multiple comparisons. | |
| ancova_result | one_way_ancova (const std::vector< std::vector< std::pair< double, double > > > &groups) |
| Perform one-way analysis of covariance. | |
| double | eta_squared (const one_way_anova_result &result) |
| Calculate Eta-squared for one-way ANOVA. | |
| double | partial_eta_squared_a (const two_way_anova_result &result) |
| Calculate Partial eta-squared for factor A in two-way ANOVA. | |
| double | partial_eta_squared_b (const two_way_anova_result &result) |
| Calculate Partial eta-squared for factor B in two-way ANOVA. | |
| double | partial_eta_squared_interaction (const two_way_anova_result &result) |
| Calculate Partial eta-squared for interaction in two-way ANOVA. | |
| double | omega_squared (const one_way_anova_result &result) |
| Calculate Omega-squared for one-way ANOVA. | |
| double | cohens_f (const one_way_anova_result &result) |
| Calculate Cohen's f for one-way ANOVA. | |
| template<typename Iterator > | |
| auto | sum (Iterator first, Iterator last) |
| Sum. | |
| template<typename Iterator , typename Projection > | |
| auto | sum (Iterator first, Iterator last, Projection proj) |
| Sum of projected values using a lambda expression. | |
| template<typename Iterator > | |
| std::size_t | count (Iterator first, Iterator last) |
| Data count. | |
| template<typename Iterator > | |
| double | mean (Iterator first, Iterator last) |
| Arithmetic mean. | |
| template<typename Iterator , typename Projection > | |
| double | mean (Iterator first, Iterator last, Projection proj) |
| Arithmetic mean of projected values using a lambda expression. | |
| template<typename Iterator > | |
| double | median (Iterator first, Iterator last) |
| Median (accepts a sorted range) | |
| template<typename Iterator , typename Projection > | |
| double | median (Iterator first, Iterator last, Projection proj) |
| Median of projected values using a lambda expression (projection results must be in sorted order) | |
| template<typename Iterator > | |
| auto | mode (Iterator first, Iterator last) |
| Mode (returns the smallest value when there are multiple modes: guarantees deterministic behavior) | |
| template<typename Iterator , typename Projection > | |
| auto | mode (Iterator first, Iterator last, Projection proj) |
| Mode of projected values using a lambda expression. | |
| template<typename Iterator > | |
| auto | modes (Iterator first, Iterator last) -> std::vector< typename std::iterator_traits< Iterator >::value_type > |
| Returns all modes (returns a vector sorted in ascending order) | |
| template<typename Iterator , typename Projection > | |
| auto | modes (Iterator first, Iterator last, Projection proj) -> std::vector< std::invoke_result_t< Projection, typename std::iterator_traits< Iterator >::value_type > > |
| Returns all modes of projected values using a lambda expression. | |
| template<typename Iterator > | |
| double | geometric_mean (Iterator first, Iterator last) |
| Geometric mean. | |
| template<typename Iterator , typename Projection > | |
| double | geometric_mean (Iterator first, Iterator last, Projection proj) |
| Geometric mean of projected values using a lambda expression. | |
| template<typename Iterator > | |
| double | harmonic_mean (Iterator first, Iterator last) |
| Harmonic mean. | |
| template<typename Iterator , typename Projection > | |
| double | harmonic_mean (Iterator first, Iterator last, Projection proj) |
| Harmonic mean of projected values using a lambda expression. | |
| template<typename Iterator > | |
| double | trimmed_mean (Iterator first, Iterator last, double proportion) |
| Trimmed mean (accepts a sorted range. proportion: exclusion ratio per side, 0.0 to less than 0.5) | |
| template<typename Iterator , typename Projection > | |
| double | trimmed_mean (Iterator first, Iterator last, double proportion, Projection proj) |
| Trimmed mean of projected values using a lambda expression (projection results must be in sorted order) | |
| template<typename Iterator , typename WeightIterator > | |
| double | weighted_mean (Iterator first, Iterator last, WeightIterator weight_first, WeightIterator weight_last) |
| Weighted mean. | |
| template<typename Iterator , typename WeightIterator > | |
| double | weighted_mean (Iterator first, Iterator last, WeightIterator weight_first) |
| template<typename Iterator , typename WeightIterator , typename Projection > | |
| double | weighted_mean (Iterator first, Iterator last, WeightIterator weight_first, WeightIterator weight_last, Projection proj) |
| Weighted mean (projection version) | |
| template<typename Iterator , typename WeightIterator , typename Projection > | |
| double | weighted_mean (Iterator first, Iterator last, WeightIterator weight_first, Projection proj) |
| template<typename T1 , typename T2 > | |
| double | logarithmic_mean (T1 a, T2 b) |
| Logarithmic Mean. | |
| template<typename Iterator , typename WeightIterator > | |
| double | weighted_harmonic_mean (Iterator first, Iterator last, WeightIterator weight_first, WeightIterator weight_last) |
| Weighted harmonic mean (safe range version) | |
| template<typename Iterator , typename WeightIterator > | |
| double | weighted_harmonic_mean (Iterator first, Iterator last, WeightIterator weight_first) |
| Weighted harmonic mean. | |
| template<typename Iterator , typename WeightIterator , typename Projection > | |
| double | weighted_harmonic_mean (Iterator first, Iterator last, WeightIterator weight_first, WeightIterator weight_last, Projection proj) |
| Weighted harmonic mean (safe range version with projection) | |
| template<typename Iterator , typename WeightIterator , typename Projection > | |
| double | weighted_harmonic_mean (Iterator first, Iterator last, WeightIterator weight_first, Projection proj) |
| Weighted harmonic mean (projection version) | |
| template<typename Iterator > | |
| std::size_t | argmin (Iterator first, Iterator last) |
| Returns the index of the minimum value. | |
| template<typename Iterator , typename Projection > | |
| std::size_t | argmin (Iterator first, Iterator last, Projection proj) |
| Returns the index of the minimum value (projection version) | |
| template<typename Iterator > | |
| std::size_t | argmax (Iterator first, Iterator last) |
| Returns the index of the maximum value. | |
| template<typename Iterator , typename Projection > | |
| std::size_t | argmax (Iterator first, Iterator last, Projection proj) |
| Returns the index of the maximum value (projection version) | |
| contingency_table_result | contingency_table (const std::vector< std::size_t > &row_data, const std::vector< std::size_t > &col_data) |
| Create a contingency table. | |
| odds_ratio_result | odds_ratio (const std::vector< std::vector< std::size_t > > &table) |
| Calculate odds ratio from a 2x2 contingency table. | |
| odds_ratio_result | odds_ratio (std::size_t a, std::size_t b, std::size_t c, std::size_t d) |
| Calculate odds ratio from a 2x2 contingency table (specifying cell values directly) | |
| relative_risk_result | relative_risk (const std::vector< std::vector< std::size_t > > &table) |
| Calculate relative risk (risk ratio) from a 2x2 contingency table. | |
| relative_risk_result | relative_risk (std::size_t a, std::size_t b, std::size_t c, std::size_t d) |
| Calculate relative risk from a 2x2 contingency table (specifying cell values directly) | |
| risk_difference_result | risk_difference (const std::vector< std::vector< std::size_t > > &table) |
| Calculate risk difference from a 2x2 contingency table. | |
| risk_difference_result | risk_difference (std::size_t a, std::size_t b, std::size_t c, std::size_t d) |
| Calculate risk difference from a 2x2 contingency table (specifying cell values directly) | |
| double | number_needed_to_treat (const std::vector< std::vector< std::size_t > > &table) |
| Calculate Number Needed to Treat (NNT) | |
| double | euclidean_distance (const std::vector< double > &a, const std::vector< double > &b) |
| Euclidean distance. | |
| double | manhattan_distance (const std::vector< double > &a, const std::vector< double > &b) |
| Manhattan distance. | |
| std::vector< std::vector< double > > | kmeans_plusplus_init (const std::vector< std::vector< double > > &data, std::size_t k) |
| K-means++ initialization. | |
| kmeans_result | kmeans (const std::vector< std::vector< double > > &data, std::size_t k, std::size_t max_iter=100, double tol=1e-6) |
| K-means clustering. | |
| std::vector< dendrogram_node > | hierarchical_clustering (const std::vector< std::vector< double > > &data, linkage_type linkage=linkage_type::single) |
| Hierarchical clustering. | |
| std::vector< std::size_t > | cut_dendrogram (const std::vector< dendrogram_node > &dendrogram, std::size_t n_data, std::size_t k) |
| Extract k clusters from dendrogram. | |
| double | silhouette_score (const std::vector< std::vector< double > > &data, const std::vector< std::size_t > &labels) |
| Calculate silhouette score. | |
| double | uniform_pdf (double x, double a=0.0, double b=1.0) |
| Uniform distribution probability density function (PDF) | |
| double | uniform_cdf (double x, double a=0.0, double b=1.0) |
| Uniform distribution cumulative distribution function (CDF) | |
| double | uniform_quantile (double p, double a=0.0, double b=1.0) |
| Uniform distribution quantile function (inverse CDF) | |
| template<typename Engine = default_random_engine> | |
| double | uniform_rand (double a, double b, Engine &engine) |
| Uniform distribution random number generation. | |
| double | uniform_rand (double a=0.0, double b=1.0) |
| Uniform distribution random number generation (using default engine) | |
| double | normal_pdf (double x, double mu=0.0, double sigma=1.0) |
| Normal distribution probability density function (PDF) | |
| double | normal_cdf (double x, double mu=0.0, double sigma=1.0) |
| Normal distribution cumulative distribution function (CDF) | |
| double | normal_quantile (double p, double mu=0.0, double sigma=1.0) |
| Normal distribution quantile function (inverse CDF, percent point function) | |
| template<typename Engine = default_random_engine> | |
| double | normal_rand (double mu, double sigma, Engine &engine) |
| Normal distribution random number generation. | |
| double | normal_rand (double mu=0.0, double sigma=1.0) |
| Normal distribution random number generation (using default engine) | |
| double | exponential_pdf (double x, double lambda=1.0) |
| Exponential distribution probability density function (PDF) | |
| double | exponential_cdf (double x, double lambda=1.0) |
| Exponential distribution cumulative distribution function (CDF) | |
| double | exponential_quantile (double p, double lambda=1.0) |
| Exponential distribution quantile function. | |
| template<typename Engine = default_random_engine> | |
| double | exponential_rand (double lambda, Engine &engine) |
| Exponential distribution random number generation. | |
| double | exponential_rand (double lambda=1.0) |
| Exponential distribution random number generation (using default engine) | |
| double | gamma_pdf (double x, double shape, double rate=1.0) |
| Gamma distribution probability density function (PDF) | |
| double | gamma_cdf (double x, double shape, double rate=1.0) |
| Gamma distribution cumulative distribution function (CDF) | |
| double | gamma_quantile (double p, double shape, double rate=1.0) |
| Gamma distribution quantile function. | |
| template<typename Engine = default_random_engine> | |
| double | gamma_rand (double shape, double rate, Engine &engine) |
| Gamma distribution random number generation. | |
| double | gamma_rand (double shape, double rate=1.0) |
| Gamma distribution random number generation (using default engine) | |
| double | beta_pdf (double x, double alpha, double beta_param) |
| Beta distribution probability density function (PDF) | |
| double | beta_cdf (double x, double alpha, double beta_param) |
| Beta distribution cumulative distribution function (CDF) | |
| double | beta_quantile (double p, double alpha, double beta_param) |
| Beta distribution quantile function. | |
| template<typename Engine = default_random_engine> | |
| double | beta_rand (double alpha, double beta_param, Engine &engine) |
| Beta distribution random number generation (using gamma variates) | |
| double | beta_rand (double alpha, double beta_param) |
| Beta distribution random number generation (using default engine) | |
| double | chisq_pdf (double x, double df) |
| Chi-square distribution probability density function (PDF) | |
| double | chisq_cdf (double x, double df) |
| Chi-square distribution cumulative distribution function (CDF) | |
| double | chisq_quantile (double p, double df) |
| Chi-square distribution quantile function. | |
| template<typename Engine = default_random_engine> | |
| double | chisq_rand (double df, Engine &engine) |
| Chi-square distribution random number generation. | |
| double | chisq_rand (double df) |
| Chi-square distribution random number generation (using default engine) | |
| double | t_pdf (double x, double df) |
| t-distribution probability density function (PDF) | |
| double | t_cdf (double x, double df) |
| t-distribution cumulative distribution function (CDF) | |
| double | t_quantile (double p, double df) |
| t-distribution quantile function (Newton-Raphson method) | |
| template<typename Engine = default_random_engine> | |
| double | t_rand (double df, Engine &engine) |
| t-distribution random number generation | |
| double | t_rand (double df) |
| t-distribution random number generation (using default engine) | |
| double | f_pdf (double x, double df1, double df2) |
| F-distribution probability density function (PDF) | |
| double | f_cdf (double x, double df1, double df2) |
| F-distribution cumulative distribution function (CDF) | |
| double | f_quantile (double p, double df1, double df2) |
| F-distribution quantile function (Newton-Raphson method) | |
| template<typename Engine = default_random_engine> | |
| double | f_rand (double df1, double df2, Engine &engine) |
| F-distribution random number generation. | |
| double | f_rand (double df1, double df2) |
| F-distribution random number generation (using default engine) | |
| double | lognormal_pdf (double x, double mu=0.0, double sigma=1.0) |
| Log-normal distribution probability density function (PDF) | |
| double | lognormal_cdf (double x, double mu=0.0, double sigma=1.0) |
| Log-normal distribution cumulative distribution function (CDF) | |
| double | lognormal_quantile (double p, double mu=0.0, double sigma=1.0) |
| Log-normal distribution quantile function. | |
| template<typename Engine = default_random_engine> | |
| double | lognormal_rand (double mu, double sigma, Engine &engine) |
| Log-normal distribution random number generation. | |
| double | lognormal_rand (double mu=0.0, double sigma=1.0) |
| Log-normal distribution random number generation (using default engine) | |
| double | weibull_pdf (double x, double shape, double scale=1.0) |
| Weibull distribution probability density function (PDF) | |
| double | weibull_cdf (double x, double shape, double scale=1.0) |
| Weibull distribution cumulative distribution function (CDF) | |
| double | weibull_quantile (double p, double shape, double scale=1.0) |
| Weibull distribution quantile function. | |
| template<typename Engine = default_random_engine> | |
| double | weibull_rand (double shape, double scale, Engine &engine) |
| Weibull distribution random number generation. | |
| double | weibull_rand (double shape, double scale=1.0) |
| Weibull distribution random number generation (using default engine) | |
| double | studentized_range_cdf (double q, double k, double df) |
| CDF of the studentized range distribution. | |
| double | studentized_range_quantile (double p, double k, double df) |
| Quantile function of the studentized range distribution. | |
| template<typename Iterator1 , typename Iterator2 > | |
| double | population_covariance (Iterator1 first1, Iterator1 last1, Iterator2 first2, Iterator2 last2) |
| Population covariance. | |
| template<typename Iterator1 , typename Iterator2 > | |
| double | population_covariance (Iterator1 first1, Iterator1 last1, Iterator2 first2, Iterator2 last2, double mean_x, double mean_y) |
| Population covariance with precomputed means. | |
| template<typename Iterator1 , typename Iterator2 , typename Projection1 , typename Projection2 > | |
| double | population_covariance (Iterator1 first1, Iterator1 last1, Iterator2 first2, Iterator2 last2, Projection1 proj1, Projection2 proj2) |
| Population covariance (projection version) | |
| template<typename Iterator1 , typename Iterator2 > | |
| double | sample_covariance (Iterator1 first1, Iterator1 last1, Iterator2 first2, Iterator2 last2) |
| Sample covariance (unbiased covariance) | |
| template<typename Iterator1 , typename Iterator2 > | |
| double | sample_covariance (Iterator1 first1, Iterator1 last1, Iterator2 first2, Iterator2 last2, double mean_x, double mean_y) |
| Sample covariance with precomputed means. | |
| template<typename Iterator1 , typename Iterator2 , typename Projection1 , typename Projection2 > | |
| double | sample_covariance (Iterator1 first1, Iterator1 last1, Iterator2 first2, Iterator2 last2, Projection1 proj1, Projection2 proj2) |
| Sample covariance (projection version) | |
| template<typename Iterator1 , typename Iterator2 > | |
| double | covariance (Iterator1 first1, Iterator1 last1, Iterator2 first2, Iterator2 last2) |
| Covariance (alias for sample_covariance) | |
| template<typename Iterator1 , typename Iterator2 > | |
| double | covariance (Iterator1 first1, Iterator1 last1, Iterator2 first2, Iterator2 last2, double mean_x, double mean_y) |
| Covariance with precomputed means (alias for sample_covariance) | |
| template<typename Iterator1 , typename Iterator2 , typename Projection1 , typename Projection2 > | |
| double | covariance (Iterator1 first1, Iterator1 last1, Iterator2 first2, Iterator2 last2, Projection1 proj1, Projection2 proj2) |
| Covariance (projection version, alias for sample_covariance) | |
| template<typename Iterator1 , typename Iterator2 > | |
| double | pearson_correlation (Iterator1 first1, Iterator1 last1, Iterator2 first2, Iterator2 last2) |
| Pearson correlation coefficient. | |
| template<typename Iterator1 , typename Iterator2 > | |
| double | pearson_correlation (Iterator1 first1, Iterator1 last1, Iterator2 first2, Iterator2 last2, double mean_x, double mean_y) |
| Pearson correlation coefficient with precomputed means. | |
| template<typename Iterator1 , typename Iterator2 , typename Projection1 , typename Projection2 > | |
| double | pearson_correlation (Iterator1 first1, Iterator1 last1, Iterator2 first2, Iterator2 last2, Projection1 proj1, Projection2 proj2) |
| Pearson correlation coefficient (projection version) | |
| template<typename Iterator1 , typename Iterator2 > | |
| double | spearman_correlation (Iterator1 first1, Iterator1 last1, Iterator2 first2, Iterator2 last2) |
| Spearman's rank correlation coefficient. | |
| template<typename Iterator1 , typename Iterator2 , typename Projection1 , typename Projection2 > | |
| double | spearman_correlation (Iterator1 first1, Iterator1 last1, Iterator2 first2, Iterator2 last2, Projection1 proj1, Projection2 proj2) |
| Spearman's rank correlation coefficient (projection version) | |
| template<typename Iterator1 , typename Iterator2 > | |
| double | kendall_tau (Iterator1 first1, Iterator1 last1, Iterator2 first2, Iterator2 last2) |
| Kendall's rank correlation coefficient (tau-b) | |
| template<typename Iterator1 , typename Iterator2 , typename Projection1 , typename Projection2 > | |
| double | kendall_tau (Iterator1 first1, Iterator1 last1, Iterator2 first2, Iterator2 last2, Projection1 proj1, Projection2 proj2) |
| Kendall's rank correlation coefficient (projection version) | |
| template<typename Iterator1 , typename Iterator2 , typename WeightIterator > | |
| double | weighted_covariance (Iterator1 first1, Iterator1 last1, Iterator2 first2, Iterator2 last2, WeightIterator weight_first) |
| Weighted covariance. | |
| template<typename Iterator1 , typename Iterator2 , typename WeightIterator , typename Projection1 , typename Projection2 > | |
| double | weighted_covariance (Iterator1 first1, Iterator1 last1, Iterator2 first2, Iterator2 last2, WeightIterator weight_first, Projection1 proj1, Projection2 proj2) |
| Weighted covariance (projection version) | |
| bool | is_na (double x) |
| Check if a value is NA. | |
| template<typename T > | |
| std::vector< std::vector< T > > | dropna (const std::vector< std::vector< T > > &data) |
| Drop rows containing NA. | |
| template<typename T > | |
| std::vector< T > | dropna (const std::vector< T > &data) |
| Drop NA from a 1-dimensional vector. | |
| template<typename T > | |
| std::vector< T > | fillna (const std::vector< T > &data, T fill_value) |
| Fill NA with a specified value. | |
| std::vector< double > | fillna_mean (const std::vector< double > &data) |
| Fill NA with mean. | |
| std::vector< double > | fillna_median (const std::vector< double > &data) |
| Fill NA with median. | |
| std::vector< double > | fillna_ffill (const std::vector< double > &data) |
| Fill NA with forward fill. | |
| std::vector< double > | fillna_bfill (const std::vector< double > &data) |
| Fill NA with backward fill. | |
| std::vector< double > | fillna_interpolate (const std::vector< double > &data) |
| Fill NA with linear interpolation. | |
| template<typename T , typename Predicate > | |
| std::vector< T > | filter (const std::vector< T > &data, Predicate pred) |
| Filter elements that match a condition. | |
| template<typename T , typename Predicate > | |
| std::vector< std::vector< T > > | filter_rows (const std::vector< std::vector< T > > &data, Predicate pred) |
| Filter rows that match a condition (2-dimensional) | |
| template<typename T > | |
| std::vector< T > | filter_range (const std::vector< T > &data, T min_val, T max_val) |
| Filter values within a range. | |
| std::vector< double > | log_transform (const std::vector< double > &data) |
| Logarithmic transformation (natural logarithm) | |
| std::vector< double > | log1p_transform (const std::vector< double > &data) |
| Logarithmic transformation (log1p: log(1 + x)) | |
| std::vector< double > | sqrt_transform (const std::vector< double > &data) |
| Square root transformation. | |
| std::vector< double > | boxcox_transform (const std::vector< double > &data, double lambda) |
| Box-Cox transformation. | |
| std::vector< double > | rank_transform (const std::vector< double > &data) |
| Rank transformation. | |
| template<typename K , typename V > | |
| group_result< K, V > | group_by (const std::vector< K > &keys, const std::vector< V > &values) |
| Group by. | |
| template<typename K > | |
| aggregation_result< K > | group_mean (const std::vector< K > &keys, const std::vector< double > &values) |
| Mean per group. | |
| template<typename K > | |
| aggregation_result< K > | group_sum (const std::vector< K > &keys, const std::vector< double > &values) |
| Sum per group. | |
| template<typename K > | |
| aggregation_result< K > | group_count (const std::vector< K > &keys, const std::vector< double > &values) |
| Count per group. | |
| template<typename T > | |
| std::vector< T > | sort_values (const std::vector< T > &data, bool ascending=true) |
| Return a sorted vector (ascending) | |
| template<typename T > | |
| std::vector< std::size_t > | argsort (const std::vector< T > &data, bool ascending=true) |
| Return indices in sorted order. | |
| template<typename T > | |
| std::vector< T > | sample_with_replacement (const std::vector< T > &data, std::size_t n) |
| Random sampling (with replacement) | |
| template<typename T > | |
| std::vector< T > | sample_without_replacement (const std::vector< T > &data, std::size_t n) |
| Random sampling (without replacement) | |
| template<typename K , typename V > | |
| std::vector< V > | stratified_sample (const std::vector< K > &strata, const std::vector< V > &data, double sample_ratio) |
| Stratified sampling. | |
| template<typename T > | |
| std::vector< T > | drop_duplicates (const std::vector< T > &data) |
| Drop duplicates. | |
| template<typename T > | |
| std::map< T, std::size_t > | value_counts (const std::vector< T > &data) |
| Count duplicates. | |
| template<typename T > | |
| std::vector< T > | get_duplicates (const std::vector< T > &data) |
| Get duplicate values. | |
| std::vector< double > | rolling_mean (const std::vector< double > &data, std::size_t window) |
| Moving average. | |
| std::vector< double > | rolling_std (const std::vector< double > &data, std::size_t window) |
| Moving standard deviation. | |
| std::vector< double > | rolling_min (const std::vector< double > &data, std::size_t window) |
| Moving minimum. | |
| std::vector< double > | rolling_max (const std::vector< double > &data, std::size_t window) |
| Moving maximum. | |
| std::vector< double > | rolling_sum (const std::vector< double > &data, std::size_t window) |
| Moving sum. | |
| template<typename T > | |
| label_encoding_result< T > | label_encode (const std::vector< T > &data) |
| Label encoding. | |
| template<typename T > | |
| std::vector< std::vector< double > > | one_hot_encode (const std::vector< T > &data) |
| One-hot encoding. | |
| std::vector< std::size_t > | bin_equal_width (const std::vector< double > &data, std::size_t n_bins) |
| Binning (equal width) | |
| std::vector< std::size_t > | bin_equal_freq (const std::vector< double > &data, std::size_t n_bins) |
| Binning (equal frequency) | |
| validation_result | validate_data (const std::vector< double > &data, bool allow_missing=false, bool allow_infinite=false, bool allow_negative=true) |
| Data validation. | |
| bool | validate_range (const std::vector< double > &data, double min_val=-std::numeric_limits< double >::infinity(), double max_val=std::numeric_limits< double >::infinity()) |
| Range validation. | |
| double | log_factorial (std::uint64_t n) |
| Calculate log factorial. | |
| double | log_binomial_coef (std::uint64_t n, std::uint64_t k) |
| Calculate log binomial coefficient. | |
| double | binomial_coef (std::uint64_t n, std::uint64_t k) |
| Calculate binomial coefficient. | |
| double | binomial_pmf (std::uint64_t k, std::uint64_t n, double p) |
| Binomial distribution probability mass function (PMF) | |
| double | binomial_cdf (std::uint64_t k, std::uint64_t n, double p) |
| Binomial distribution cumulative distribution function (CDF) | |
| std::uint64_t | binomial_quantile (double prob, std::uint64_t n, double p) |
| Binomial distribution quantile function. | |
| template<typename Engine = default_random_engine> | |
| std::uint64_t | binomial_rand (std::uint64_t n, double p, Engine &engine) |
| Binomial distribution random number generation. | |
| std::uint64_t | binomial_rand (std::uint64_t n, double p) |
| Binomial distribution random number generation (using default engine) | |
| double | poisson_pmf (std::uint64_t k, double lambda) |
| Poisson distribution probability mass function (PMF) | |
| double | poisson_cdf (std::uint64_t k, double lambda) |
| Poisson distribution cumulative distribution function (CDF) | |
| std::uint64_t | poisson_quantile (double p, double lambda) |
| Poisson distribution quantile function. | |
| template<typename Engine = default_random_engine> | |
| std::uint64_t | poisson_rand (double lambda, Engine &engine) |
| Poisson distribution random number generation. | |
| std::uint64_t | poisson_rand (double lambda) |
| Poisson distribution random number generation (using default engine) | |
| double | geometric_pmf (std::uint64_t k, double p) |
| Geometric distribution probability mass function (PMF) | |
| double | geometric_cdf (std::uint64_t k, double p) |
| Geometric distribution cumulative distribution function (CDF) | |
| std::uint64_t | geometric_quantile (double prob, double p) |
| Geometric distribution quantile function (inverse CDF) | |
| template<typename Engine = default_random_engine> | |
| std::uint64_t | geometric_rand (double p, Engine &engine) |
| Geometric distribution random number generation. | |
| std::uint64_t | geometric_rand (double p) |
| Geometric distribution random number generation (using default engine) | |
| double | hypergeom_pmf (std::uint64_t k, std::uint64_t N, std::uint64_t K, std::uint64_t n) |
| Hypergeometric distribution probability mass function (PMF) | |
| double | hypergeom_cdf (std::uint64_t k, std::uint64_t N, std::uint64_t K, std::uint64_t n) |
| Hypergeometric distribution cumulative distribution function (CDF) | |
| std::uint64_t | hypergeom_quantile (double p, std::uint64_t N, std::uint64_t K, std::uint64_t n) |
| Hypergeometric distribution quantile function (inverse CDF) | |
| template<typename Engine = default_random_engine> | |
| std::uint64_t | hypergeom_rand (std::uint64_t N, std::uint64_t K, std::uint64_t n, Engine &engine) |
| Hypergeometric distribution random number generation. | |
| std::uint64_t | hypergeom_rand (std::uint64_t N, std::uint64_t K, std::uint64_t n) |
| Hypergeometric distribution random number generation (using default engine) | |
| double | nbinom_pmf (std::uint64_t k, double r, double p) |
| Negative binomial distribution probability mass function (PMF) | |
| double | nbinom_cdf (std::uint64_t k, double r, double p) |
| Negative binomial distribution cumulative distribution function (CDF) | |
| std::uint64_t | nbinom_quantile (double prob, double r, double p) |
| Negative binomial distribution quantile function (inverse CDF) | |
| template<typename Engine = default_random_engine> | |
| std::uint64_t | nbinom_rand (double r, double p, Engine &engine) |
| Negative binomial distribution random number generation. | |
| std::uint64_t | nbinom_rand (double r, double p) |
| Negative binomial distribution random number generation (using default engine) | |
| double | bernoulli_pmf (std::uint64_t k, double p) |
| Bernoulli distribution probability mass function (PMF) | |
| double | bernoulli_cdf (std::uint64_t k, double p) |
| Bernoulli distribution cumulative distribution function (CDF) | |
| std::uint64_t | bernoulli_quantile (double prob, double p) |
| Bernoulli distribution quantile function. | |
| template<typename Engine = default_random_engine> | |
| std::uint64_t | bernoulli_rand (double p, Engine &engine) |
| Bernoulli distribution random number generation. | |
| std::uint64_t | bernoulli_rand (double p) |
| Bernoulli distribution random number generation (using default engine) | |
| double | discrete_uniform_pmf (std::int64_t k, std::int64_t a, std::int64_t b) |
| Discrete uniform distribution probability mass function (PMF) | |
| double | discrete_uniform_cdf (std::int64_t k, std::int64_t a, std::int64_t b) |
| Discrete uniform distribution cumulative distribution function (CDF) | |
| std::int64_t | discrete_uniform_quantile (double p, std::int64_t a, std::int64_t b) |
| Discrete uniform distribution quantile function. | |
| template<typename Engine = default_random_engine> | |
| std::int64_t | discrete_uniform_rand (std::int64_t a, std::int64_t b, Engine &engine) |
| Discrete uniform distribution random number generation. | |
| std::int64_t | discrete_uniform_rand (std::int64_t a, std::int64_t b) |
| Discrete uniform distribution random number generation (using default engine) | |
| template<typename Iterator > | |
| double | range (Iterator first, Iterator last) |
| Range (maximum - minimum) | |
| template<typename Iterator , typename Projection > | |
| double | range (Iterator first, Iterator last, Projection proj) |
| Range of projected values using a lambda expression. | |
| template<typename Iterator > | |
| double | var (Iterator first, Iterator last, std::size_t ddof=0) |
| Variance (ddof = Delta Degrees of Freedom) | |
| template<typename Iterator > | |
| double | var (Iterator first, Iterator last, double precomputed_mean, std::size_t ddof) |
| Variance using precomputed mean (with ddof) | |
| template<typename Iterator , typename Projection , typename = std::enable_if_t< std::is_invocable_v<Projection, typename std::iterator_traits<Iterator>::value_type>>> | |
| double | var (Iterator first, Iterator last, Projection proj, std::size_t ddof=0) |
| Variance of projected values using a lambda expression (with ddof) | |
| template<typename Iterator , typename Projection > | |
| double | var (Iterator first, Iterator last, Projection proj, double precomputed_mean, std::size_t ddof) |
| Variance of projected values using precomputed mean (with ddof) | |
| template<typename Iterator > | |
| double | population_variance (Iterator first, Iterator last) |
| Population variance. | |
| template<typename Iterator > | |
| double | population_variance (Iterator first, Iterator last, double precomputed_mean) |
| Population variance using precomputed mean. | |
| template<typename Iterator , typename Projection , typename = std::enable_if_t< std::is_invocable_v<Projection, typename std::iterator_traits<Iterator>::value_type>>> | |
| double | population_variance (Iterator first, Iterator last, Projection proj) |
| Population variance of projected values using a lambda expression. | |
| template<typename Iterator , typename Projection > | |
| double | population_variance (Iterator first, Iterator last, Projection proj, double precomputed_mean) |
| Population variance of projected values using precomputed mean. | |
| template<typename Iterator > | |
| double | sample_variance (Iterator first, Iterator last) |
| Sample variance (unbiased variance) | |
| template<typename Iterator > | |
| double | sample_variance (Iterator first, Iterator last, double precomputed_mean) |
| Sample variance using precomputed mean. | |
| template<typename Iterator , typename Projection , typename = std::enable_if_t< std::is_invocable_v<Projection, typename std::iterator_traits<Iterator>::value_type>>> | |
| double | sample_variance (Iterator first, Iterator last, Projection proj) |
| Sample variance of projected values using a lambda expression. | |
| template<typename Iterator , typename Projection > | |
| double | sample_variance (Iterator first, Iterator last, Projection proj, double precomputed_mean) |
| Sample variance of projected values using precomputed mean. | |
| template<typename Iterator > | |
| double | variance (Iterator first, Iterator last) |
| Variance (alias for sample_variance) | |
| template<typename Iterator > | |
| double | variance (Iterator first, Iterator last, double precomputed_mean) |
| Variance using precomputed mean. | |
| template<typename Iterator , typename Projection , typename = std::enable_if_t< std::is_invocable_v<Projection, typename std::iterator_traits<Iterator>::value_type>>> | |
| double | variance (Iterator first, Iterator last, Projection proj) |
| Variance of projected values using a lambda expression. | |
| template<typename Iterator , typename Projection > | |
| double | variance (Iterator first, Iterator last, Projection proj, double precomputed_mean) |
| Variance of projected values using precomputed mean. | |
| template<typename Iterator > | |
| double | stdev (Iterator first, Iterator last, std::size_t ddof=0) |
| Standard deviation (ddof = Delta Degrees of Freedom) | |
| template<typename Iterator > | |
| double | stdev (Iterator first, Iterator last, double precomputed_mean, std::size_t ddof) |
| Standard deviation using precomputed mean (with ddof) | |
| template<typename Iterator , typename Projection , typename = std::enable_if_t< std::is_invocable_v<Projection, typename std::iterator_traits<Iterator>::value_type>>> | |
| double | stdev (Iterator first, Iterator last, Projection proj, std::size_t ddof=0) |
| Standard deviation of projected values using a lambda expression (with ddof) | |
| template<typename Iterator , typename Projection > | |
| double | stdev (Iterator first, Iterator last, Projection proj, double precomputed_mean, std::size_t ddof) |
| Standard deviation of projected values using precomputed mean (with ddof) | |
| template<typename Iterator > | |
| double | population_stddev (Iterator first, Iterator last) |
| Population standard deviation. | |
| template<typename Iterator > | |
| double | population_stddev (Iterator first, Iterator last, double precomputed_mean) |
| Population standard deviation using precomputed mean. | |
| template<typename Iterator , typename Projection , typename = std::enable_if_t< std::is_invocable_v<Projection, typename std::iterator_traits<Iterator>::value_type>>> | |
| double | population_stddev (Iterator first, Iterator last, Projection proj) |
| Population standard deviation of projected values using a lambda expression. | |
| template<typename Iterator , typename Projection > | |
| double | population_stddev (Iterator first, Iterator last, Projection proj, double precomputed_mean) |
| Population standard deviation of projected values using precomputed mean. | |
| template<typename Iterator > | |
| double | sample_stddev (Iterator first, Iterator last) |
| Sample standard deviation. | |
| template<typename Iterator > | |
| double | sample_stddev (Iterator first, Iterator last, double precomputed_mean) |
| Sample standard deviation using precomputed mean. | |
| template<typename Iterator , typename Projection , typename = std::enable_if_t< std::is_invocable_v<Projection, typename std::iterator_traits<Iterator>::value_type>>> | |
| double | sample_stddev (Iterator first, Iterator last, Projection proj) |
| Sample standard deviation of projected values using a lambda expression. | |
| template<typename Iterator , typename Projection > | |
| double | sample_stddev (Iterator first, Iterator last, Projection proj, double precomputed_mean) |
| Sample standard deviation of projected values using precomputed mean. | |
| template<typename Iterator > | |
| double | stddev (Iterator first, Iterator last) |
| Standard deviation (alias for sample_stddev) | |
| template<typename Iterator > | |
| double | stddev (Iterator first, Iterator last, double precomputed_mean) |
| Standard deviation using precomputed mean. | |
| template<typename Iterator , typename Projection , typename = std::enable_if_t< std::is_invocable_v<Projection, typename std::iterator_traits<Iterator>::value_type>>> | |
| double | stddev (Iterator first, Iterator last, Projection proj) |
| Standard deviation of projected values using a lambda expression. | |
| template<typename Iterator , typename Projection > | |
| double | stddev (Iterator first, Iterator last, Projection proj, double precomputed_mean) |
| Standard deviation of projected values using precomputed mean. | |
| template<typename Iterator > | |
| double | coefficient_of_variation (Iterator first, Iterator last) |
| Coefficient of variation. | |
| template<typename Iterator > | |
| double | coefficient_of_variation (Iterator first, Iterator last, double precomputed_mean) |
| Coefficient of variation using precomputed mean. | |
| template<typename Iterator , typename Projection , typename = std::enable_if_t< std::is_invocable_v<Projection, typename std::iterator_traits<Iterator>::value_type>>> | |
| double | coefficient_of_variation (Iterator first, Iterator last, Projection proj) |
| Coefficient of variation of projected values using a lambda expression. | |
| template<typename Iterator , typename Projection > | |
| double | coefficient_of_variation (Iterator first, Iterator last, Projection proj, double precomputed_mean) |
| Coefficient of variation of projected values using precomputed mean. | |
| template<typename Iterator > | |
| double | iqr (Iterator first, Iterator last) |
| Interquartile range (accepts a sorted range) | |
| template<typename Iterator , typename Projection > | |
| double | iqr (Iterator first, Iterator last, Projection proj) |
| Interquartile range of projected values (projection results must be in sorted order) | |
| template<typename Iterator > | |
| double | mean_absolute_deviation (Iterator first, Iterator last) |
| Mean absolute deviation. | |
| template<typename Iterator > | |
| double | mean_absolute_deviation (Iterator first, Iterator last, double precomputed_mean) |
| Mean absolute deviation using precomputed mean. | |
| template<typename Iterator , typename Projection , typename = std::enable_if_t< std::is_invocable_v<Projection, typename std::iterator_traits<Iterator>::value_type>>> | |
| double | mean_absolute_deviation (Iterator first, Iterator last, Projection proj) |
| Mean absolute deviation of projected values using a lambda expression. | |
| template<typename Iterator , typename Projection > | |
| double | mean_absolute_deviation (Iterator first, Iterator last, Projection proj, double precomputed_mean) |
| Mean absolute deviation of projected values using precomputed mean. | |
| template<typename Iterator , typename WeightIterator > | |
| double | weighted_variance (Iterator first, Iterator last, WeightIterator weight_first, WeightIterator weight_last) |
| Weighted variance (reliability weights / analytic weights) | |
| template<typename Iterator , typename WeightIterator > | |
| double | weighted_variance (Iterator first, Iterator last, WeightIterator weight_first) |
| Weighted variance (reliability weights / analytic weights) | |
| template<typename Iterator , typename WeightIterator , typename Projection > | |
| double | weighted_variance (Iterator first, Iterator last, WeightIterator weight_first, WeightIterator weight_last, Projection proj) |
| Weighted variance (projection version) | |
| template<typename Iterator , typename WeightIterator , typename Projection > | |
| double | weighted_variance (Iterator first, Iterator last, WeightIterator weight_first, Projection proj) |
| Weighted variance (projection version) | |
| template<typename Iterator , typename WeightIterator > | |
| double | weighted_stddev (Iterator first, Iterator last, WeightIterator weight_first, WeightIterator weight_last) |
| Weighted standard deviation. | |
| template<typename Iterator , typename WeightIterator > | |
| double | weighted_stddev (Iterator first, Iterator last, WeightIterator weight_first) |
| Weighted standard deviation. | |
| template<typename Iterator , typename WeightIterator , typename Projection > | |
| double | weighted_stddev (Iterator first, Iterator last, WeightIterator weight_first, WeightIterator weight_last, Projection proj) |
| Weighted standard deviation (projection version) | |
| template<typename Iterator , typename WeightIterator , typename Projection > | |
| double | weighted_stddev (Iterator first, Iterator last, WeightIterator weight_first, Projection proj) |
| Weighted standard deviation (projection version) | |
| template<typename Iterator > | |
| double | geometric_stddev (Iterator first, Iterator last) |
| Geometric standard deviation. | |
| template<typename Iterator , typename Projection > | |
| double | geometric_stddev (Iterator first, Iterator last, Projection proj) |
| Geometric standard deviation (projection version) | |
| template<typename Iterator1 , typename Iterator2 > | |
| double | euclidean_distance (Iterator1 first1, Iterator1 last1, Iterator2 first2, Iterator2 last2) |
| Euclidean distance (L2 norm) | |
| template<typename Iterator1 , typename Iterator2 , typename Proj1 , typename Proj2 > | |
| double | euclidean_distance (Iterator1 first1, Iterator1 last1, Iterator2 first2, Iterator2 last2, Proj1 proj1, Proj2 proj2) |
| Euclidean distance with projection. | |
| template<typename Iterator1 , typename Iterator2 > | |
| double | manhattan_distance (Iterator1 first1, Iterator1 last1, Iterator2 first2, Iterator2 last2) |
| Manhattan distance (L1 norm, taxicab distance) | |
| template<typename Iterator1 , typename Iterator2 , typename Proj1 , typename Proj2 > | |
| double | manhattan_distance (Iterator1 first1, Iterator1 last1, Iterator2 first2, Iterator2 last2, Proj1 proj1, Proj2 proj2) |
| Manhattan distance with projection. | |
| template<typename Iterator1 , typename Iterator2 > | |
| double | cosine_similarity (Iterator1 first1, Iterator1 last1, Iterator2 first2, Iterator2 last2) |
| Cosine similarity. | |
| template<typename Iterator1 , typename Iterator2 , typename Proj1 , typename Proj2 > | |
| double | cosine_similarity (Iterator1 first1, Iterator1 last1, Iterator2 first2, Iterator2 last2, Proj1 proj1, Proj2 proj2) |
| Cosine similarity with projection. | |
| template<typename Iterator1 , typename Iterator2 > | |
| double | cosine_distance (Iterator1 first1, Iterator1 last1, Iterator2 first2, Iterator2 last2) |
| Cosine distance. | |
| template<typename Iterator1 , typename Iterator2 , typename Proj1 , typename Proj2 > | |
| double | cosine_distance (Iterator1 first1, Iterator1 last1, Iterator2 first2, Iterator2 last2, Proj1 proj1, Proj2 proj2) |
| Cosine distance with projection. | |
| double | mahalanobis_distance (const std::vector< double > &x, const std::vector< double > &mean, const std::vector< std::vector< double > > &cov_matrix) |
| Mahalanobis distance. | |
| template<typename Iterator1 , typename Iterator2 > | |
| double | minkowski_distance (Iterator1 first1, Iterator1 last1, Iterator2 first2, Iterator2 last2, double p) |
| Minkowski distance (generalized Lp distance) | |
| template<typename Iterator1 , typename Iterator2 , typename Proj1 , typename Proj2 > | |
| double | minkowski_distance (Iterator1 first1, Iterator1 last1, Iterator2 first2, Iterator2 last2, double p, Proj1 proj1, Proj2 proj2) |
| Minkowski distance with projection. | |
| template<typename Iterator1 , typename Iterator2 > | |
| double | chebyshev_distance (Iterator1 first1, Iterator1 last1, Iterator2 first2, Iterator2 last2) |
| Chebyshev distance (L∞ norm, maximum metric) | |
| template<typename Iterator1 , typename Iterator2 , typename Proj1 , typename Proj2 > | |
| double | chebyshev_distance (Iterator1 first1, Iterator1 last1, Iterator2 first2, Iterator2 last2, Proj1 proj1, Proj2 proj2) |
| Chebyshev distance with projection. | |
| template<typename Iterator > | |
| double | cohens_d (Iterator first, Iterator last, double mu0, double sigma) |
| Cohen's d (one-sample, known population standard deviation) | |
| template<typename Iterator > | |
| double | cohens_d (Iterator first, Iterator last, double mu0) |
| Cohen's d (one-sample, using sample standard deviation) | |
| template<typename Iterator1 , typename Iterator2 > | |
| double | cohens_d_two_sample (Iterator1 first1, Iterator1 last1, Iterator2 first2, Iterator2 last2) |
| Cohen's d (two-sample, pooled standard deviation) | |
| double | hedges_correction_factor (double df) |
| Hedges' bias correction factor J. | |
| template<typename Iterator > | |
| double | hedges_g (Iterator first, Iterator last, double mu0) |
| Hedges' g (one-sample) | |
| template<typename Iterator1 , typename Iterator2 > | |
| double | hedges_g_two_sample (Iterator1 first1, Iterator1 last1, Iterator2 first2, Iterator2 last2) |
| Hedges' g (two-sample) | |
| template<typename Iterator1 , typename Iterator2 > | |
| double | glass_delta (Iterator1 control_first, Iterator1 control_last, Iterator2 treatment_first, Iterator2 treatment_last) |
| Glass's Delta (using control group's standard deviation) | |
| double | t_to_r (double t, double df) |
| Convert t-value to correlation coefficient. | |
| double | d_to_r (double d) |
| Convert Cohen's d to correlation coefficient. | |
| double | r_to_d (double r) |
| Convert correlation coefficient to Cohen's d. | |
| double | eta_squared (double ss_effect, double ss_total) |
| Calculate eta-squared from F-test. | |
| double | partial_eta_squared (double f, double df1, double df2) |
| Calculate partial eta-squared from F-test. | |
| double | omega_squared (double ss_effect, double ss_total, double ms_error, double df_effect) |
| Omega-squared. | |
| double | cohens_h (double p1, double p2) |
| Cohen's h (effect size for difference between two proportions) | |
| double | odds_ratio (double a, double b, double c, double d) |
| Odds ratio. | |
| double | risk_ratio (double a, double b, double c, double d) |
| Relative risk (risk ratio) | |
| effect_size_magnitude | interpret_cohens_d (double d) |
| Interpret Cohen's d. | |
| effect_size_magnitude | interpret_correlation (double r) |
| Interpret correlation coefficient. | |
| effect_size_magnitude | interpret_eta_squared (double eta2) |
| Interpret eta-squared. | |
| template<typename Iterator > | |
| double | standard_error (Iterator first, Iterator last) |
| Calculate standard error of the mean. | |
| template<typename Iterator , typename Projection > | |
| double | standard_error (Iterator first, Iterator last, Projection proj) |
| Calculate standard error of the mean (projection version) | |
| template<typename Iterator > | |
| double | standard_error (Iterator first, Iterator last, double precomputed_stddev) |
| Calculate standard error of the mean (using precomputed standard deviation) | |
| template<typename Iterator > | |
| confidence_interval | 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 | ci_mean (Iterator first, Iterator last, double confidence, Projection proj) |
| Calculate confidence interval for mean (projection version) | |
| template<typename Iterator > | |
| confidence_interval | 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 | ci_proportion (std::size_t successes, std::size_t trials, double confidence=0.95) |
| Calculate confidence interval for proportion (Wald method) | |
| confidence_interval | 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 | 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 | 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 | 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 | margin_of_error_mean (Iterator first, Iterator last, double confidence=0.95) |
| Calculate margin of error for mean. | |
| template<typename Iterator , typename Projection > | |
| double | margin_of_error_mean (Iterator first, Iterator last, double confidence, Projection proj) |
| Calculate margin of error for mean (projection version) | |
| double | margin_of_error_proportion (std::size_t successes, std::size_t n, double confidence=0.95) |
| Calculate margin of error for proportion. | |
| double | 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 | 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 | 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 | 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 | 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. | |
| template<typename Iterator > | |
| auto | frequency_table (Iterator first, Iterator last) -> frequency_table_result< typename std::iterator_traits< Iterator >::value_type > |
| Create frequency table (returned with sorted keys) | |
| template<typename Iterator , typename Projection > | |
| auto | frequency_table (Iterator first, Iterator last, Projection proj) -> frequency_table_result< std::invoke_result_t< Projection, typename std::iterator_traits< Iterator >::value_type > > |
| Frequency table with projection. | |
| template<typename Iterator > | |
| auto | frequency_count (Iterator first, Iterator last) -> std::unordered_map< typename std::iterator_traits< Iterator >::value_type, std::size_t > |
| Return frequency for each value (unordered_map version, fast) | |
| template<typename Iterator , typename Projection > | |
| auto | frequency_count (Iterator first, Iterator last, Projection proj) -> std::unordered_map< std::invoke_result_t< Projection, typename std::iterator_traits< Iterator >::value_type >, std::size_t > |
| Frequency count with projection. | |
| template<typename Iterator > | |
| auto | relative_frequency (Iterator first, Iterator last) -> std::unordered_map< typename std::iterator_traits< Iterator >::value_type, double > |
| Return relative frequency for each value. | |
| template<typename Iterator , typename Projection > | |
| auto | relative_frequency (Iterator first, Iterator last, Projection proj) -> std::unordered_map< std::invoke_result_t< Projection, typename std::iterator_traits< Iterator >::value_type >, double > |
| Relative frequency with projection. | |
| template<typename Iterator > | |
| auto | cumulative_frequency (Iterator first, Iterator last) -> std::vector< std::pair< typename std::iterator_traits< Iterator >::value_type, std::size_t > > |
| Return cumulative frequency (for sorted values) | |
| template<typename Iterator , typename Projection > | |
| auto | cumulative_frequency (Iterator first, Iterator last, Projection proj) -> std::vector< std::pair< std::invoke_result_t< Projection, typename std::iterator_traits< Iterator >::value_type >, std::size_t > > |
| Cumulative frequency with projection. | |
| template<typename Iterator > | |
| auto | cumulative_relative_frequency (Iterator first, Iterator last) -> std::vector< std::pair< typename std::iterator_traits< Iterator >::value_type, double > > |
| Return cumulative relative frequency (for sorted values) | |
| template<typename Iterator , typename Projection > | |
| auto | cumulative_relative_frequency (Iterator first, Iterator last, Projection proj) -> std::vector< std::pair< std::invoke_result_t< Projection, typename std::iterator_traits< Iterator >::value_type >, double > > |
| Cumulative relative frequency with projection. | |
| glm_result | glm_fit (const std::vector< std::vector< double > > &X, const std::vector< double > &y, distribution_family family=distribution_family::gaussian, link_function link=link_function::identity, std::size_t max_iter=100, double tol=1e-8) |
| Fit a generalized linear model. | |
| glm_result | logistic_regression (const std::vector< std::vector< double > > &X, const std::vector< double > &y, std::size_t max_iter=100, double tol=1e-8) |
| Logistic regression. | |
| double | predict_probability (const glm_result &model, const std::vector< double > &x) |
| Probability prediction with logistic regression. | |
| std::vector< double > | odds_ratios (const glm_result &model) |
| Calculate odds ratios. | |
| std::vector< std::pair< double, double > > | odds_ratios_ci (const glm_result &model, double confidence=0.95) |
| Confidence intervals for odds ratios. | |
| glm_result | poisson_regression (const std::vector< std::vector< double > > &X, const std::vector< double > &y, std::size_t max_iter=100, double tol=1e-8) |
| Poisson regression. | |
| double | predict_count (const glm_result &model, const std::vector< double > &x) |
| Expected count prediction with Poisson regression. | |
| std::vector< double > | incidence_rate_ratios (const glm_result &model) |
| Calculate Incidence Rate Ratios. | |
| glm_residuals | compute_glm_residuals (const glm_result &model, const std::vector< std::vector< double > > &X, const std::vector< double > &y) |
| Calculate GLM residuals. | |
| double | overdispersion_test (const glm_result &model, const std::vector< std::vector< double > > &X, const std::vector< double > &y) |
| Overdispersion test (for Poisson regression) | |
| double | pseudo_r_squared_mcfadden (const glm_result &model) |
| McFadden's pseudo R-squared. | |
| double | pseudo_r_squared_nagelkerke (const glm_result &model, const std::vector< double > &y, std::size_t n) |
| Nagelkerke's pseudo R-squared. | |
| template<typename IteratorX , typename IteratorY > | |
| simple_regression_result | simple_linear_regression (IteratorX x_first, IteratorX x_last, IteratorY y_first, IteratorY y_last) |
| Perform simple linear regression. | |
| multiple_regression_result | multiple_linear_regression (const std::vector< std::vector< double > > &X, const std::vector< double > &y) |
| Perform multiple linear regression. | |
| double | predict (const simple_regression_result &model, double x) |
| Make prediction using simple regression model. | |
| double | predict (const multiple_regression_result &model, const std::vector< double > &x) |
| Make prediction using multiple regression model. | |
| template<typename IteratorX > | |
| prediction_interval | prediction_interval_simple (const simple_regression_result &model, IteratorX x_first, IteratorX x_last, double x_new, double confidence=0.95) |
| Calculate prediction interval for simple regression model. | |
| template<typename IteratorX > | |
| prediction_interval | confidence_interval_mean (const simple_regression_result &model, IteratorX x_first, IteratorX x_last, double x_new, double confidence=0.95) |
| Calculate confidence interval for mean of simple regression model. | |
| template<typename IteratorX , typename IteratorY > | |
| residual_diagnostics | compute_residual_diagnostics (const simple_regression_result &model, IteratorX x_first, IteratorX x_last, IteratorY y_first, IteratorY y_last) |
| Perform residual diagnostics for simple regression model. | |
| residual_diagnostics | compute_residual_diagnostics (const multiple_regression_result &model, const std::vector< std::vector< double > > &X, const std::vector< double > &y) |
| Perform residual diagnostics for multiple regression model. | |
| std::vector< double > | compute_vif (const std::vector< std::vector< double > > &X) |
| Calculate VIF (Variance Inflation Factor) for each predictor. | |
| double | correlation_matrix_determinant (const std::vector< std::vector< double > > &X) |
| Calculate determinant of correlation matrix. | |
| double | multicollinearity_score (const std::vector< std::vector< double > > &X) |
| Calculate multicollinearity score. | |
| template<typename IteratorY , typename IteratorPred > | |
| double | r_squared (IteratorY y_first, IteratorY y_last, IteratorPred pred_first, IteratorPred pred_last) |
| Calculate coefficient of determination from observed and predicted values. | |
| template<typename IteratorY , typename IteratorPred > | |
| double | adjusted_r_squared (IteratorY y_first, IteratorY y_last, IteratorPred pred_first, IteratorPred pred_last, std::size_t num_predictors) |
| Calculate adjusted coefficient of determination. | |
| missing_pattern_info | analyze_missing_patterns (const std::vector< std::vector< double > > &data) |
| Analyze missing patterns. | |
| std::vector< std::vector< double > > | create_missing_indicator (const std::vector< std::vector< double > > &data) |
| Create missing indicator variables. | |
| mcar_test_result | test_mcar_simple (const std::vector< std::vector< double > > &data) |
| Little's MCAR test (simplified version) | |
| missing_mechanism | diagnose_missing_mechanism (const std::vector< std::vector< double > > &data) |
| Simple diagnosis of missing mechanism. | |
| std::vector< double > | impute_conditional_mean (const std::vector< std::vector< double > > &data, std::size_t target_col, const std::vector< std::size_t > &predictor_cols) |
| Single imputation by conditional mean. | |
| multiple_imputation_result | multiple_imputation_pmm (const std::vector< std::vector< double > > &data, std::size_t m=5, unsigned int seed=0) |
| Multiple imputation (PMM: Predictive Mean Matching) | |
| multiple_imputation_result | multiple_imputation_bootstrap (const std::vector< std::vector< double > > &data, std::size_t m=5, unsigned int seed=0) |
| Multiple imputation (simplified Bootstrap EM method) | |
| sensitivity_analysis_result | sensitivity_analysis_pattern_mixture (const std::vector< double > &data, const std::vector< double > &delta_values) |
| Sensitivity analysis using pattern mixture model. | |
| sensitivity_analysis_result | sensitivity_analysis_selection_model (const std::vector< double > &data, const std::vector< double > &phi_values) |
| Sensitivity analysis using selection model. | |
| tipping_point_result | find_tipping_point (const std::vector< double > &data, double threshold=0.0, double delta_min=-5.0, double delta_max=5.0, std::size_t n_points=100) |
| Tipping point analysis. | |
| complete_case_result | extract_complete_cases (const std::vector< std::vector< double > > &data) |
| Extract complete cases. | |
| std::vector< std::vector< double > > | correlation_matrix_pairwise (const std::vector< std::vector< double > > &data) |
| Correlation matrix using available case analysis (pairwise deletion) | |
| double | aic (double log_likelihood, std::size_t k) |
| Calculate AIC (Akaike Information Criterion) | |
| double | aic_linear (const simple_regression_result &model, std::size_t n) |
| Calculate AIC from simple regression model. | |
| double | aic_linear (const multiple_regression_result &model, std::size_t n) |
| Calculate AIC from multiple regression model. | |
| double | aicc (double log_likelihood, std::size_t n, std::size_t k) |
| Calculate AICc (corrected AIC) | |
| double | bic (double log_likelihood, std::size_t n, std::size_t k) |
| Calculate BIC (Bayesian Information Criterion) | |
| double | bic_linear (const simple_regression_result &model, std::size_t n) |
| Calculate BIC from simple regression model. | |
| double | bic_linear (const multiple_regression_result &model, std::size_t n) |
| Calculate BIC from multiple regression model. | |
| template<typename IteratorX , typename IteratorY > | |
| double | press_statistic (IteratorX x_first, IteratorX x_last, IteratorY y_first, IteratorY y_last, const simple_regression_result &model) |
| Calculate PRESS statistic. | |
| std::vector< std::vector< std::size_t > > | create_cv_folds (std::size_t n, std::size_t k, bool shuffle=true) |
| Generate indices for k-fold cross-validation. | |
| cv_result | cross_validate_linear (const std::vector< std::vector< double > > &X, const std::vector< double > &y, std::size_t k=5) |
| Perform k-fold cross-validation for multiple regression model. | |
| cv_result | loocv_linear (const std::vector< std::vector< double > > &X, const std::vector< double > &y) |
| Perform leave-one-out cross-validation. | |
| regularized_regression_result | ridge_regression (const std::vector< std::vector< double > > &X, const std::vector< double > &y, double lambda, bool standardize=true, std::size_t max_iter=1000, double tol=1e-6) |
| Perform Ridge regression (L2 regularization) | |
| regularized_regression_result | lasso_regression (const std::vector< std::vector< double > > &X, const std::vector< double > &y, double lambda, bool standardize=true, std::size_t max_iter=1000, double tol=1e-6) |
| Perform Lasso regression (L1 regularization) | |
| regularized_regression_result | elastic_net_regression (const std::vector< std::vector< double > > &X, const std::vector< double > &y, double lambda, double alpha=0.5, bool standardize=true, std::size_t max_iter=1000, double tol=1e-6) |
| Perform Elastic Net regression (L1 + L2 regularization) | |
| std::pair< double, std::vector< double > > | cv_ridge (const std::vector< std::vector< double > > &X, const std::vector< double > &y, const std::vector< double > &lambda_grid, std::size_t k=5) |
| Select optimal lambda for Ridge regression using cross-validation. | |
| std::pair< double, std::vector< double > > | cv_lasso (const std::vector< std::vector< double > > &X, const std::vector< double > &y, const std::vector< double > &lambda_grid, std::size_t k=5) |
| Select optimal lambda for Lasso regression using cross-validation. | |
| std::vector< double > | generate_lambda_grid (const std::vector< std::vector< double > > &X, const std::vector< double > &y, std::size_t n_lambda=100, double lambda_min_ratio=0.0001) |
| Automatically generate lambda grid for regularized regression. | |
| std::vector< std::vector< double > > | covariance_matrix (const std::vector< std::vector< double > > &data) |
| Calculate sample covariance matrix. | |
| std::vector< std::vector< double > > | correlation_matrix (const std::vector< std::vector< double > > &data) |
| Calculate Pearson correlation matrix. | |
| std::vector< std::vector< double > > | standardize (const std::vector< std::vector< double > > &data) |
| Z-score standardization. | |
| std::vector< std::vector< double > > | min_max_scale (const std::vector< std::vector< double > > &data) |
| Min-Max normalization (0-1 scaling) | |
| std::pair< double, std::vector< double > > | power_iteration (const std::vector< std::vector< double > > &matrix, std::size_t max_iter=1000, double tol=1e-10) |
| Find largest eigenvalue and eigenvector using power iteration. | |
| pca_result | pca (const std::vector< std::vector< double > > &data, std::size_t n_components) |
| Principal Component Analysis. | |
| std::vector< std::vector< double > > | pca_transform (const std::vector< std::vector< double > > &data, const pca_result &pca) |
| Project data onto principal component space. | |
| template<typename Iterator > | |
| std::vector< double > | compute_ranks_with_ties (Iterator first, Iterator last) |
| Compute ranks with tie handling. | |
| std::vector< std::size_t > | compute_tie_groups (const std::vector< double > &sorted_values) |
| Compute tie group sizes from sorted data. | |
| template<typename Iterator > | |
| test_result | shapiro_wilk_test (Iterator first, Iterator last) |
| Perform Shapiro-Wilk test. | |
| template<typename Iterator > | |
| test_result | lilliefors_test (Iterator first, Iterator last) |
| Perform Lilliefors test for normality. | |
| template<typename Iterator > | |
| test_result | ks_test_normal (Iterator first, Iterator last) |
| Perform Kolmogorov-Smirnov test for normality (deprecated) | |
| test_result | levene_test (const std::vector< std::vector< double > > &groups) |
| Perform Levene test (homogeneity of variance test) | |
| test_result | bartlett_test (const std::vector< std::vector< double > > &groups) |
| Perform Bartlett test (homogeneity of variance test) | |
| template<typename Iterator > | |
| test_result | wilcoxon_signed_rank_test (Iterator first, Iterator last, double mu0=0.0, alternative_hypothesis alt=alternative_hypothesis::two_sided) |
| Perform Wilcoxon signed-rank test (one-sample) | |
| template<typename Iterator1 , typename Iterator2 > | |
| test_result | mann_whitney_u_test (Iterator1 first1, Iterator1 last1, Iterator2 first2, Iterator2 last2, alternative_hypothesis alt=alternative_hypothesis::two_sided, bool correct=true) |
| Perform Mann-Whitney U test (two-sample) | |
| test_result | kruskal_wallis_test (const std::vector< std::vector< double > > &groups) |
| Perform Kruskal-Wallis test (k-sample) | |
| test_result | fisher_exact_test (std::uint64_t a, std::uint64_t b, std::uint64_t c, std::uint64_t d, alternative_hypothesis alt=alternative_hypothesis::two_sided) |
| Perform Fisher's exact test (2x2 contingency table) | |
| bool | approx_equal (double a, double b, double rel_tol=default_rel_tol, double abs_tol=default_abs_tol) |
| Check if two floating-point numbers are approximately equal. | |
| bool | is_zero (double x, double tol=default_abs_tol) |
| Check if a value is close to zero. | |
| bool | is_finite (double x) |
| Check if a value is finite (not infinity or NaN) | |
| template<typename Iterator > | |
| bool | all_finite (Iterator first, Iterator last) |
| Check if all values in a range are finite. | |
| bool | has_converged_abs (double x_new, double x_old, double tol=1e-6) |
| Check for convergence based on absolute change. | |
| bool | has_converged_rel (double x_new, double x_old, double tol=1e-6) |
| Check for convergence based on relative change. | |
| bool | has_converged (double x_new, double x_old, double abs_tol=1e-8, double rel_tol=1e-6) |
| Check for convergence using combined absolute and relative criteria. | |
| double | log1p_safe (double x) |
| Safely compute log(1 + x) for small x. | |
| double | expm1_safe (double x) |
| Safely compute exp(x) - 1 for small x. | |
| double | clamp (double x, double min_val, double max_val) |
| Clamp a value to a range [min_val, max_val]. | |
| bool | in_range (double x, double min_val, double max_val) |
| Check if a value is in range [min_val, max_val]. | |
| double | relative_error (double x, double x_ref) |
| Compute the relative error between two values. | |
| double | safe_divide (double numerator, double denominator, double default_value=std::numeric_limits< double >::quiet_NaN()) |
| Safe division with check for division by zero. | |
| template<typename Iterator > | |
| double | kahan_sum (Iterator first, Iterator last) |
| Compute sum with Kahan summation algorithm. | |
| template<typename Iterator , typename Proj > | |
| double | kahan_sum (Iterator first, Iterator last, Proj proj) |
| Compute sum with Kahan summation algorithm (with projection) | |
| template<typename Iterator1 , typename Iterator2 > | |
| bool | approx_equal_range (Iterator1 first1, Iterator1 last1, Iterator2 first2, Iterator2 last2, double rel_tol=default_rel_tol, double abs_tol=default_abs_tol) |
| Check if two ranges are approximately equal element-wise. | |
| template<typename Iterator > | |
| double | interpolate_at (Iterator first, std::size_t n, double p) |
| Linear interpolation at position. | |
| template<typename Iterator , typename Projection > | |
| double | interpolate_at (Iterator first, std::size_t n, double p, Projection proj) |
| Linear interpolation at position with projection. | |
| template<typename Iterator > | |
| auto | minimum (Iterator first, Iterator last) |
| Return minimum value. | |
| template<typename Iterator , typename Projection > | |
| auto | minimum (Iterator first, Iterator last, Projection proj) |
| Return minimum value with projection. | |
| template<typename Iterator > | |
| auto | maximum (Iterator first, Iterator last) |
| Return maximum value. | |
| template<typename Iterator , typename Projection > | |
| auto | maximum (Iterator first, Iterator last, Projection proj) |
| Return maximum value with projection. | |
| template<typename Iterator > | |
| quartile_result | quartiles (Iterator first, Iterator last) |
| Return quartiles. | |
| template<typename Iterator , typename Projection > | |
| quartile_result | quartiles (Iterator first, Iterator last, Projection proj) |
| Return quartiles with projection. | |
| template<typename Iterator > | |
| double | percentile (Iterator first, Iterator last, double p) |
| Return percentile. | |
| template<typename Iterator , typename Projection > | |
| double | percentile (Iterator first, Iterator last, double p, Projection proj) |
| Return percentile with projection. | |
| template<typename Iterator > | |
| five_number_summary_result | five_number_summary (Iterator first, Iterator last) |
| Return five-number summary. | |
| template<typename Iterator , typename Projection > | |
| five_number_summary_result | five_number_summary (Iterator first, Iterator last, Projection proj) |
| Return five-number summary with projection. | |
| template<typename Iterator , typename WeightIterator > | |
| double | weighted_median (Iterator first, Iterator last, WeightIterator weight_first, WeightIterator weight_last) |
| Weighted median (safe overload) | |
| template<typename Iterator , typename WeightIterator > | |
| double | weighted_median (Iterator first, Iterator last, WeightIterator weight_first) |
| Weighted median. | |
| template<typename Iterator , typename WeightIterator , typename Projection > | |
| double | weighted_median (Iterator first, Iterator last, WeightIterator weight_first, WeightIterator weight_last, Projection proj) |
| Weighted median with projection (safe overload) | |
| template<typename Iterator , typename WeightIterator , typename Projection > | |
| double | weighted_median (Iterator first, Iterator last, WeightIterator weight_first, Projection proj) |
| Weighted median with projection. | |
| template<typename Iterator , typename WeightIterator > | |
| double | weighted_percentile (Iterator first, Iterator last, WeightIterator weight_first, WeightIterator weight_last, double p) |
| Weighted percentile (safe overload) | |
| template<typename Iterator , typename WeightIterator > | |
| double | weighted_percentile (Iterator first, Iterator last, WeightIterator weight_first, double p) |
| Weighted percentile. | |
| template<typename Iterator , typename WeightIterator , typename Projection > | |
| double | weighted_percentile (Iterator first, Iterator last, WeightIterator weight_first, WeightIterator weight_last, double p, Projection proj) |
| Weighted percentile with projection (safe overload) | |
| template<typename Iterator , typename WeightIterator , typename Projection > | |
| double | weighted_percentile (Iterator first, Iterator last, WeightIterator weight_first, double p, Projection proj) |
| Weighted percentile with projection. | |
| template<typename Iterator > | |
| test_result | z_test (Iterator first, Iterator last, double mu0, double sigma, alternative_hypothesis alt=alternative_hypothesis::two_sided) |
| One-sample z-test (known variance) | |
| test_result | z_test_proportion (std::size_t successes, std::size_t trials, double p0, alternative_hypothesis alt=alternative_hypothesis::two_sided) |
| One-sample proportion z-test. | |
| test_result | z_test_proportion_two_sample (std::size_t successes1, std::size_t trials1, std::size_t successes2, std::size_t trials2, alternative_hypothesis alt=alternative_hypothesis::two_sided) |
| Two-sample proportion z-test. | |
| template<typename Iterator > | |
| test_result | t_test (Iterator first, Iterator last, double mu0, alternative_hypothesis alt=alternative_hypothesis::two_sided) |
| One-sample t-test. | |
| template<typename Iterator1 , typename Iterator2 > | |
| test_result | t_test_two_sample (Iterator1 first1, Iterator1 last1, Iterator2 first2, Iterator2 last2, alternative_hypothesis alt=alternative_hypothesis::two_sided) |
| Two-sample t-test (independent samples, pooled variance) | |
| template<typename Iterator1 , typename Iterator2 > | |
| test_result | t_test_welch (Iterator1 first1, Iterator1 last1, Iterator2 first2, Iterator2 last2, alternative_hypothesis alt=alternative_hypothesis::two_sided) |
| Two-sample t-test (Welch's method) | |
| template<typename Iterator1 , typename Iterator2 > | |
| test_result | t_test_paired (Iterator1 first1, Iterator1 last1, Iterator2 first2, Iterator2 last2, alternative_hypothesis alt=alternative_hypothesis::two_sided) |
| Paired t-test. | |
| template<typename Iterator1 , typename Iterator2 > | |
| test_result | chisq_test_gof (Iterator1 observed_first, Iterator1 observed_last, Iterator2 expected_first, Iterator2 expected_last) |
| Chi-square goodness of fit test. | |
| template<typename Iterator > | |
| test_result | chisq_test_gof_uniform (Iterator observed_first, Iterator observed_last) |
| Chi-square goodness of fit test (uniform expected frequencies) | |
| test_result | chisq_test_independence (const std::vector< std::vector< double > > &contingency_table) |
| Chi-square test for independence. | |
| template<typename Iterator1 , typename Iterator2 > | |
| test_result | f_test (Iterator1 first1, Iterator1 last1, Iterator2 first2, Iterator2 last2, alternative_hypothesis alt=alternative_hypothesis::two_sided) |
| F-test (variance comparison) | |
| std::vector< double > | bonferroni_correction (const std::vector< double > &p_values) |
| Bonferroni correction. | |
| std::vector< double > | benjamini_hochberg_correction (const std::vector< double > &p_values) |
| Benjamini-Hochberg correction (FDR control) | |
| std::vector< double > | holm_correction (const std::vector< double > &p_values) |
| Holm correction (step-down Bonferroni method) | |
| double | power_t_test_one_sample (double effect_size, std::size_t n, double alpha=0.05, const std::string &alternative="two.sided") |
| Calculate power for one-sample t-test. | |
| std::size_t | sample_size_t_test_one_sample (double effect_size, double power=0.80, double alpha=0.05, const std::string &alternative="two.sided") |
| Calculate required sample size for one-sample t-test. | |
| double | power_t_test_two_sample (double effect_size, std::size_t n1, std::size_t n2, double alpha=0.05, const std::string &alternative="two.sided") |
| Calculate power for two-sample t-test. | |
| std::size_t | sample_size_t_test_two_sample (double effect_size, double power=0.80, double alpha=0.05, double ratio=1.0, const std::string &alternative="two.sided") |
| Calculate required sample size for two-sample t-test (per group) | |
| double | power_prop_test (double p1, double p2, std::size_t n, double alpha=0.05, const std::string &alternative="two.sided") |
| Calculate power for two-sample proportion test. | |
| std::size_t | sample_size_prop_test (double p1, double p2, double power=0.80, double alpha=0.05, const std::string &alternative="two.sided") |
| Calculate required sample size for two-sample proportion test. | |
| power_result | power_analysis_t_one_sample (double effect_size, std::size_t n, double alpha=0.05, const std::string &alternative="two.sided") |
| Power analysis for one-sample t-test (calculate power) | |
| power_result | power_analysis_t_one_sample_n (double effect_size, double power=0.80, double alpha=0.05, const std::string &alternative="two.sided") |
| Power analysis for one-sample t-test (calculate sample size) | |
| double | power_t_test_one_sample (double effect_size, std::size_t n, double alpha, alternative_hypothesis alt) |
| Calculate power for one-sample t-test (enum overload) | |
| std::size_t | sample_size_t_test_one_sample (double effect_size, double power, double alpha, alternative_hypothesis alt) |
| Calculate required sample size for one-sample t-test (enum overload) | |
| double | power_t_test_two_sample (double effect_size, std::size_t n1, std::size_t n2, double alpha, alternative_hypothesis alt) |
| Calculate power for two-sample t-test (enum overload) | |
| std::size_t | sample_size_t_test_two_sample (double effect_size, double power, double alpha, double ratio, alternative_hypothesis alt) |
| Calculate required sample size for two-sample t-test (enum overload) | |
| double | power_prop_test (double p1, double p2, std::size_t n, double alpha, alternative_hypothesis alt) |
| Calculate power for two-sample proportion test (enum overload) | |
| std::size_t | sample_size_prop_test (double p1, double p2, double power, double alpha, alternative_hypothesis alt) |
| Calculate required sample size for two-sample proportion test (enum overload) | |
| power_result | power_analysis_t_one_sample (double effect_size, std::size_t n, double alpha, alternative_hypothesis alt) |
| Power analysis for one-sample t-test (enum overload, returning struct) | |
| power_result | power_analysis_t_one_sample_n (double effect_size, double power, double alpha, alternative_hypothesis alt) |
| Power analysis for one-sample t-test, sample size (enum overload, returning struct) | |
| default_random_engine & | get_random_engine () |
| Singleton accessor for global random engine. | |
| void | set_seed (std::uint64_t seed) |
| Set the seed of the random engine. | |
| void | randomize_seed () |
| Randomly reset the random engine seed. | |
| template<typename Iterator , typename Engine = default_random_engine> | |
| std::vector< typename std::iterator_traits< Iterator >::value_type > | bootstrap_sample (Iterator first, Iterator last, Engine &engine) |
| Generate a single bootstrap sample. | |
| template<typename Iterator > | |
| std::vector< typename std::iterator_traits< Iterator >::value_type > | bootstrap_sample (Iterator first, Iterator last) |
| Generate a single bootstrap sample (using default random engine) | |
| template<typename Iterator , typename Statistic , typename Engine = default_random_engine> | |
| bootstrap_result | bootstrap (Iterator first, Iterator last, Statistic stat_func, std::size_t n_bootstrap=1000, double confidence=0.95, Engine &engine=get_random_engine()) |
| Perform general bootstrap estimation. | |
| template<typename Iterator , typename Engine = default_random_engine> | |
| bootstrap_result | bootstrap_mean (Iterator first, Iterator last, std::size_t n_bootstrap=1000, double confidence=0.95, Engine &engine=get_random_engine()) |
| Perform bootstrap estimation of the mean. | |
| template<typename Iterator , typename Engine = default_random_engine> | |
| bootstrap_result | bootstrap_median (Iterator first, Iterator last, std::size_t n_bootstrap=1000, double confidence=0.95, Engine &engine=get_random_engine()) |
| Perform bootstrap estimation of the median. | |
| template<typename Iterator , typename Engine = default_random_engine> | |
| bootstrap_result | bootstrap_stddev (Iterator first, Iterator last, std::size_t n_bootstrap=1000, double confidence=0.95, Engine &engine=get_random_engine()) |
| Perform bootstrap estimation of the standard deviation. | |
| template<typename Iterator , typename Statistic , typename Engine = default_random_engine> | |
| bootstrap_result | bootstrap_bca (Iterator first, Iterator last, Statistic stat_func, std::size_t n_bootstrap=1000, double confidence=0.95, Engine &engine=get_random_engine()) |
| Compute BCa (bias-corrected and accelerated) bootstrap confidence interval. | |
| template<typename Iterator1 , typename Iterator2 , typename Engine = default_random_engine> | |
| permutation_result | permutation_test_two_sample (Iterator1 first1, Iterator1 last1, Iterator2 first2, Iterator2 last2, std::size_t n_permutations=10000, Engine &engine=get_random_engine()) |
| Perform two-sample permutation test (test of difference in means) | |
| template<typename Iterator1 , typename Iterator2 , typename Engine = default_random_engine> | |
| permutation_result | permutation_test_paired (Iterator1 first1, Iterator1 last1, Iterator2 first2, Iterator2 last2, std::size_t n_permutations=10000, Engine &engine=get_random_engine()) |
| Perform paired permutation test. | |
| template<typename Iterator1 , typename Iterator2 , typename Engine = default_random_engine> | |
| permutation_result | permutation_test_correlation (Iterator1 first1, Iterator1 last1, Iterator2 first2, Iterator2 last2, std::size_t n_permutations=10000, Engine &engine=get_random_engine()) |
| Perform permutation test for correlation. | |
| template<typename Iterator > | |
| double | mad (Iterator first, Iterator last) |
| Median Absolute Deviation (MAD) | |
| template<typename Iterator > | |
| double | mad_scaled (Iterator first, Iterator last) |
| Scaled MAD for normal distribution. | |
| template<typename Iterator > | |
| outlier_detection_result | detect_outliers_iqr (Iterator first, Iterator last, double k=1.5) |
| Outlier detection using IQR method (Tukey's Fences) | |
| template<typename Iterator > | |
| outlier_detection_result | detect_outliers_zscore (Iterator first, Iterator last, double threshold=3.0) |
| Outlier detection using Z-score. | |
| template<typename Iterator > | |
| outlier_detection_result | detect_outliers_modified_zscore (Iterator first, Iterator last, double threshold=3.5) |
| Outlier detection using Modified Z-score. | |
| template<typename Iterator > | |
| std::vector< double > | winsorize (Iterator first, Iterator last, double limits=0.05) |
| Winsorization. | |
| std::vector< double > | cooks_distance (const std::vector< double > &residuals, const std::vector< double > &hat_values, double mse, std::size_t p) |
| Calculate Cook's Distance. | |
| std::vector< double > | dffits (const std::vector< double > &residuals, const std::vector< double > &hat_values, double mse) |
| Calculate DFFITS. | |
| template<typename Iterator > | |
| double | hodges_lehmann (Iterator first, Iterator last) |
| Hodges-Lehmann estimator. | |
| template<typename Iterator > | |
| double | biweight_midvariance (Iterator first, Iterator last, double c=9.0) |
| Biweight Midvariance. | |
| template<typename Iterator > | |
| double | population_skewness (Iterator first, Iterator last) |
| Calculate population skewness (Fisher's definition) | |
| template<typename Iterator > | |
| double | population_skewness (Iterator first, Iterator last, double precomputed_mean) |
| Calculate population skewness with precomputed mean. | |
| template<typename Iterator , typename Projection , typename = std::enable_if_t< std::is_invocable_v<Projection, typename std::iterator_traits<Iterator>::value_type>>> | |
| double | population_skewness (Iterator first, Iterator last, Projection proj) |
| Calculate population skewness with projection. | |
| template<typename Iterator , typename Projection > | |
| double | population_skewness (Iterator first, Iterator last, Projection proj, double precomputed_mean) |
| Calculate population skewness with projection and precomputed mean. | |
| template<typename Iterator > | |
| double | sample_skewness (Iterator first, Iterator last) |
| Calculate sample skewness (bias-corrected version) | |
| template<typename Iterator > | |
| double | sample_skewness (Iterator first, Iterator last, double precomputed_mean) |
| Calculate sample skewness with precomputed mean. | |
| template<typename Iterator , typename Projection , typename = std::enable_if_t< std::is_invocable_v<Projection, typename std::iterator_traits<Iterator>::value_type>>> | |
| double | sample_skewness (Iterator first, Iterator last, Projection proj) |
| Calculate sample skewness with projection. | |
| template<typename Iterator , typename Projection > | |
| double | sample_skewness (Iterator first, Iterator last, Projection proj, double precomputed_mean) |
| Calculate sample skewness with projection and precomputed mean. | |
| template<typename Iterator > | |
| double | skewness (Iterator first, Iterator last) |
| Calculate skewness (alias for sample_skewness) | |
| template<typename Iterator > | |
| double | skewness (Iterator first, Iterator last, double precomputed_mean) |
| Calculate skewness (precomputed mean version) | |
| template<typename Iterator , typename Projection , typename = std::enable_if_t< std::is_invocable_v<Projection, typename std::iterator_traits<Iterator>::value_type>>> | |
| double | skewness (Iterator first, Iterator last, Projection proj) |
| Calculate skewness (projection version) | |
| template<typename Iterator , typename Projection > | |
| double | skewness (Iterator first, Iterator last, Projection proj, double precomputed_mean) |
| Calculate skewness (projection version, precomputed mean) | |
| template<typename Iterator > | |
| double | population_kurtosis (Iterator first, Iterator last) |
| Calculate population kurtosis (Excess Kurtosis) | |
| template<typename Iterator > | |
| double | population_kurtosis (Iterator first, Iterator last, double precomputed_mean) |
| Calculate population kurtosis with precomputed mean. | |
| template<typename Iterator , typename Projection , typename = std::enable_if_t< std::is_invocable_v<Projection, typename std::iterator_traits<Iterator>::value_type>>> | |
| double | population_kurtosis (Iterator first, Iterator last, Projection proj) |
| Calculate population kurtosis with projection. | |
| template<typename Iterator , typename Projection > | |
| double | population_kurtosis (Iterator first, Iterator last, Projection proj, double precomputed_mean) |
| Calculate population kurtosis with projection and precomputed mean. | |
| template<typename Iterator > | |
| double | sample_kurtosis (Iterator first, Iterator last) |
| Calculate sample kurtosis (bias-corrected version) | |
| template<typename Iterator > | |
| double | sample_kurtosis (Iterator first, Iterator last, double precomputed_mean) |
| Calculate sample kurtosis with precomputed mean. | |
| template<typename Iterator , typename Projection , typename = std::enable_if_t< std::is_invocable_v<Projection, typename std::iterator_traits<Iterator>::value_type>>> | |
| double | sample_kurtosis (Iterator first, Iterator last, Projection proj) |
| Calculate sample kurtosis with projection. | |
| template<typename Iterator , typename Projection > | |
| double | sample_kurtosis (Iterator first, Iterator last, Projection proj, double precomputed_mean) |
| Calculate sample kurtosis with projection and precomputed mean. | |
| template<typename Iterator > | |
| double | kurtosis (Iterator first, Iterator last) |
| Calculate kurtosis (alias for sample_kurtosis) | |
| template<typename Iterator > | |
| double | kurtosis (Iterator first, Iterator last, double precomputed_mean) |
| Calculate kurtosis (precomputed mean version) | |
| template<typename Iterator , typename Projection , typename = std::enable_if_t< std::is_invocable_v<Projection, typename std::iterator_traits<Iterator>::value_type>>> | |
| double | kurtosis (Iterator first, Iterator last, Projection proj) |
| Calculate kurtosis (projection version) | |
| template<typename Iterator , typename Projection > | |
| double | kurtosis (Iterator first, Iterator last, Projection proj, double precomputed_mean) |
| Calculate kurtosis (projection version, precomputed mean) | |
| double | lgamma_impl (double x) |
| Internal log-gamma function implementation. | |
| double | lgamma (double x) |
| Log-gamma function. | |
| double | tgamma (double x) |
| Gamma function. | |
| double | beta (double a, double b) |
| Beta function. | |
| double | lbeta (double a, double b) |
| Log-beta function. | |
| double | betainc_impl (double a, double b, double x, int recursion_depth) |
| Internal regularized incomplete beta function. | |
| double | betainc (double a, double b, double x) |
| Regularized incomplete beta function. | |
| double | betaincinv (double a, double b, double p) |
| Inverse regularized incomplete beta function. | |
| double | erf (double x) |
| Error function. | |
| double | erfc (double x) |
| Complementary error function. | |
| double | norm_cdf (double x) |
| Standard normal CDF. | |
| double | norm_quantile (double p) |
| Standard normal quantile function. | |
| double | gammainc_lower (double a, double x) |
| Lower regularized incomplete gamma function. | |
| double | gammainc_upper (double a, double x) |
| Upper regularized incomplete gamma function. | |
| double | gammainc_lower_inv (double a, double p) |
| Inverse lower regularized incomplete gamma function. | |
| kaplan_meier_result | kaplan_meier (const std::vector< double > ×, const std::vector< bool > &events) |
| Estimate Kaplan-Meier survival curve. | |
| logrank_result | logrank_test (const std::vector< double > ×1, const std::vector< bool > &events1, const std::vector< double > ×2, const std::vector< bool > &events2) |
| Log-rank test (comparison of two survival curves) | |
| double | median_survival_time (const kaplan_meier_result &km) |
| Calculate median survival time. | |
| hazard_rate_result | nelson_aalen (const std::vector< double > ×, const std::vector< bool > &events) |
| Nelson-Aalen cumulative hazard estimation. | |
| template<typename Iterator > | |
| double | autocorrelation (Iterator first, Iterator last, std::size_t lag) |
| Calculate autocorrelation coefficient (lag k) | |
| template<typename Iterator > | |
| std::vector< double > | acf (Iterator first, Iterator last, std::size_t max_lag) |
| Calculate autocorrelation function (ACF) (from lag 0 to max_lag) | |
| template<typename Iterator > | |
| std::vector< double > | pacf (Iterator first, Iterator last, std::size_t max_lag) |
| Calculate partial autocorrelation function (PACF) (Durbin-Levinson algorithm) | |
| template<typename Iterator1 , typename Iterator2 > | |
| double | mae (Iterator1 first1, Iterator1 last1, Iterator2 first2) |
| Mean Absolute Error (MAE) | |
| template<typename Iterator1 , typename Iterator2 > | |
| double | mse (Iterator1 first1, Iterator1 last1, Iterator2 first2) |
| Mean Squared Error (MSE) | |
| template<typename Iterator1 , typename Iterator2 > | |
| double | rmse (Iterator1 first1, Iterator1 last1, Iterator2 first2) |
| Root Mean Squared Error (RMSE) | |
| template<typename Iterator1 , typename Iterator2 > | |
| double | mape (Iterator1 first1, Iterator1 last1, Iterator2 first2) |
| Mean Absolute Percentage Error (MAPE) | |
| template<typename Iterator > | |
| std::vector< double > | moving_average (Iterator first, Iterator last, std::size_t window) |
| Simple moving average. | |
| template<typename Iterator > | |
| std::vector< double > | exponential_moving_average (Iterator first, Iterator last, double alpha) |
| Exponential moving average. | |
| template<typename Iterator > | |
| std::vector< double > | diff (Iterator first, Iterator last, std::size_t order=1) |
| Difference series (first-order or d-th order differencing) | |
| template<typename Iterator > | |
| std::vector< double > | seasonal_diff (Iterator first, Iterator last, std::size_t period) |
| Seasonal differencing. | |
| template<typename Iterator > | |
| std::vector< double > | lag (Iterator first, Iterator last, std::size_t k) |
| Generate lag series. | |
Variables | |
| constexpr double | NA = std::numeric_limits<double>::quiet_NaN() |
| Constant representing NA (NaN) | |
| constexpr double | epsilon = std::numeric_limits<double>::epsilon() |
| Machine epsilon for double precision. | |
| constexpr double | default_rel_tol = 1e-9 |
| Default relative tolerance for floating-point comparisons. | |
| constexpr double | default_abs_tol = 1e-12 |
| Default absolute tolerance for floating-point comparisons. | |
| template<typename T > | |
| constexpr bool | is_random_engine_v = is_random_engine<T>::value |
| Variable template version of is_random_engine. | |
| constexpr double | pi = 3.14159265358979323846 |
| Pi constant. | |
| constexpr double | sqrt_2 = 1.41421356237309504880 |
| Square root of 2. | |
| constexpr double | sqrt_2_pi = 2.50662827463100050242 |
| Square root of 2*pi. | |
| constexpr double | log_sqrt_2_pi = 0.91893853320467274178 |
| Natural logarithm of sqrt(2*pi) | |
| using statcpp::default_random_engine = typedef std::mt19937_64 |
Default random engine type (Mersenne Twister 64-bit version)
Definition at line 21 of file random_engine.hpp.
|
strong |
Enumeration representing the type of alternative hypothesis.
Specifies the direction of the alternative hypothesis in statistical tests.
| Enumerator | |
|---|---|
| two_sided | Two-sided test. |
| less | One-sided test (less than) |
| greater | One-sided test (greater than) |
Definition at line 34 of file parametric_tests.hpp.
|
strong |
|
strong |
Enumeration for effect size magnitude.
| Enumerator | |
|---|---|
| negligible | Negligible. |
| small | Small. |
| medium | Medium. |
| large | Large. |
Definition at line 426 of file effect_size.hpp.
|
strong |
Link function types.
Specifies the link function to use in generalized linear models.
|
strong |
Linkage types.
| Enumerator | |
|---|---|
| single | Single linkage. |
| complete | Complete linkage. |
| average | Average linkage. |
| ward | Ward's method. |
Definition at line 273 of file clustering.hpp.
|
strong |
Missing mechanism types.
Enumeration for classifying the mechanism of missing data.
| Enumerator | |
|---|---|
| mcar | Missing Completely At Random. |
| mar | Missing At Random. |
| mnar | Missing Not At Random. |
| unknown | Cannot be determined. |
Definition at line 46 of file missing_data.hpp.
| std::vector< double > statcpp::acf | ( | Iterator | first, |
| Iterator | last, | ||
| std::size_t | max_lag | ||
| ) |
Calculate autocorrelation function (ACF) (from lag 0 to max_lag)
| Iterator | RandomAccessIterator type |
| first | Beginning iterator |
| last | End iterator |
| max_lag | Maximum lag |
| std::invalid_argument | If range is empty |
Definition at line 97 of file time_series.hpp.
| double statcpp::adjusted_r_squared | ( | IteratorY | y_first, |
| IteratorY | y_last, | ||
| IteratorPred | pred_first, | ||
| IteratorPred | pred_last, | ||
| std::size_t | num_predictors | ||
| ) |
Calculate adjusted coefficient of determination.
Coefficient of determination adjusted for overfitting due to number of predictors. Adjusted R^2 = 1 - (1 - R^2) * (n - 1) / (n - p - 1)
| IteratorY | Iterator type for observed values |
| IteratorPred | Iterator type for predicted values |
| y_first | Beginning iterator for observed values |
| y_last | Ending iterator for observed values |
| pred_first | Beginning iterator for predicted values |
| pred_last | Ending iterator for predicted values |
| num_predictors | Number of predictors (excluding intercept) |
| std::invalid_argument | If y and predictions have different lengths |
| std::invalid_argument | If number of observations is not greater than number of predictors + 1 |
Definition at line 1177 of file linear_regression.hpp.
|
inline |
Calculate AIC (Akaike Information Criterion)
Calculates the Akaike Information Criterion. Smaller values indicate better models.
| log_likelihood | Log-likelihood |
| k | Number of parameters |
Definition at line 41 of file model_selection.hpp.
|
inline |
Calculate AIC from multiple regression model.
Calculates log-likelihood from multiple regression result and computes AIC.
| model | Multiple regression result |
| n | Sample size |
Definition at line 76 of file model_selection.hpp.
|
inline |
Calculate AIC from simple regression model.
Calculates log-likelihood from simple regression result and computes AIC.
| model | Simple regression result |
| n | Sample size |
Definition at line 55 of file model_selection.hpp.
|
inline |
Calculate AICc (corrected AIC)
Calculates the corrected AIC for small samples. Used when sample size is small relative to number of parameters.
| log_likelihood | Log-likelihood |
| n | Sample size |
| k | Number of parameters |
| std::invalid_argument | If n <= k + 1 |
Definition at line 99 of file model_selection.hpp.
| bool statcpp::all_finite | ( | Iterator | first, |
| Iterator | last | ||
| ) |
Check if all values in a range are finite.
| Iterator | RandomAccessIterator type |
| first | Beginning of sequence |
| last | End of sequence |
Definition at line 102 of file numerical_utils.hpp.
|
inline |
Analyze missing patterns.
Analyzes missing patterns in a dataset, calculating missing rate per variable, overall missing rate, and types and frequencies of missing patterns.
| data | 2D data for analysis (rows: observations, columns: variables) |
| std::invalid_argument | If data is empty or row sizes are inconsistent |
Definition at line 92 of file missing_data.hpp.
|
inline |
Check if two floating-point numbers are approximately equal.
Uses both relative and absolute tolerance: |a - b| <= max(rel_tol * max(|a|, |b|), abs_tol)
| a | First value |
| b | Second value |
| rel_tol | Relative tolerance (default: 1e-9) |
| abs_tol | Absolute tolerance (default: 1e-12) |
Definition at line 43 of file numerical_utils.hpp.
| bool statcpp::approx_equal_range | ( | Iterator1 | first1, |
| Iterator1 | last1, | ||
| Iterator2 | first2, | ||
| Iterator2 | last2, | ||
| double | rel_tol = default_rel_tol, |
||
| double | abs_tol = default_abs_tol |
||
| ) |
Check if two ranges are approximately equal element-wise.
| Iterator1 | RandomAccessIterator type for first sequence |
| Iterator2 | RandomAccessIterator type for second sequence |
| first1 | Beginning of first sequence |
| last1 | End of first sequence |
| first2 | Beginning of second sequence |
| last2 | End of second sequence |
| rel_tol | Relative tolerance (default: 1e-9) |
| abs_tol | Absolute tolerance (default: 1e-12) |
Definition at line 314 of file numerical_utils.hpp.
| std::size_t statcpp::argmax | ( | Iterator | first, |
| Iterator | last | ||
| ) |
Returns the index of the maximum value.
Returns the index of the element with the maximum value in the range.
| Iterator | Iterator type |
| first | Begin iterator |
| last | End iterator |
| std::invalid_argument | If range is empty |
Definition at line 1149 of file basic_statistics.hpp.
| std::size_t statcpp::argmax | ( | Iterator | first, |
| Iterator | last, | ||
| Projection | proj | ||
| ) |
Returns the index of the maximum value (projection version)
Returns the index of the element whose projected value is maximum.
| Iterator | Iterator type |
| Projection | Projection function type |
| first | Begin iterator |
| last | End iterator |
| proj | Projection function |
| std::invalid_argument | If range is empty |
Definition at line 1174 of file basic_statistics.hpp.
| std::size_t statcpp::argmin | ( | Iterator | first, |
| Iterator | last | ||
| ) |
Returns the index of the minimum value.
Returns the index of the element with the minimum value in the range.
| Iterator | Iterator type |
| first | Begin iterator |
| last | End iterator |
| std::invalid_argument | If range is empty |
Definition at line 1097 of file basic_statistics.hpp.
| std::size_t statcpp::argmin | ( | Iterator | first, |
| Iterator | last, | ||
| Projection | proj | ||
| ) |
Returns the index of the minimum value (projection version)
Returns the index of the element whose projected value is minimum.
| Iterator | Iterator type |
| Projection | Projection function type |
| first | Begin iterator |
| last | End iterator |
| proj | Projection function |
| std::invalid_argument | If range is empty |
Definition at line 1122 of file basic_statistics.hpp.
| std::vector< std::size_t > statcpp::argsort | ( | const std::vector< T > & | data, |
| bool | ascending = true |
||
| ) |
Return indices in sorted order.
| T | Data type |
| data | Data vector |
| ascending | true for ascending, false for descending |
Definition at line 598 of file data_wrangling.hpp.
| double statcpp::autocorrelation | ( | Iterator | first, |
| Iterator | last, | ||
| std::size_t | lag | ||
| ) |
Calculate autocorrelation coefficient (lag k)
Calculates the autocorrelation coefficient at the specified lag for time series data.
The denominator always uses gamma(0) (variance of all data), so rho(0) = 1 and |rho(k)| <= 1 is guaranteed for all lags. This is the same method as R's acf() and Python statsmodels.
| Iterator | RandomAccessIterator type |
| first | Beginning iterator |
| last | End iterator |
| lag | Lag (time difference) |
| std::invalid_argument | If range is empty, lag is >= data length, or variance is zero |
Definition at line 45 of file time_series.hpp.
|
inline |
Perform Bartlett test (homogeneity of variance test)
Tests whether variances are equal across multiple groups. Based on likelihood ratio test assuming normal distribution. For data that may not follow normal distribution, Levene test is recommended.
| groups | Vector of vectors containing data for each group |
| std::invalid_argument | If there are fewer than 2 groups |
| std::invalid_argument | If any group has fewer than 2 elements |
| std::invalid_argument | If any group has zero or negative variance |
Definition at line 482 of file nonparametric_tests.hpp.
|
inline |
Benjamini-Hochberg correction (FDR control)
Corrects p-values for multiple testing using the Benjamini-Hochberg method. Performs step-up correction to control the false discovery rate (FDR).
| p_values | Vector of original p-values |
Definition at line 711 of file parametric_tests.hpp.
|
inline |
Bernoulli distribution cumulative distribution function (CDF)
| k | Upper bound |
| p | Probability of success |
| std::invalid_argument | If p is outside [0, 1] |
Definition at line 768 of file discrete_distributions.hpp.
|
inline |
Bernoulli distribution probability mass function (PMF)
P(X = k) = p^k * (1-p)^(1-k) for k ∈ {0, 1}
| k | Outcome (0 or 1) |
| p | Probability of success |
| std::invalid_argument | If p is outside [0, 1] |
Definition at line 746 of file discrete_distributions.hpp.
|
inline |
Bernoulli distribution quantile function.
| prob | Cumulative probability |
| p | Probability of success |
Definition at line 787 of file discrete_distributions.hpp.
|
inline |
Bernoulli distribution random number generation (using default engine)
| p | Probability of success |
Definition at line 824 of file discrete_distributions.hpp.
| std::uint64_t statcpp::bernoulli_rand | ( | double | p, |
| Engine & | engine | ||
| ) |
Bernoulli distribution random number generation.
| Engine | Random engine type |
| p | Probability of success |
| engine | Random engine |
| std::invalid_argument | If p is outside [0, 1] |
Definition at line 809 of file discrete_distributions.hpp.
|
inline |
Beta function.
Computes the beta function B(a, b) = Gamma(a) * Gamma(b) / Gamma(a + b).
| a | First parameter (must be positive) |
| b | Second parameter (must be positive) |
| std::domain_error | If a or b is non-positive |
Definition at line 148 of file special_functions.hpp.
|
inline |
Beta distribution cumulative distribution function (CDF)
F(x) = I_x(alpha, beta) (regularized incomplete beta function)
| x | Random variable value |
| alpha | Shape parameter alpha |
| beta_param | Shape parameter beta |
| std::invalid_argument | If alpha <= 0 or beta_param <= 0 |
Definition at line 493 of file continuous_distributions.hpp.
|
inline |
Beta distribution probability density function (PDF)
f(x) = x^(alpha-1) * (1-x)^(beta-1) / B(alpha, beta) for 0 < x < 1
| x | Random variable value |
| alpha | Shape parameter alpha |
| beta_param | Shape parameter beta |
| std::invalid_argument | If alpha <= 0 or beta_param <= 0 |
Definition at line 459 of file continuous_distributions.hpp.
|
inline |
Beta distribution quantile function.
| p | Probability (0 <= p <= 1) |
| alpha | Shape parameter alpha |
| beta_param | Shape parameter beta |
| std::invalid_argument | If alpha <= 0, beta_param <= 0, or p is outside [0, 1] |
Definition at line 516 of file continuous_distributions.hpp.
|
inline |
Beta distribution random number generation (using default engine)
| alpha | Shape parameter alpha |
| beta_param | Shape parameter beta |
Definition at line 574 of file continuous_distributions.hpp.
| double statcpp::beta_rand | ( | double | alpha, |
| double | beta_param, | ||
| Engine & | engine | ||
| ) |
Beta distribution random number generation (using gamma variates)
| Engine | Random engine type |
| alpha | Shape parameter alpha |
| beta_param | Shape parameter beta |
| engine | Random engine |
| std::invalid_argument | If alpha <= 0 or beta_param <= 0 |
Definition at line 544 of file continuous_distributions.hpp.
|
inline |
Regularized incomplete beta function.
Computes the regularized incomplete beta function I_x(a, b).
| a | First parameter (must be positive) |
| b | Second parameter (must be positive) |
| x | Upper limit of integration (must be in [0, 1]) |
| std::domain_error | If parameters are invalid |
Definition at line 264 of file special_functions.hpp.
|
inline |
Internal regularized incomplete beta function.
Computes the regularized incomplete beta function I_x(a, b) using continued fraction expansion.
| a | First parameter |
| b | Second parameter |
| x | Upper limit of integration (must be in [0, 1]) |
| recursion_depth | Recursion depth for tracking |
| std::runtime_error | If recursion depth is exceeded |
Definition at line 189 of file special_functions.hpp.
|
inline |
Inverse regularized incomplete beta function.
Computes x such that I_x(a, b) = p (quantile function).
| a | First parameter (must be positive) |
| b | Second parameter (must be positive) |
| p | Probability value (must be in [0, 1]) |
| std::domain_error | If parameters are invalid |
Definition at line 291 of file special_functions.hpp.
|
inline |
Calculate BIC (Bayesian Information Criterion)
Calculates the Bayesian Information Criterion (Schwarz criterion). Penalizes complex models more heavily than AIC.
| log_likelihood | Log-likelihood |
| n | Sample size |
| k | Number of parameters |
Definition at line 122 of file model_selection.hpp.
|
inline |
Calculate BIC from multiple regression model.
Calculates log-likelihood from multiple regression result and computes BIC.
| model | Multiple regression result |
| n | Sample size |
Definition at line 155 of file model_selection.hpp.
|
inline |
Calculate BIC from simple regression model.
Calculates log-likelihood from simple regression result and computes BIC.
| model | Simple regression result |
| n | Sample size |
Definition at line 136 of file model_selection.hpp.
|
inline |
Binning (equal frequency)
| data | Data vector |
| n_bins | Number of bins |
Definition at line 1058 of file data_wrangling.hpp.
|
inline |
Binning (equal width)
| data | Data vector |
| n_bins | Number of bins |
Definition at line 1021 of file data_wrangling.hpp.
|
inline |
Binomial distribution cumulative distribution function (CDF)
Calculates P(X <= k).
| k | Upper bound of number of successes |
| n | Number of trials |
| p | Probability of success in each trial |
| std::invalid_argument | If p is outside [0, 1] |
Definition at line 111 of file discrete_distributions.hpp.
|
inline |
Calculate binomial coefficient.
Calculates C(n, k) = n! / (k! * (n-k)!)
| n | Total number of elements |
| k | Number of elements to choose |
Definition at line 65 of file discrete_distributions.hpp.
|
inline |
Binomial distribution probability mass function (PMF)
P(X = k) = C(n, k) * p^k * (1-p)^(n-k)
| k | Number of successes |
| n | Number of trials |
| p | Probability of success in each trial |
| std::invalid_argument | If p is outside [0, 1] |
Definition at line 86 of file discrete_distributions.hpp.
|
inline |
Binomial distribution quantile function.
Returns the smallest k such that P(X <= k) >= prob.
| prob | Probability value |
| n | Number of trials |
| p | Probability of success in each trial |
| std::invalid_argument | If prob or p is in an invalid range |
Definition at line 134 of file discrete_distributions.hpp.
|
inline |
Binomial distribution random number generation (using default engine)
| n | Number of trials |
| p | Probability of success in each trial |
Definition at line 188 of file discrete_distributions.hpp.
| std::uint64_t statcpp::binomial_rand | ( | std::uint64_t | n, |
| double | p, | ||
| Engine & | engine | ||
| ) |
Binomial distribution random number generation.
| Engine | Random engine type |
| n | Number of trials |
| p | Probability of success in each trial |
| engine | Random engine |
| std::invalid_argument | If p is outside [0, 1] |
Definition at line 172 of file discrete_distributions.hpp.
| double statcpp::biweight_midvariance | ( | Iterator | first, |
| Iterator | last, | ||
| double | c = 9.0 |
||
| ) |
Biweight Midvariance.
Calculates the Biweight Midvariance, a robust variance estimator.
| Iterator | Iterator type |
| first | Beginning of range |
| last | End of range |
| c | Tuning constant (default: 9.0) |
| std::invalid_argument | If range has less than 2 elements |
Definition at line 517 of file robust.hpp.
|
inline |
Bonferroni correction.
Corrects p-values for multiple testing using the Bonferroni method. Each p-value is multiplied by the number of tests, capped at 1.
| p_values | Vector of original p-values |
Definition at line 690 of file parametric_tests.hpp.
|
inline |
Perform Bonferroni method for multiple comparisons.
Performs multiple comparisons among all pairs of groups with Bonferroni correction as a post-hoc test following one-way ANOVA.
| anova_result | Result from one-way ANOVA |
| alpha | Significance level (default: 0.05) |
| std::invalid_argument | If alpha is outside the range (0, 1) |
| bootstrap_result statcpp::bootstrap | ( | Iterator | first, |
| Iterator | last, | ||
| Statistic | stat_func, | ||
| std::size_t | n_bootstrap = 1000, |
||
| double | confidence = 0.95, |
||
| Engine & | engine = get_random_engine() |
||
| ) |
Perform general bootstrap estimation.
Applies the bootstrap method to any statistical function and computes the estimated statistic, standard error, percentile confidence interval, and bias.
Percentile confidence interval calculation:
| Iterator | Input iterator type |
| Statistic | Statistical function type (function taking iterator pair and returning double) |
| Engine | Random engine type (default: default_random_engine) |
| first | Beginning iterator of input range |
| last | End iterator of input range |
| stat_func | Function object that computes the statistic |
| n_bootstrap | Number of bootstrap iterations (default: 1000) |
| confidence | Confidence level (default: 0.95) |
| engine | Reference to random engine |
| std::invalid_argument | If confidence is outside (0, 1) |
| std::invalid_argument | If number of input elements is less than 2 |
Definition at line 139 of file resampling.hpp.
| bootstrap_result statcpp::bootstrap_bca | ( | Iterator | first, |
| Iterator | last, | ||
| Statistic | stat_func, | ||
| std::size_t | n_bootstrap = 1000, |
||
| double | confidence = 0.95, |
||
| Engine & | engine = get_random_engine() |
||
| ) |
Compute BCa (bias-corrected and accelerated) bootstrap confidence interval.
Implements the BCa method which provides more accurate confidence intervals than the standard percentile method. Uses jackknife to estimate the acceleration factor and applies bias correction.
| Iterator | Input iterator type |
| Statistic | Statistical function type (function taking iterator pair and returning double) |
| Engine | Random engine type (default: default_random_engine) |
| first | Beginning iterator of input range |
| last | End iterator of input range |
| stat_func | Function object that computes the statistic |
| n_bootstrap | Number of bootstrap iterations (default: 1000) |
| confidence | Confidence level (default: 0.95) |
| engine | Reference to random engine |
| std::invalid_argument | If confidence is outside (0, 1) |
| std::invalid_argument | If number of input elements is less than 3 |
Definition at line 310 of file resampling.hpp.
| bootstrap_result statcpp::bootstrap_mean | ( | Iterator | first, |
| Iterator | last, | ||
| std::size_t | n_bootstrap = 1000, |
||
| double | confidence = 0.95, |
||
| Engine & | engine = get_random_engine() |
||
| ) |
Perform bootstrap estimation of the mean.
Applies the bootstrap method to the sample mean and computes standard error and confidence interval.
| Iterator | Input iterator type |
| Engine | Random engine type (default: default_random_engine) |
| first | Beginning iterator of input range |
| last | End iterator of input range |
| n_bootstrap | Number of bootstrap iterations (default: 1000) |
| confidence | Confidence level (default: 0.95) |
| engine | Reference to random engine |
| std::invalid_argument | If confidence is outside (0, 1) |
| std::invalid_argument | If number of input elements is less than 2 |
Definition at line 221 of file resampling.hpp.
| bootstrap_result statcpp::bootstrap_median | ( | Iterator | first, |
| Iterator | last, | ||
| std::size_t | n_bootstrap = 1000, |
||
| double | confidence = 0.95, |
||
| Engine & | engine = get_random_engine() |
||
| ) |
Perform bootstrap estimation of the median.
Applies the bootstrap method to the sample median and computes standard error and confidence interval.
| Iterator | Input iterator type |
| Engine | Random engine type (default: default_random_engine) |
| first | Beginning iterator of input range |
| last | End iterator of input range |
| n_bootstrap | Number of bootstrap iterations (default: 1000) |
| confidence | Confidence level (default: 0.95) |
| engine | Reference to random engine |
| std::invalid_argument | If confidence is outside (0, 1) |
| std::invalid_argument | If number of input elements is less than 2 |
Definition at line 247 of file resampling.hpp.
| std::vector< typename std::iterator_traits< Iterator >::value_type > statcpp::bootstrap_sample | ( | Iterator | first, |
| Iterator | last | ||
| ) |
Generate a single bootstrap sample (using default random engine)
Generates a bootstrap sample using the global default random engine.
| Iterator | Input iterator type |
| first | Beginning iterator of input range |
| last | End iterator of input range |
| std::invalid_argument | If input range is empty |
Definition at line 102 of file resampling.hpp.
| std::vector< typename std::iterator_traits< Iterator >::value_type > statcpp::bootstrap_sample | ( | Iterator | first, |
| Iterator | last, | ||
| Engine & | engine | ||
| ) |
Generate a single bootstrap sample.
Generates a bootstrap sample of the same size as the original sample by sampling with replacement from the given data.
| Iterator | Input iterator type |
| Engine | Random engine type (default: default_random_engine) |
| first | Beginning iterator of input range |
| last | End iterator of input range |
| engine | Reference to random engine |
| std::invalid_argument | If input range is empty |
Definition at line 69 of file resampling.hpp.
| bootstrap_result statcpp::bootstrap_stddev | ( | Iterator | first, |
| Iterator | last, | ||
| std::size_t | n_bootstrap = 1000, |
||
| double | confidence = 0.95, |
||
| Engine & | engine = get_random_engine() |
||
| ) |
Perform bootstrap estimation of the standard deviation.
Applies the bootstrap method to the sample standard deviation and computes standard error and confidence interval.
| Iterator | Input iterator type |
| Engine | Random engine type (default: default_random_engine) |
| first | Beginning iterator of input range |
| last | End iterator of input range |
| n_bootstrap | Number of bootstrap iterations (default: 1000) |
| confidence | Confidence level (default: 0.95) |
| engine | Reference to random engine |
| std::invalid_argument | If confidence is outside (0, 1) |
| std::invalid_argument | If number of input elements is less than 2 |
Definition at line 277 of file resampling.hpp.
|
inline |
Box-Cox transformation.
When lambda = 0, performs logarithmic transformation
| data | Data vector |
| lambda | Transformation parameter |
Definition at line 390 of file data_wrangling.hpp.
| double statcpp::chebyshev_distance | ( | Iterator1 | first1, |
| Iterator1 | last1, | ||
| Iterator2 | first2, | ||
| Iterator2 | last2 | ||
| ) |
Chebyshev distance (L∞ norm, maximum metric)
Computes the maximum absolute difference: d(x, y) = max(|x_i - y_i|)
| Iterator1 | RandomAccessIterator type for first sequence |
| Iterator2 | RandomAccessIterator type for second sequence |
| first1 | Beginning of first sequence |
| last1 | End of first sequence |
| first2 | Beginning of second sequence |
| last2 | End of second sequence |
| std::invalid_argument | if sequences have different lengths |
Definition at line 487 of file distance_metrics.hpp.
| double statcpp::chebyshev_distance | ( | Iterator1 | first1, |
| Iterator1 | last1, | ||
| Iterator2 | first2, | ||
| Iterator2 | last2, | ||
| Proj1 | proj1, | ||
| Proj2 | proj2 | ||
| ) |
Chebyshev distance with projection.
Definition at line 520 of file distance_metrics.hpp.
|
inline |
Chi-square distribution cumulative distribution function (CDF)
Chi-square distribution is a special case of gamma distribution: chi^2(df) = Gamma(df/2, 1/2) This implementation uses the regularized incomplete gamma function: F(x; df) = gamma(df/2, x/2) / Gamma(df/2) = P(df/2, x/2)
| x | Random variable value |
| df | Degrees of freedom |
| std::invalid_argument | If df <= 0 |
Definition at line 613 of file continuous_distributions.hpp.
|
inline |
Chi-square distribution probability density function (PDF)
Special case of gamma distribution (shape = df/2, rate = 1/2)
| x | Random variable value |
| df | Degrees of freedom |
| std::invalid_argument | If df <= 0 |
Definition at line 593 of file continuous_distributions.hpp.
|
inline |
Chi-square distribution quantile function.
| p | Probability (0 <= p <= 1) |
| df | Degrees of freedom |
| std::invalid_argument | If df <= 0 or p is outside [0, 1] |
Definition at line 629 of file continuous_distributions.hpp.
|
inline |
Chi-square distribution random number generation (using default engine)
| df | Degrees of freedom |
Definition at line 661 of file continuous_distributions.hpp.
| double statcpp::chisq_rand | ( | double | df, |
| Engine & | engine | ||
| ) |
Chi-square distribution random number generation.
| Engine | Random engine type |
| df | Degrees of freedom |
| engine | Random engine |
| std::invalid_argument | If df <= 0 |
Definition at line 647 of file continuous_distributions.hpp.
| test_result statcpp::chisq_test_gof | ( | Iterator1 | observed_first, |
| Iterator1 | observed_last, | ||
| Iterator2 | expected_first, | ||
| Iterator2 | expected_last | ||
| ) |
Chi-square goodness of fit test.
Tests whether observed frequencies match expected frequencies.
| Iterator1 | Input iterator type for observed frequencies |
| Iterator2 | Input iterator type for expected frequencies |
| observed_first | Beginning iterator of observed frequencies |
| observed_last | End iterator of observed frequencies |
| expected_first | Beginning iterator of expected frequencies |
| expected_last | End iterator of expected frequencies |
| std::invalid_argument | If observed and expected lengths differ, fewer than 2 categories, or expected frequency is non-positive |
Definition at line 464 of file parametric_tests.hpp.
| test_result statcpp::chisq_test_gof_uniform | ( | Iterator | observed_first, |
| Iterator | observed_last | ||
| ) |
Chi-square goodness of fit test (uniform expected frequencies)
Tests whether observed frequencies follow a uniform distribution.
| Iterator | Input iterator type for observed frequencies |
| observed_first | Beginning iterator of observed frequencies |
| observed_last | End iterator of observed frequencies |
| std::invalid_argument | If fewer than 2 categories |
Definition at line 513 of file parametric_tests.hpp.
|
inline |
Chi-square test for independence.
Tests independence of two variables based on a contingency table.
| contingency_table | Contingency table (2D array in row-major order) |
| std::invalid_argument | If rows or columns are less than 2, column counts are inconsistent, negative values exist, or table is empty |
Definition at line 556 of file parametric_tests.hpp.
| confidence_interval statcpp::ci_mean | ( | Iterator | first, |
| Iterator | last, | ||
| double | confidence, | ||
| Projection | proj | ||
| ) |
Calculate confidence interval for mean (projection version)
| Iterator | Iterator type |
| Projection | Projection function type |
| first | Beginning iterator of data range |
| last | Ending iterator of data range |
| confidence | Confidence level |
| proj | Projection function |
| std::invalid_argument | If confidence level is outside (0, 1) or there are fewer than 2 elements |
Definition at line 155 of file estimation.hpp.
| confidence_interval statcpp::ci_mean | ( | Iterator | first, |
| Iterator | last, | ||
| double | confidence = 0.95 |
||
| ) |
Calculate confidence interval for mean (t-distribution based)
| Iterator | Iterator type |
| first | Beginning iterator of data range |
| last | Ending iterator of data range |
| confidence | Confidence level (default: 0.95) |
| std::invalid_argument | If confidence level is outside (0, 1) or there are fewer than 2 elements |
Definition at line 119 of file estimation.hpp.
| 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)
Calculates the confidence interval for the difference of two-sample means assuming equal variances.
| Iterator1 | First iterator type |
| Iterator2 | Second iterator type |
| first1 | Beginning iterator of first data range |
| last1 | Ending iterator of first data range |
| first2 | Beginning iterator of second data range |
| last2 | Ending iterator of second data range |
| confidence | Confidence level (default: 0.95) |
| std::invalid_argument | If confidence level is outside (0, 1) or either sample has fewer than 2 elements |
Definition at line 354 of file estimation.hpp.
| 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)
| Iterator1 | First iterator type |
| Iterator2 | Second iterator type |
| first1 | Beginning iterator of first data range |
| last1 | Ending iterator of first data range |
| first2 | Beginning iterator of second data range |
| last2 | Ending iterator of second data range |
| confidence | Confidence level (default: 0.95) |
| std::invalid_argument | If confidence level is outside (0, 1) or either sample has fewer than 2 elements |
Definition at line 669 of file estimation.hpp.
| 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)
Calculates the confidence interval for the difference of two-sample means without assuming equal variances (Welch-Satterthwaite method).
| Iterator1 | First iterator type |
| Iterator2 | Second iterator type |
| first1 | Beginning iterator of first data range |
| last1 | Ending iterator of first data range |
| first2 | Beginning iterator of second data range |
| last2 | Ending iterator of second data range |
| confidence | Confidence level (default: 0.95) |
| std::invalid_argument | If confidence level is outside (0, 1), either sample has fewer than 2 elements, or both variances are zero |
Definition at line 405 of file estimation.hpp.
| 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)
| Iterator | Iterator type |
| first | Beginning iterator of data range |
| last | Ending iterator of data range |
| sigma | Known population standard deviation |
| confidence | Confidence level (default: 0.95) |
| std::invalid_argument | If confidence level is outside (0, 1), sigma is not positive, or the range is empty |
Definition at line 194 of file estimation.hpp.
|
inline |
Calculate confidence interval for proportion (Wald method)
| successes | Number of successes |
| trials | Number of trials |
| confidence | Confidence level (default: 0.95) |
| std::invalid_argument | If confidence level is outside (0, 1), trials is 0, or successes exceeds trials |
Definition at line 232 of file estimation.hpp.
|
inline |
Calculate confidence interval for two-sample proportion difference.
| successes1 | Number of successes in first sample |
| n1 | First sample size |
| successes2 | Number of successes in second sample |
| n2 | Second sample size |
| confidence | Confidence level (default: 0.95) |
| std::invalid_argument | If parameters are outside valid range |
Definition at line 692 of file estimation.hpp.
|
inline |
Calculate confidence interval for proportion (Wilson method, recommended)
The Wilson method has better properties than the Wald method, especially for small samples or extreme proportions.
| successes | Number of successes |
| trials | Number of trials |
| confidence | Confidence level (default: 0.95) |
| std::invalid_argument | If confidence level is outside (0, 1), trials is 0, or successes exceeds trials |
Definition at line 269 of file estimation.hpp.
| confidence_interval statcpp::ci_variance | ( | Iterator | first, |
| Iterator | last, | ||
| double | confidence = 0.95 |
||
| ) |
Calculate confidence interval for variance (chi-square distribution based)
| Iterator | Iterator type |
| first | Beginning iterator of data range |
| last | Ending iterator of data range |
| confidence | Confidence level (default: 0.95) |
| std::invalid_argument | If confidence level is outside (0, 1) or there are fewer than 2 elements |
Definition at line 310 of file estimation.hpp.
|
inline |
Clamp a value to a range [min_val, max_val].
| x | Value to clamp |
| min_val | Minimum value |
| max_val | Maximum value |
| std::invalid_argument | if min_val > max_val |
Definition at line 199 of file numerical_utils.hpp.
| double statcpp::coefficient_of_variation | ( | Iterator | first, |
| Iterator | last | ||
| ) |
Coefficient of variation.
Computes the standard deviation divided by the mean (returned as a ratio; multiply by 100 for percentage). Useful for measuring relative variability of data.
| Iterator | Iterator type |
| first | Begin iterator |
| last | End iterator |
| std::invalid_argument | If range is empty, has fewer than 2 elements, or mean is zero |
Definition at line 832 of file dispersion_spread.hpp.
| double statcpp::coefficient_of_variation | ( | Iterator | first, |
| Iterator | last, | ||
| double | precomputed_mean | ||
| ) |
Coefficient of variation using precomputed mean.
Computes coefficient of variation when the mean has been precomputed.
| Iterator | Iterator type |
| first | Begin iterator |
| last | End iterator |
| precomputed_mean | Precomputed mean value |
| std::invalid_argument | If range is empty, has fewer than 2 elements, or mean is zero |
Definition at line 861 of file dispersion_spread.hpp.
| double statcpp::coefficient_of_variation | ( | Iterator | first, |
| Iterator | last, | ||
| Projection | proj | ||
| ) |
Coefficient of variation of projected values using a lambda expression.
Computes the coefficient of variation of results after applying a projection function to each element.
| Iterator | Iterator type |
| Projection | Projection function type |
| first | Begin iterator |
| last | End iterator |
| proj | Projection function |
| std::invalid_argument | If range is empty, has fewer than 2 elements, or mean is zero |
Definition at line 893 of file dispersion_spread.hpp.
| double statcpp::coefficient_of_variation | ( | Iterator | first, |
| Iterator | last, | ||
| Projection | proj, | ||
| double | precomputed_mean | ||
| ) |
Coefficient of variation of projected values using precomputed mean.
Computes coefficient of variation using a projection function and precomputed mean.
| Iterator | Iterator type |
| Projection | Projection function type |
| first | Begin iterator |
| last | End iterator |
| proj | Projection function |
| precomputed_mean | Precomputed mean value |
| std::invalid_argument | If range is empty, has fewer than 2 elements, or mean is zero |
Definition at line 924 of file dispersion_spread.hpp.
| double statcpp::cohens_d | ( | Iterator | first, |
| Iterator | last, | ||
| double | mu0 | ||
| ) |
Cohen's d (one-sample, using sample standard deviation)
Calculates the standardized mean difference using the sample standard deviation.
| Iterator | RandomAccessIterator type |
| first | Beginning iterator |
| last | Ending iterator |
| mu0 | Population mean to compare against |
| std::invalid_argument | If there are fewer than 2 elements or variance is zero |
Definition at line 63 of file effect_size.hpp.
| double statcpp::cohens_d | ( | Iterator | first, |
| Iterator | last, | ||
| double | mu0, | ||
| double | sigma | ||
| ) |
Cohen's d (one-sample, known population standard deviation)
Calculates the standardized mean difference. Used when the population standard deviation is known.
| Iterator | RandomAccessIterator type |
| first | Beginning iterator |
| last | Ending iterator |
| mu0 | Population mean to compare against |
| sigma | Population standard deviation |
| std::invalid_argument | If the range is empty or sigma is not positive |
Definition at line 35 of file effect_size.hpp.
| double statcpp::cohens_d_two_sample | ( | Iterator1 | first1, |
| Iterator1 | last1, | ||
| Iterator2 | first2, | ||
| Iterator2 | last2 | ||
| ) |
Cohen's d (two-sample, pooled standard deviation)
Calculates the standardized mean difference between two groups. Uses pooled standard deviation.
| Iterator1 | RandomAccessIterator type for first sample |
| Iterator2 | RandomAccessIterator type for second sample |
| first1 | Beginning iterator of first sample |
| last1 | Ending iterator of first sample |
| first2 | Beginning iterator of second sample |
| last2 | Ending iterator of second sample |
| std::invalid_argument | If either sample has fewer than 2 elements or pooled variance is zero |
Definition at line 96 of file effect_size.hpp.
|
inline |
Calculate Cohen's f for one-way ANOVA.
Standardized effect size measure where 0.10 indicates small, 0.25 indicates medium, and 0.40 indicates large effect.
| result | Result from one-way ANOVA |
|
inline |
Cohen's h (effect size for difference between two proportions)
Calculates the effect size representing the difference between two proportions.
| p1 | Proportion in first group |
| p2 | Proportion in second group |
| std::invalid_argument | If proportions are outside [0, 1] range |
Definition at line 355 of file effect_size.hpp.
|
inline |
Calculate GLM residuals.
Calculates various types of residuals from a fitted GLM model.
| model | Fitted GLM model |
| X | Predictor matrix |
| y | Response variable vector |
| std::invalid_argument | If X and Y sizes don't match |
| std::vector< double > statcpp::compute_ranks_with_ties | ( | Iterator | first, |
| Iterator | last | ||
| ) |
Compute ranks with tie handling.
Assigns ranks to input data. Elements with the same value are assigned average ranks.
| Iterator | Input iterator type |
| first | Beginning iterator of range |
| last | Ending iterator of range |
Definition at line 56 of file nonparametric_tests.hpp.
|
inline |
Perform residual diagnostics for multiple regression model.
Calculates residuals, standardized residuals, studentized residuals, leverage values, Cook's distance, and Durbin-Watson statistic.
| model | Multiple regression analysis results |
| X | Predictor matrix |
| y | Response variable vector |
| std::invalid_argument | If X and y have different lengths |
Definition at line 879 of file linear_regression.hpp.
| residual_diagnostics statcpp::compute_residual_diagnostics | ( | const simple_regression_result & | model, |
| IteratorX | x_first, | ||
| IteratorX | x_last, | ||
| IteratorY | y_first, | ||
| IteratorY | y_last | ||
| ) |
Perform residual diagnostics for simple regression model.
Calculates residuals, standardized residuals, studentized residuals, leverage values, Cook's distance, and Durbin-Watson statistic.
| IteratorX | Iterator type for predictor variable |
| IteratorY | Iterator type for response variable |
| model | Simple regression analysis results |
| x_first | Beginning iterator for predictor variable |
| x_last | Ending iterator for predictor variable |
| y_first | Beginning iterator for response variable |
| y_last | Ending iterator for response variable |
| std::invalid_argument | If x and y have different lengths |
Definition at line 798 of file linear_regression.hpp.
|
inline |
Compute tie group sizes from sorted data.
Returns a vector of tie group sizes t_j, where each t_j > 1 represents a group of tied values. Used for tie corrections in nonparametric tests.
| sorted_values | Sorted vector of values |
Definition at line 101 of file nonparametric_tests.hpp.
|
inline |
Calculate VIF (Variance Inflation Factor) for each predictor.
VIF is an indicator of multicollinearity, showing the degree to which each predictor is explained by other predictors. Generally VIF > 10 suggests a multicollinearity problem.
| X | Predictor matrix (n x p) |
| std::invalid_argument | If there are fewer than 3 observations |
| std::invalid_argument | If there are fewer than 2 predictors |
Definition at line 976 of file linear_regression.hpp.
| prediction_interval statcpp::confidence_interval_mean | ( | const simple_regression_result & | model, |
| IteratorX | x_first, | ||
| IteratorX | x_last, | ||
| double | x_new, | ||
| double | confidence = 0.95 |
||
| ) |
Calculate confidence interval for mean of simple regression model.
Calculates the confidence interval for the mean response at a specific x value. The confidence interval shows the probability that the true regression line is within this interval.
| IteratorX | Iterator type for predictor variable |
| model | Simple regression analysis results |
| x_first | Beginning iterator for original predictor variable data |
| x_last | Ending iterator for original predictor variable data |
| x_new | x value of the point to predict |
| confidence | Confidence level (default: 0.95) |
| std::invalid_argument | If confidence is outside (0, 1) range |
Definition at line 744 of file linear_regression.hpp.
|
inline |
Create a contingency table.
Creates a contingency table (cross-tabulation) from two categorical variables.
| row_data | Row category values (integers starting from 0) |
| col_data | Column category values (integers starting from 0) |
| std::invalid_argument | If data lengths do not match or if data is empty |
Definition at line 42 of file categorical.hpp.
|
inline |
Calculate Cook's Distance.
Calculates Cook's Distance to detect influential observations in linear regression.
| residuals | Residuals |
| hat_values | Leverage values (hat values) |
| mse | Mean squared error |
| p | Number of parameters (including intercept) |
| std::invalid_argument | If parameters are invalid |
Definition at line 363 of file robust.hpp.
|
inline |
Calculate Pearson correlation matrix.
Calculates the correlation matrix for multivariate data. Standardizes the covariance matrix to obtain correlation coefficients.
| data | Matrix data (rows=observations, columns=variables) |
| std::invalid_argument | If data is empty, rows have different column counts, there are fewer than 2 observations, or any variable has zero variance |
Definition at line 89 of file multivariate.hpp.
|
inline |
Calculate determinant of correlation matrix.
Used for multicollinearity diagnostics. det(R) close to 0 indicates strong multicollinearity, det(R) = 1 indicates no correlation between variables.
| X | Predictor matrix (n x p) |
| std::invalid_argument | If there are fewer than 2 observations |
| std::invalid_argument | If there are fewer than 2 or more than 3 predictors (only 2 or 3 supported) |
Definition at line 1035 of file linear_regression.hpp.
|
inline |
Correlation matrix using available case analysis (pairwise deletion)
Calculates correlation coefficients using only cases where both variables are observed for each pair of variables. Also called pairwise deletion.
| data | Input data (rows: observations, columns: variables) |
Definition at line 1100 of file missing_data.hpp.
| double statcpp::cosine_distance | ( | Iterator1 | first1, |
| Iterator1 | last1, | ||
| Iterator2 | first2, | ||
| Iterator2 | last2 | ||
| ) |
Cosine distance.
Defined as: distance = 1 - similarity Returns a value in [0, 2], where 0 means identical direction
| Iterator1 | RandomAccessIterator type for first sequence |
| Iterator2 | RandomAccessIterator type for second sequence |
| first1 | Beginning of first sequence |
| last1 | End of first sequence |
| first2 | Beginning of second sequence |
| last2 | End of second sequence |
Definition at line 288 of file distance_metrics.hpp.
| double statcpp::cosine_distance | ( | Iterator1 | first1, |
| Iterator1 | last1, | ||
| Iterator2 | first2, | ||
| Iterator2 | last2, | ||
| Proj1 | proj1, | ||
| Proj2 | proj2 | ||
| ) |
Cosine distance with projection.
Definition at line 298 of file distance_metrics.hpp.
| double statcpp::cosine_similarity | ( | Iterator1 | first1, |
| Iterator1 | last1, | ||
| Iterator2 | first2, | ||
| Iterator2 | last2 | ||
| ) |
Cosine similarity.
Computes the cosine of the angle between two vectors: similarity(x, y) = (x · y) / (||x|| * ||y||)
Returns a value in [-1, 1]:
| Iterator1 | RandomAccessIterator type for first sequence |
| Iterator2 | RandomAccessIterator type for second sequence |
| first1 | Beginning of first sequence |
| last1 | End of first sequence |
| first2 | Beginning of second sequence |
| last2 | End of second sequence |
| std::invalid_argument | if sequences have different lengths or if either vector has zero norm |
Definition at line 190 of file distance_metrics.hpp.
| double statcpp::cosine_similarity | ( | Iterator1 | first1, |
| Iterator1 | last1, | ||
| Iterator2 | first2, | ||
| Iterator2 | last2, | ||
| Proj1 | proj1, | ||
| Proj2 | proj2 | ||
| ) |
Cosine similarity with projection.
Definition at line 233 of file distance_metrics.hpp.
| std::size_t statcpp::count | ( | Iterator | first, |
| Iterator | last | ||
| ) |
Data count.
Returns the number of elements in the range.
| Iterator | Iterator type |
| first | Begin iterator |
| last | End iterator |
Definition at line 91 of file basic_statistics.hpp.
| double statcpp::covariance | ( | Iterator1 | first1, |
| Iterator1 | last1, | ||
| Iterator2 | first2, | ||
| Iterator2 | last2 | ||
| ) |
Covariance (alias for sample_covariance)
| Iterator1 | Iterator type for the first data |
| Iterator2 | Iterator type for the second data |
| first1 | Begin iterator for the first data |
| last1 | End iterator for the first data |
| first2 | Begin iterator for the second data |
| last2 | End iterator for the second data |
Definition at line 303 of file correlation_covariance.hpp.
| double statcpp::covariance | ( | Iterator1 | first1, |
| Iterator1 | last1, | ||
| Iterator2 | first2, | ||
| Iterator2 | last2, | ||
| double | mean_x, | ||
| double | mean_y | ||
| ) |
Covariance with precomputed means (alias for sample_covariance)
| Iterator1 | Iterator type for the first data |
| Iterator2 | Iterator type for the second data |
| first1 | Begin iterator for the first data |
| last1 | End iterator for the first data |
| first2 | Begin iterator for the second data |
| last2 | End iterator for the second data |
| mean_x | Mean of the first data |
| mean_y | Mean of the second data |
Definition at line 323 of file correlation_covariance.hpp.
| double statcpp::covariance | ( | Iterator1 | first1, |
| Iterator1 | last1, | ||
| Iterator2 | first2, | ||
| Iterator2 | last2, | ||
| Projection1 | proj1, | ||
| Projection2 | proj2 | ||
| ) |
Covariance (projection version, alias for sample_covariance)
| Iterator1 | Iterator type for the first data |
| Iterator2 | Iterator type for the second data |
| Projection1 | Projection function type for the first data |
| Projection2 | Projection function type for the second data |
| first1 | Begin iterator for the first data |
| last1 | End iterator for the first data |
| first2 | Begin iterator for the second data |
| last2 | End iterator for the second data |
| proj1 | Projection function for the first data |
| proj2 | Projection function for the second data |
Definition at line 346 of file correlation_covariance.hpp.
|
inline |
Calculate sample covariance matrix.
Calculates the covariance matrix for multivariate data. Data is passed with rows=observations and columns=variables.
| data | Matrix data (rows=observations, columns=variables) |
| std::invalid_argument | If data is empty, rows have different column counts, or there are fewer than 2 observations |
Definition at line 37 of file multivariate.hpp.
|
inline |
Generate indices for k-fold cross-validation.
Generates indices for splitting data into k folds.
| n | Data size |
| k | Number of folds |
| shuffle | Whether to shuffle (default: true) |
| std::invalid_argument | If k is less than 2 or k exceeds n |
Definition at line 250 of file model_selection.hpp.
|
inline |
Create missing indicator variables.
Creates an indicator variable matrix where each element is 1.0 if missing and 0.0 if observed.
| data | Input data (rows: observations, columns: variables) |
Definition at line 179 of file missing_data.hpp.
|
inline |
Perform k-fold cross-validation for multiple regression model.
Splits data into specified number of folds and evaluates model prediction performance through cross-validation.
| X | Predictor matrix (each row is one sample) |
| y | Response variable vector |
| k | Number of folds (default: 5) |
| std::invalid_argument | If X and y have different sizes |
Definition at line 294 of file model_selection.hpp.
| auto statcpp::cumulative_frequency | ( | Iterator | first, |
| Iterator | last | ||
| ) | -> std::vector<std::pair<typename std::iterator_traits<Iterator>::value_type, std::size_t>> |
Return cumulative frequency (for sorted values)
Calculates the cumulative frequency up to each value. Results are sorted in ascending order by value.
| Iterator | Iterator type |
| first | Beginning iterator |
| last | Ending iterator |
Definition at line 305 of file frequency_distribution.hpp.
| auto statcpp::cumulative_frequency | ( | Iterator | first, |
| Iterator | last, | ||
| Projection | proj | ||
| ) | -> std::vector<std::pair<std::invoke_result_t<Projection, typename std::iterator_traits<Iterator>::value_type>, std::size_t>> |
Cumulative frequency with projection.
Returns the cumulative frequency of results after applying a projection function to each element. Results are sorted in ascending order by value.
| Iterator | Iterator type |
| Projection | Projection function type |
| first | Beginning iterator |
| last | Ending iterator |
| proj | Projection function |
Definition at line 346 of file frequency_distribution.hpp.
| auto statcpp::cumulative_relative_frequency | ( | Iterator | first, |
| Iterator | last | ||
| ) | -> std::vector<std::pair<typename std::iterator_traits<Iterator>::value_type, double>> |
Return cumulative relative frequency (for sorted values)
Calculates the cumulative relative frequency up to each value. Results are sorted in ascending order by value.
| Iterator | Iterator type |
| first | Beginning iterator |
| last | Ending iterator |
Definition at line 390 of file frequency_distribution.hpp.
| auto statcpp::cumulative_relative_frequency | ( | Iterator | first, |
| Iterator | last, | ||
| Projection | proj | ||
| ) | -> std::vector<std::pair<std::invoke_result_t<Projection, typename std::iterator_traits<Iterator>::value_type>, double>> |
Cumulative relative frequency with projection.
Returns the cumulative relative frequency of results after applying a projection function to each element. Results are sorted in ascending order by value.
| Iterator | Iterator type |
| Projection | Projection function type |
| first | Beginning iterator |
| last | Ending iterator |
| proj | Projection function |
Definition at line 427 of file frequency_distribution.hpp.
|
inline |
Extract k clusters from dendrogram.
Cuts the dendrogram to extract k clusters.
| dendrogram | Dendrogram |
| n_data | Number of data points |
| k | Number of clusters |
| std::invalid_argument | If k is invalid |
Definition at line 425 of file clustering.hpp.
|
inline |
Select optimal lambda for Lasso regression using cross-validation.
Performs k-fold cross-validation for a grid of lambda values and selects the lambda with minimum cross-validation error.
| X | Predictor matrix (each row is one sample) |
| y | Response variable vector |
| lambda_grid | Vector of lambda values to evaluate |
| k | Number of folds (default: 5) |
Definition at line 905 of file model_selection.hpp.
|
inline |
Select optimal lambda for Ridge regression using cross-validation.
Performs k-fold cross-validation for a grid of lambda values and selects the lambda with minimum cross-validation error.
| X | Predictor matrix (each row is one sample) |
| y | Response variable vector |
| lambda_grid | Vector of lambda values to evaluate |
| k | Number of folds (default: 5) |
Definition at line 837 of file model_selection.hpp.
|
inline |
Convert Cohen's d to correlation coefficient.
| d | Cohen's d |
Definition at line 260 of file effect_size.hpp.
| outlier_detection_result statcpp::detect_outliers_iqr | ( | Iterator | first, |
| Iterator | last, | ||
| double | k = 1.5 |
||
| ) |
Outlier detection using IQR method (Tukey's Fences)
Detects outliers using the interquartile range (Tukey's Fences).
| Iterator | Iterator type |
| first | Beginning of range |
| last | End of range |
| k | Fence multiplier (default: 1.5, use 3.0 for extreme outliers) |
| std::invalid_argument | If range is empty |
Definition at line 130 of file robust.hpp.
| outlier_detection_result statcpp::detect_outliers_modified_zscore | ( | Iterator | first, |
| Iterator | last, | ||
| double | threshold = 3.5 |
||
| ) |
Outlier detection using Modified Z-score.
Detects outliers using MAD-based Modified Z-score (more robust).
| Iterator | Iterator type |
| first | Beginning of range |
| last | End of range |
| threshold | Modified Z-score threshold (default: 3.5) |
| std::invalid_argument | If range is empty or MAD is zero |
Definition at line 239 of file robust.hpp.
| outlier_detection_result statcpp::detect_outliers_zscore | ( | Iterator | first, |
| Iterator | last, | ||
| double | threshold = 3.0 |
||
| ) |
Outlier detection using Z-score.
Detects outliers using Z-score (standardized values).
| Iterator | Iterator type |
| first | Beginning of range |
| last | End of range |
| threshold | Z-score threshold (default: 3.0) |
| std::invalid_argument | If range has less than 2 elements or standard deviation is zero |
Definition at line 190 of file robust.hpp.
|
inline |
Calculate DFFITS.
Calculates DFFITS to measure the influence of each observation on predicted values.
| residuals | Residuals |
| hat_values | Leverage values (hat values) |
| mse | Mean squared error |
| std::invalid_argument | If parameters are invalid |
Definition at line 418 of file robust.hpp.
|
inline |
Simple diagnosis of missing mechanism.
Diagnoses the missing mechanism (MCAR, MAR, MNAR) of the data. Internally performs Little's MCAR test and estimates the missing mechanism based on the result.
| data | 2D data for diagnosis (rows: observations, columns: variables) |
Definition at line 330 of file missing_data.hpp.
| std::vector< double > statcpp::diff | ( | Iterator | first, |
| Iterator | last, | ||
| std::size_t | order = 1 |
||
| ) |
Difference series (first-order or d-th order differencing)
Calculates the difference of time series data.
| Iterator | RandomAccessIterator type |
| first | Beginning iterator |
| last | End iterator |
| order | Differencing order (default: 1) |
| std::invalid_argument | If data is insufficient for the differencing order |
Definition at line 417 of file time_series.hpp.
|
inline |
Discrete uniform distribution cumulative distribution function (CDF)
| k | Upper bound |
| a | Lower bound (inclusive) |
| b | Upper bound (inclusive) |
| std::invalid_argument | If a > b |
Definition at line 864 of file discrete_distributions.hpp.
|
inline |
Discrete uniform distribution probability mass function (PMF)
P(X = k) = 1 / (b - a + 1) for a <= k <= b
| k | Value |
| a | Lower bound (inclusive) |
| b | Upper bound (inclusive) |
| std::invalid_argument | If a > b |
Definition at line 844 of file discrete_distributions.hpp.
|
inline |
Discrete uniform distribution quantile function.
| p | Cumulative probability |
| a | Lower bound (inclusive) |
| b | Upper bound (inclusive) |
| std::invalid_argument | If a > b or p is outside [0, 1] |
Definition at line 887 of file discrete_distributions.hpp.
|
inline |
Discrete uniform distribution random number generation (using default engine)
| a | Lower bound (inclusive) |
| b | Upper bound (inclusive) |
Definition at line 929 of file discrete_distributions.hpp.
| std::int64_t statcpp::discrete_uniform_rand | ( | std::int64_t | a, |
| std::int64_t | b, | ||
| Engine & | engine | ||
| ) |
Discrete uniform distribution random number generation.
| Engine | Random engine type |
| a | Lower bound (inclusive) |
| b | Upper bound (inclusive) |
| engine | Random engine |
| std::invalid_argument | If a > b |
Definition at line 913 of file discrete_distributions.hpp.
| std::vector< T > statcpp::drop_duplicates | ( | const std::vector< T > & | data | ) |
Drop duplicates.
| T | Data type |
| data | Data vector |
Definition at line 723 of file data_wrangling.hpp.
| std::vector< std::vector< T > > statcpp::dropna | ( | const std::vector< std::vector< T > > & | data | ) |
Drop rows containing NA.
| T | Data type |
| data | 2-dimensional data |
Definition at line 56 of file data_wrangling.hpp.
| std::vector< T > statcpp::dropna | ( | const std::vector< T > & | data | ) |
Drop NA from a 1-dimensional vector.
| T | Data type |
| data | 1-dimensional data |
Definition at line 85 of file data_wrangling.hpp.
|
inline |
Perform Dunnett's test for multiple comparisons against a control group.
Performs comparisons between a specified control group and all other groups as a post-hoc test following one-way ANOVA. Uses Bonferroni approximation.
| anova_result | Result from one-way ANOVA |
| control_group | Index of the control group (default: 0) |
| alpha | Significance level (default: 0.05) |
| std::invalid_argument | If alpha is outside the range (0, 1) |
| std::invalid_argument | If control_group is an invalid index |
|
inline |
Perform Elastic Net regression (L1 + L2 regularization)
Solves Elastic Net regression using coordinate descent. Combines L1 and L2 penalties, achieving both Lasso's variable selection and Ridge's stability.
| X | Predictor matrix (each row is one sample, no intercept column) |
| y | Response variable vector |
| lambda | Regularization parameter (>= 0) |
| alpha | L1 penalty ratio (0 = Ridge, 1 = Lasso, default: 0.5) |
| standardize | Whether to standardize data (default: true) |
| max_iter | Maximum number of iterations (default: 1000) |
| tol | Convergence tolerance (default: 1e-6) |
| std::invalid_argument | If lambda is negative, alpha is outside [0,1], data is empty, or X and y have different sizes |
Definition at line 708 of file model_selection.hpp.
|
inline |
Error function.
Computes the error function erf(x).
| x | Argument |
Definition at line 364 of file special_functions.hpp.
|
inline |
Complementary error function.
Computes the complementary error function erfc(x) = 1 - erf(x).
| x | Argument |
Definition at line 377 of file special_functions.hpp.
|
inline |
|
inline |
Calculate eta-squared from F-test.
Calculates the effect size from the sum of squares for effect and total.
| ss_effect | Sum of squares for effect |
| ss_total | Total sum of squares |
| std::invalid_argument | If ss_total is not positive |
Definition at line 296 of file effect_size.hpp.
|
inline |
Euclidean distance.
Computes the Euclidean distance between two vectors.
| a | First vector |
| b | Second vector |
| std::invalid_argument | If vector dimensions mismatch |
Definition at line 39 of file clustering.hpp.
| double statcpp::euclidean_distance | ( | Iterator1 | first1, |
| Iterator1 | last1, | ||
| Iterator2 | first2, | ||
| Iterator2 | last2 | ||
| ) |
Euclidean distance (L2 norm)
Computes the Euclidean distance between two points in n-dimensional space: d(x, y) = sqrt(sum((x_i - y_i)^2))
| Iterator1 | RandomAccessIterator type for first sequence |
| Iterator2 | RandomAccessIterator type for second sequence |
| first1 | Beginning of first sequence |
| last1 | End of first sequence |
| first2 | Beginning of second sequence |
| last2 | End of second sequence |
| std::invalid_argument | if sequences have different lengths |
Definition at line 31 of file distance_metrics.hpp.
| double statcpp::euclidean_distance | ( | Iterator1 | first1, |
| Iterator1 | last1, | ||
| Iterator2 | first2, | ||
| Iterator2 | last2, | ||
| Proj1 | proj1, | ||
| Proj2 | proj2 | ||
| ) |
Euclidean distance with projection.
Definition at line 62 of file distance_metrics.hpp.
|
inline |
Safely compute exp(x) - 1 for small x.
Uses std::expm1 which is more accurate than exp(x) - 1 for small x
| x | Input value |
Definition at line 185 of file numerical_utils.hpp.
|
inline |
Exponential distribution cumulative distribution function (CDF)
F(x) = 1 - exp(-lambda*x)
| x | Random variable value |
| lambda | Rate parameter (default: 1.0) |
| std::invalid_argument | If lambda <= 0 |
Definition at line 263 of file continuous_distributions.hpp.
| std::vector< double > statcpp::exponential_moving_average | ( | Iterator | first, |
| Iterator | last, | ||
| double | alpha | ||
| ) |
Exponential moving average.
Calculates the exponential moving average using smoothing parameter alpha.
| Iterator | RandomAccessIterator type |
| first | Beginning iterator |
| last | End iterator |
| alpha | Smoothing parameter (0 < alpha <= 1) |
| std::invalid_argument | If range is empty or alpha is outside (0, 1] |
Definition at line 374 of file time_series.hpp.
|
inline |
Exponential distribution probability density function (PDF)
f(x) = lambda * exp(-lambda*x) for x >= 0
| x | Random variable value |
| lambda | Rate parameter (default: 1.0) |
| std::invalid_argument | If lambda <= 0 |
Definition at line 244 of file continuous_distributions.hpp.
|
inline |
Exponential distribution quantile function.
Q(p) = -ln(1-p) / lambda
| p | Probability (0 <= p < 1) |
| lambda | Rate parameter (default: 1.0) |
| std::invalid_argument | If lambda <= 0 or p is outside [0, 1) |
Definition at line 282 of file continuous_distributions.hpp.
| double statcpp::exponential_rand | ( | double | lambda, |
| Engine & | engine | ||
| ) |
Exponential distribution random number generation.
| Engine | Random engine type |
| lambda | Rate parameter |
| engine | Random engine |
| std::invalid_argument | If lambda <= 0 |
Definition at line 304 of file continuous_distributions.hpp.
|
inline |
Exponential distribution random number generation (using default engine)
| lambda | Rate parameter (default: 1.0) |
Definition at line 319 of file continuous_distributions.hpp.
|
inline |
Extract complete cases.
Extracts only rows without missing values (complete cases) from the dataset. This is also called listwise deletion.
| data | Input data (rows: observations, columns: variables) |
Definition at line 1063 of file missing_data.hpp.
|
inline |
F-distribution cumulative distribution function (CDF)
Computed using the incomplete beta function. F(x) = I_{d1*x/(d1*x + d2)}(d1/2, d2/2)
| x | Random variable value |
| df1 | First degrees of freedom |
| df2 | Second degrees of freedom |
| std::invalid_argument | If df1 <= 0 or df2 <= 0 |
Definition at line 862 of file continuous_distributions.hpp.
|
inline |
F-distribution probability density function (PDF)
f(x) = sqrt((d1*x)^d1 * d2^d2 / (d1*x + d2)^(d1+d2)) / (x * B(d1/2, d2/2))
| x | Random variable value |
| df1 | First degrees of freedom |
| df2 | Second degrees of freedom |
| std::invalid_argument | If df1 <= 0 or df2 <= 0 |
Definition at line 832 of file continuous_distributions.hpp.
|
inline |
F-distribution quantile function (Newton-Raphson method)
| p | Probability (0 <= p <= 1) |
| df1 | First degrees of freedom |
| df2 | Second degrees of freedom |
| std::invalid_argument | If df1 <= 0, df2 <= 0, or p is outside [0, 1] |
Definition at line 893 of file continuous_distributions.hpp.
|
inline |
F-distribution random number generation (using default engine)
| df1 | First degrees of freedom |
| df2 | Second degrees of freedom |
Definition at line 976 of file continuous_distributions.hpp.
| double statcpp::f_rand | ( | double | df1, |
| double | df2, | ||
| Engine & | engine | ||
| ) |
F-distribution random number generation.
| Engine | Random engine type |
| df1 | First degrees of freedom |
| df2 | Second degrees of freedom |
| engine | Random engine |
| std::invalid_argument | If df1 <= 0 or df2 <= 0 |
Definition at line 957 of file continuous_distributions.hpp.
| test_result statcpp::f_test | ( | Iterator1 | first1, |
| Iterator1 | last1, | ||
| Iterator2 | first2, | ||
| Iterator2 | last2, | ||
| alternative_hypothesis | alt = alternative_hypothesis::two_sided |
||
| ) |
F-test (variance comparison)
Tests whether the variances of two samples are equal.
| Iterator1 | Input iterator type for first sample |
| Iterator2 | Input iterator type for second sample |
| first1 | Beginning iterator of first sample |
| last1 | End iterator of first sample |
| first2 | Beginning iterator of second sample |
| last2 | End iterator of second sample |
| alt | Type of alternative hypothesis (default: two-sided) |
| std::invalid_argument | If either sample has less than 2 elements or second sample variance is zero |
Definition at line 634 of file parametric_tests.hpp.
| std::vector< T > statcpp::fillna | ( | const std::vector< T > & | data, |
| T | fill_value | ||
| ) |
Fill NA with a specified value.
| T | Data type |
| data | Data vector |
| fill_value | Value to fill |
Definition at line 110 of file data_wrangling.hpp.
|
inline |
Fill NA with backward fill.
| data | Data vector |
Definition at line 196 of file data_wrangling.hpp.
|
inline |
Fill NA with forward fill.
| data | Data vector |
Definition at line 176 of file data_wrangling.hpp.
|
inline |
Fill NA with linear interpolation.
| data | Data vector |
Definition at line 216 of file data_wrangling.hpp.
|
inline |
Fill NA with mean.
| data | Data vector |
Definition at line 128 of file data_wrangling.hpp.
|
inline |
Fill NA with median.
| data | Data vector |
Definition at line 152 of file data_wrangling.hpp.
| std::vector< T > statcpp::filter | ( | const std::vector< T > & | data, |
| Predicate | pred | ||
| ) |
Filter elements that match a condition.
| T | Data type |
| Predicate | Predicate type |
| data | Data vector |
| pred | Predicate function |
Definition at line 266 of file data_wrangling.hpp.
| std::vector< T > statcpp::filter_range | ( | const std::vector< T > & | data, |
| T | min_val, | ||
| T | max_val | ||
| ) |
Filter values within a range.
| T | Data type |
| data | Data vector |
| min_val | Minimum value |
| max_val | Maximum value |
Definition at line 310 of file data_wrangling.hpp.
| std::vector< std::vector< T > > statcpp::filter_rows | ( | const std::vector< std::vector< T > > & | data, |
| Predicate | pred | ||
| ) |
Filter rows that match a condition (2-dimensional)
| T | Data type |
| Predicate | Predicate type |
| data | 2-dimensional data |
| pred | Predicate function |
Definition at line 288 of file data_wrangling.hpp.
|
inline |
Tipping point analysis.
Searches for the critical point (tipping point) where the estimated mean crosses the specified threshold. This allows assessment of how extreme the MNAR assumption must be to change conclusions.
| data | 1D data for analysis |
| threshold | Threshold (e.g., null hypothesis value) |
| delta_min | Minimum delta value to search (default: -5.0) |
| delta_max | Maximum delta value to search (default: 5.0) |
| n_points | Number of search points (default: 100) |
Definition at line 985 of file missing_data.hpp.
|
inline |
Perform Fisher's exact test (2x2 contingency table)
Tests whether row and column variables are independent in a 2x2 contingency table. Uses exact probability calculation based on hypergeometric distribution, applicable even when expected frequencies are small.
Contingency table format:
| a | Frequency of cell (1,1) |
| b | Frequency of cell (1,2) |
| c | Frequency of cell (2,1) |
| d | Frequency of cell (2,2) |
| alt | Type of alternative hypothesis (default: two-sided) |
Definition at line 925 of file nonparametric_tests.hpp.
| five_number_summary_result statcpp::five_number_summary | ( | Iterator | first, |
| Iterator | last | ||
| ) |
Return five-number summary.
Calculates five-number summary (min, Q1, median, Q3, max) from sorted range.
| Iterator | Iterator type |
| first | Beginning of sorted range |
| last | End of sorted range |
| std::invalid_argument | If range is empty |
Definition at line 340 of file order_statistics.hpp.
| five_number_summary_result statcpp::five_number_summary | ( | Iterator | first, |
| Iterator | last, | ||
| Projection | proj | ||
| ) |
Return five-number summary with projection.
| Iterator | Iterator type |
| Projection | Projection function type |
| first | Beginning of sorted range |
| last | End of sorted range |
| proj | Projection function |
| std::invalid_argument | If range is empty |
Definition at line 373 of file order_statistics.hpp.
| auto statcpp::frequency_count | ( | Iterator | first, |
| Iterator | last | ||
| ) | -> std::unordered_map<typename std::iterator_traits<Iterator>::value_type, std::size_t> |
Return frequency for each value (unordered_map version, fast)
Counts the number of occurrences of each value. Sort order is not guaranteed, but operates faster.
| Iterator | Iterator type |
| first | Beginning iterator |
| last | Ending iterator |
Definition at line 178 of file frequency_distribution.hpp.
| auto statcpp::frequency_count | ( | Iterator | first, |
| Iterator | last, | ||
| Projection | proj | ||
| ) | -> std::unordered_map<std::invoke_result_t<Projection, typename std::iterator_traits<Iterator>::value_type>, std::size_t> |
Frequency count with projection.
Returns the frequency of results after applying a projection function to each element.
| Iterator | Iterator type |
| Projection | Projection function type |
| first | Beginning iterator |
| last | Ending iterator |
| proj | Projection function |
Definition at line 203 of file frequency_distribution.hpp.
| auto statcpp::frequency_table | ( | Iterator | first, |
| Iterator | last | ||
| ) | -> frequency_table_result<typename std::iterator_traits<Iterator>::value_type> |
Create frequency table (returned with sorted keys)
Calculates frequency, relative frequency, cumulative frequency, and cumulative relative frequency for each value. Results are sorted in ascending order by key.
| Iterator | Iterator type |
| first | Beginning iterator |
| last | Ending iterator |
Definition at line 74 of file frequency_distribution.hpp.
| auto statcpp::frequency_table | ( | Iterator | first, |
| Iterator | last, | ||
| Projection | proj | ||
| ) | -> frequency_table_result<std::invoke_result_t<Projection, typename std::iterator_traits<Iterator>::value_type>> |
Frequency table with projection.
Creates a frequency table of the results after applying a projection function to each element. Results are sorted in ascending order by key.
| Iterator | Iterator type |
| Projection | Projection function type |
| first | Beginning iterator |
| last | Ending iterator |
| proj | Projection function |
Definition at line 125 of file frequency_distribution.hpp.
|
inline |
Gamma distribution cumulative distribution function (CDF)
F(x) = P(alpha, beta*x) (regularized lower incomplete gamma function)
| x | Random variable value |
| shape | Shape parameter alpha |
| rate | Rate parameter beta (default: 1.0) |
| std::invalid_argument | If shape <= 0 or rate <= 0 |
Definition at line 369 of file continuous_distributions.hpp.
|
inline |
Gamma distribution probability density function (PDF)
f(x) = (beta^alpha / Gamma(alpha)) * x^(alpha-1) * exp(-beta*x) for x > 0 Parameters: shape = alpha (k), rate = beta (1/theta)
| x | Random variable value |
| shape | Shape parameter alpha |
| rate | Rate parameter beta (default: 1.0) |
| std::invalid_argument | If shape <= 0 or rate <= 0 |
Definition at line 340 of file continuous_distributions.hpp.
|
inline |
Gamma distribution quantile function.
| p | Probability (0 <= p <= 1) |
| shape | Shape parameter alpha |
| rate | Rate parameter beta (default: 1.0) |
| std::invalid_argument | If shape <= 0, rate <= 0, or p is outside [0, 1] |
Definition at line 391 of file continuous_distributions.hpp.
| double statcpp::gamma_rand | ( | double | shape, |
| double | rate, | ||
| Engine & | engine | ||
| ) |
Gamma distribution random number generation.
| Engine | Random engine type |
| shape | Shape parameter alpha |
| rate | Rate parameter beta |
| engine | Random engine |
| std::invalid_argument | If shape <= 0 or rate <= 0 |
Definition at line 419 of file continuous_distributions.hpp.
|
inline |
Gamma distribution random number generation (using default engine)
| shape | Shape parameter alpha |
| rate | Rate parameter beta (default: 1.0) |
Definition at line 439 of file continuous_distributions.hpp.
|
inline |
Lower regularized incomplete gamma function.
Computes the lower regularized incomplete gamma function P(a, x) = gamma(a, x) / Gamma(a).
| a | Shape parameter (must be positive) |
| x | Upper limit of integration (must be non-negative) |
| std::domain_error | If parameters are invalid |
Definition at line 490 of file special_functions.hpp.
|
inline |
Inverse lower regularized incomplete gamma function.
Computes x such that P(a, x) = p.
| a | Shape parameter (must be positive) |
| p | Probability value (must be in [0, 1]) |
| std::domain_error | If parameters are invalid |
Definition at line 573 of file special_functions.hpp.
|
inline |
Upper regularized incomplete gamma function.
Computes the upper regularized incomplete gamma function Q(a, x) = Gamma(a, x) / Gamma(a) = 1 - P(a, x).
| a | Shape parameter (must be positive) |
| x | Lower limit of integration (must be non-negative) |
| std::domain_error | If parameters are invalid |
Definition at line 555 of file special_functions.hpp.
|
inline |
Automatically generate lambda grid for regularized regression.
Calculates maximum lambda based on data and generates a grid of lambda values on a logarithmic scale.
| X | Predictor matrix (each row is one sample) |
| y | Response variable vector |
| n_lambda | Grid size (default: 100) |
| lambda_min_ratio | Ratio of lambda_min to lambda_max (default: 0.0001) |
Definition at line 972 of file model_selection.hpp.
|
inline |
Geometric distribution cumulative distribution function (CDF)
P(X <= k) = 1 - (1-p)^(k+1)
| k | Upper bound of number of failures |
| p | Probability of success in each trial |
| std::invalid_argument | If p is outside (0, 1] |
Definition at line 346 of file discrete_distributions.hpp.
| double statcpp::geometric_mean | ( | Iterator | first, |
| Iterator | last | ||
| ) |
Geometric mean.
Computes the geometric mean of elements in the range. All values must be positive.
| Iterator | Iterator type |
| first | Begin iterator |
| last | End iterator |
| std::invalid_argument | If range is empty or if a value is zero or negative |
Definition at line 449 of file basic_statistics.hpp.
| double statcpp::geometric_mean | ( | Iterator | first, |
| Iterator | last, | ||
| Projection | proj | ||
| ) |
Geometric mean of projected values using a lambda expression.
Computes the geometric mean of the results after applying a projection function to each element. All values must be positive.
| Iterator | Iterator type |
| Projection | Projection function type |
| first | Begin iterator |
| last | End iterator |
| proj | Projection function |
| std::invalid_argument | If range is empty or if a value is zero or negative |
Definition at line 480 of file basic_statistics.hpp.
|
inline |
Geometric distribution probability mass function (PMF)
P(X = k) = (1-p)^k * p X = Number of failures before first success (support: k = 0, 1, 2, ...)
| k | Number of failures |
| p | Probability of success in each trial |
| std::invalid_argument | If p is outside (0, 1] |
Definition at line 326 of file discrete_distributions.hpp.
|
inline |
Geometric distribution quantile function (inverse CDF)
| prob | Cumulative probability |
| p | Probability of success in each trial |
| std::invalid_argument | If prob is outside [0, 1] or p is outside (0, 1] |
Definition at line 364 of file discrete_distributions.hpp.
|
inline |
Geometric distribution random number generation (using default engine)
| p | Probability of success in each trial |
Definition at line 408 of file discrete_distributions.hpp.
| std::uint64_t statcpp::geometric_rand | ( | double | p, |
| Engine & | engine | ||
| ) |
Geometric distribution random number generation.
| Engine | Random engine type |
| p | Probability of success in each trial |
| engine | Random engine |
| std::invalid_argument | If p is outside (0, 1] |
Definition at line 393 of file discrete_distributions.hpp.
| double statcpp::geometric_stddev | ( | Iterator | first, |
| Iterator | last | ||
| ) |
Geometric standard deviation.
Computes the exponential of the standard deviation of log-transformed data. GSD = exp(sigma_ln) where sigma_ln is the standard deviation of ln(x) Useful for measuring dispersion of data following a log-normal distribution.
| Iterator | Iterator type |
| first | Begin iterator |
| last | End iterator |
| std::invalid_argument | If the range is empty or values are non-positive |
Definition at line 1515 of file dispersion_spread.hpp.
| double statcpp::geometric_stddev | ( | Iterator | first, |
| Iterator | last, | ||
| Projection | proj | ||
| ) |
Geometric standard deviation (projection version)
Computes the geometric standard deviation of results after applying a projection function to each element.
| Iterator | Iterator type |
| Projection | Projection function type |
| first | Begin iterator |
| last | End iterator |
| proj | Projection function |
| std::invalid_argument | If the range is empty or values are non-positive |
Definition at line 1552 of file dispersion_spread.hpp.
| std::vector< T > statcpp::get_duplicates | ( | const std::vector< T > & | data | ) |
Get duplicate values.
| T | Data type |
| data | Data vector |
Definition at line 760 of file data_wrangling.hpp.
|
inline |
Singleton accessor for global random engine.
Returns a thread-local random engine. Each thread can generate independent random sequences, making it thread-safe.
Definition at line 31 of file random_engine.hpp.
| double statcpp::glass_delta | ( | Iterator1 | control_first, |
| Iterator1 | control_last, | ||
| Iterator2 | treatment_first, | ||
| Iterator2 | treatment_last | ||
| ) |
Glass's Delta (using control group's standard deviation)
Calculates the effect size using only the control group's standard deviation. Useful when the variances of the experimental and control groups differ substantially.
| Iterator1 | RandomAccessIterator type for control group |
| Iterator2 | RandomAccessIterator type for treatment group |
| control_first | Beginning iterator of control group |
| control_last | Ending iterator of control group |
| treatment_first | Beginning iterator of treatment group |
| treatment_last | Ending iterator of treatment group |
| std::invalid_argument | If control group has fewer than 2 elements, treatment group is empty, or control group has zero variance |
Definition at line 214 of file effect_size.hpp.
|
inline |
Fit a generalized linear model.
Estimates parameters of a generalized linear model using the IRLS (Iteratively Reweighted Least Squares) algorithm.
| X | Predictor matrix (intercept is added automatically) |
| y | Response variable vector |
| family | Distribution family (default: gaussian) |
| link | Link function (default: identity) |
| max_iter | Maximum number of iterations (default: 100) |
| tol | Convergence tolerance (default: 1e-8) |
| std::invalid_argument | If data is empty, X and Y sizes don't match, number of predictors is inconsistent, or number of observations is not greater than number of predictors |
| group_result< K, V > statcpp::group_by | ( | const std::vector< K > & | keys, |
| const std::vector< V > & | values | ||
| ) |
Group by.
| K | Key type |
| V | Value type |
| keys | Vector of keys |
| values | Vector of values |
Definition at line 494 of file data_wrangling.hpp.
| aggregation_result< K > statcpp::group_count | ( | const std::vector< K > & | keys, |
| const std::vector< double > & | values | ||
| ) |
Count per group.
| K | Key type |
| keys | Vector of keys |
| values | Vector of values |
Definition at line 555 of file data_wrangling.hpp.
| aggregation_result< K > statcpp::group_mean | ( | const std::vector< K > & | keys, |
| const std::vector< double > & | values | ||
| ) |
Mean per group.
| K | Key type |
| keys | Vector of keys |
| values | Vector of values |
Definition at line 515 of file data_wrangling.hpp.
| aggregation_result< K > statcpp::group_sum | ( | const std::vector< K > & | keys, |
| const std::vector< double > & | values | ||
| ) |
Sum per group.
| K | Key type |
| keys | Vector of keys |
| values | Vector of values |
Definition at line 535 of file data_wrangling.hpp.
| double statcpp::harmonic_mean | ( | Iterator | first, |
| Iterator | last | ||
| ) |
Harmonic mean.
Computes the harmonic mean of elements in the range. All values must be non-zero.
| Iterator | Iterator type |
| first | Begin iterator |
| last | End iterator |
| std::invalid_argument | If range is empty or if a value is zero |
Definition at line 519 of file basic_statistics.hpp.
| double statcpp::harmonic_mean | ( | Iterator | first, |
| Iterator | last, | ||
| Projection | proj | ||
| ) |
Harmonic mean of projected values using a lambda expression.
Computes the harmonic mean of the results after applying a projection function to each element. All values must be non-zero.
| Iterator | Iterator type |
| Projection | Projection function type |
| first | Begin iterator |
| last | End iterator |
| proj | Projection function |
| std::invalid_argument | If range is empty or if a value is zero |
Definition at line 555 of file basic_statistics.hpp.
|
inline |
Check for convergence using combined absolute and relative criteria.
Convergence criterion: |x_new - x_old| <= abs_tol + rel_tol * |x_old|
| x_new | New value |
| x_old | Old value |
| abs_tol | Absolute tolerance (default: 1e-8) |
| rel_tol | Relative tolerance (default: 1e-6) |
Definition at line 156 of file numerical_utils.hpp.
|
inline |
Check for convergence based on absolute change.
Convergence criterion: |x_new - x_old| <= tol
| x_new | New value |
| x_old | Old value |
| tol | Tolerance (default: 1e-6) |
Definition at line 122 of file numerical_utils.hpp.
|
inline |
Check for convergence based on relative change.
Convergence criterion: |x_new - x_old| / max(|x_old|, eps) <= tol
| x_new | New value |
| x_old | Old value |
| tol | Tolerance (default: 1e-6) |
Definition at line 138 of file numerical_utils.hpp.
|
inline |
Hedges' bias correction factor J.
Calculates the correction factor for small sample size bias.
| df | Degrees of freedom |
Definition at line 133 of file effect_size.hpp.
| double statcpp::hedges_g | ( | Iterator | first, |
| Iterator | last, | ||
| double | mu0 | ||
| ) |
Hedges' g (one-sample)
Calculates bias-corrected Cohen's d.
| Iterator | RandomAccessIterator type |
| first | Beginning iterator |
| last | Ending iterator |
| mu0 | Population mean to compare against |
| std::invalid_argument | If there are fewer than 2 elements |
Definition at line 152 of file effect_size.hpp.
| double statcpp::hedges_g_two_sample | ( | Iterator1 | first1, |
| Iterator1 | last1, | ||
| Iterator2 | first2, | ||
| Iterator2 | last2 | ||
| ) |
Hedges' g (two-sample)
Calculates bias-corrected standardized mean difference between two groups.
| Iterator1 | RandomAccessIterator type for first sample |
| Iterator2 | RandomAccessIterator type for second sample |
| first1 | Beginning iterator of first sample |
| last1 | Ending iterator of first sample |
| first2 | Beginning iterator of second sample |
| last2 | Ending iterator of second sample |
| std::invalid_argument | If either sample has fewer than 2 elements |
Definition at line 179 of file effect_size.hpp.
|
inline |
Hierarchical clustering.
Performs hierarchical clustering and generates a dendrogram.
| data | Vector of data points |
| linkage | Linkage type (default: single) |
| std::invalid_argument | If data is empty |
Definition at line 302 of file clustering.hpp.
| double statcpp::hodges_lehmann | ( | Iterator | first, |
| Iterator | last | ||
| ) |
Hodges-Lehmann estimator.
Calculates the median of all pairwise averages (Walsh average).
| Iterator | Iterator type |
| first | Beginning of range |
| last | End of range |
| std::invalid_argument | If range is empty |
Definition at line 475 of file robust.hpp.
|
inline |
Holm correction (step-down Bonferroni method)
Corrects p-values for multiple testing using the Holm method. A step-down version of Bonferroni correction with higher power.
| p_values | Vector of original p-values |
Definition at line 751 of file parametric_tests.hpp.
|
inline |
Hypergeometric distribution cumulative distribution function (CDF)
Calculates P(X <= k).
| k | Upper bound of success draws |
| N | Population size |
| K | Number of success states in population |
| n | Number of draws |
| std::invalid_argument | If parameters are invalid |
Definition at line 460 of file discrete_distributions.hpp.
|
inline |
Hypergeometric distribution probability mass function (PMF)
P(X = k) = C(K, k) * C(N-K, n-k) / C(N, n)
| k | Number of success draws |
| N | Population size |
| K | Number of success states in population |
| n | Number of draws |
| std::invalid_argument | If parameters are invalid (K > N or n > N) |
Definition at line 429 of file discrete_distributions.hpp.
|
inline |
Hypergeometric distribution quantile function (inverse CDF)
| p | Cumulative probability |
| N | Population size |
| K | Number of success states in population |
| n | Number of draws |
| std::invalid_argument | If parameters are outside valid range |
Definition at line 491 of file discrete_distributions.hpp.
|
inline |
Hypergeometric distribution random number generation (using default engine)
| N | Population size |
| K | Number of success states in population |
| n | Number of draws |
Definition at line 568 of file discrete_distributions.hpp.
| std::uint64_t statcpp::hypergeom_rand | ( | std::uint64_t | N, |
| std::uint64_t | K, | ||
| std::uint64_t | n, | ||
| Engine & | engine | ||
| ) |
Hypergeometric distribution random number generation.
Uses direct sampling method (suitable for moderate n).
| Engine | Random engine type |
| N | Population size |
| K | Number of success states in population |
| n | Number of draws |
| engine | Random engine |
| std::invalid_argument | If parameters are invalid |
Definition at line 532 of file discrete_distributions.hpp.
|
inline |
Single imputation by conditional mean.
Imputes missing values with conditional mean using simple linear regression with predictor variables.
| data | Input data (rows: observations, columns: variables) |
| target_col | Column index for imputation target |
| predictor_cols | Column indices for predictor variables |
Definition at line 375 of file missing_data.hpp.
|
inline |
Check if a value is in range [min_val, max_val].
| x | Value to check |
| min_val | Minimum value |
| max_val | Maximum value |
Definition at line 215 of file numerical_utils.hpp.
|
inline |
Calculate Incidence Rate Ratios.
Calculates incidence rate ratios from Poisson regression model coefficients.
| model | Fitted Poisson regression model |
| std::invalid_argument | If model is not Poisson regression |
| double statcpp::interpolate_at | ( | Iterator | first, |
| std::size_t | n, | ||
| double | p | ||
| ) |
Linear interpolation at position.
Decomposes position p * (n-1) into integer part lo and fractional part frac, then performs linear interpolation.
| Iterator | Iterator type |
| first | Beginning of sorted range |
| n | Number of elements |
| p | Position (0.0 to 1.0) |
Definition at line 66 of file order_statistics.hpp.
| double statcpp::interpolate_at | ( | Iterator | first, |
| std::size_t | n, | ||
| double | p, | ||
| Projection | proj | ||
| ) |
Linear interpolation at position with projection.
| Iterator | Iterator type |
| Projection | Projection function type |
| first | Beginning of sorted range |
| n | Number of elements |
| p | Position (0.0 to 1.0) |
| proj | Projection function |
Definition at line 96 of file order_statistics.hpp.
|
inline |
Interpret Cohen's d.
Determines the magnitude of effect size based on Cohen (1988) criteria.
| d | Cohen's d |
Definition at line 441 of file effect_size.hpp.
|
inline |
Interpret correlation coefficient.
Determines the strength of correlation based on Cohen (1988) criteria.
| r | Correlation coefficient |
Definition at line 458 of file effect_size.hpp.
|
inline |
Interpret eta-squared.
Determines the magnitude of effect size based on Cohen (1988) criteria.
| eta2 | Eta-squared |
Definition at line 475 of file effect_size.hpp.
| double statcpp::iqr | ( | Iterator | first, |
| Iterator | last | ||
| ) |
Interquartile range (accepts a sorted range)
Computes the difference between the third and first quartiles. Useful for measuring the spread of the middle 50% of the data.
| Iterator | Iterator type |
| first | Begin iterator |
| last | End iterator |
| std::invalid_argument | If the range is empty |
Definition at line 956 of file dispersion_spread.hpp.
| double statcpp::iqr | ( | Iterator | first, |
| Iterator | last, | ||
| Projection | proj | ||
| ) |
Interquartile range of projected values (projection results must be in sorted order)
Computes the interquartile range of results after applying a projection function to each element. Assumes projection results are in sorted order.
| Iterator | Iterator type |
| Projection | Projection function type |
| first | Begin iterator |
| last | End iterator |
| proj | Projection function |
| std::invalid_argument | If the range is empty |
Definition at line 982 of file dispersion_spread.hpp.
|
inline |
Check if a value is finite (not infinity or NaN)
| x | Value to check |
Definition at line 88 of file numerical_utils.hpp.
|
inline |
Check if a value is NA.
| x | Value to check |
Definition at line 45 of file data_wrangling.hpp.
|
inline |
Check if a value is close to zero.
| x | Value to check |
| tol | Tolerance (default: 1e-12) |
Definition at line 77 of file numerical_utils.hpp.
| double statcpp::kahan_sum | ( | Iterator | first, |
| Iterator | last | ||
| ) |
Compute sum with Kahan summation algorithm.
Kahan summation reduces numerical error in summing a sequence of floating-point numbers. More accurate than naive summation for large sequences or when values vary widely in magnitude.
| Iterator | RandomAccessIterator type |
| first | Beginning of sequence |
| last | End of sequence |
Definition at line 264 of file numerical_utils.hpp.
| double statcpp::kahan_sum | ( | Iterator | first, |
| Iterator | last, | ||
| Proj | proj | ||
| ) |
Compute sum with Kahan summation algorithm (with projection)
Definition at line 284 of file numerical_utils.hpp.
|
inline |
Estimate Kaplan-Meier survival curve.
Estimates the survival curve from survival time data including censored observations. Calculates standard errors using Greenwood's formula and provides 95% confidence intervals.
| times | Vector of observation times |
| events | Event occurrence flags (true = event occurred, false = censored) |
| std::invalid_argument | If times and events have different sizes or data is empty |
Definition at line 54 of file survival.hpp.
| double statcpp::kendall_tau | ( | Iterator1 | first1, |
| Iterator1 | last1, | ||
| Iterator2 | first2, | ||
| Iterator2 | last2 | ||
| ) |
Kendall's rank correlation coefficient (tau-b)
Computes Kendall's rank correlation coefficient (tau-b) of two variables. This version accounts for ties. tau_b = (concordant - discordant) / sqrt((n0 - tie_x) * (n0 - tie_y))
| Iterator1 | Iterator type for the first data |
| Iterator2 | Iterator type for the second data |
| first1 | Begin iterator for the first data |
| last1 | End iterator for the first data |
| first2 | Begin iterator for the second data |
| last2 | End iterator for the second data |
| std::invalid_argument | If range is empty, lengths differ, or number of elements is less than 2 |
Definition at line 735 of file correlation_covariance.hpp.
| double statcpp::kendall_tau | ( | Iterator1 | first1, |
| Iterator1 | last1, | ||
| Iterator2 | first2, | ||
| Iterator2 | last2, | ||
| Projection1 | proj1, | ||
| Projection2 | proj2 | ||
| ) |
Kendall's rank correlation coefficient (projection version)
| Iterator1 | Iterator type for the first data |
| Iterator2 | Iterator type for the second data |
| Projection1 | Projection function type for the first data |
| Projection2 | Projection function type for the second data |
| first1 | Begin iterator for the first data |
| last1 | End iterator for the first data |
| first2 | Begin iterator for the second data |
| last2 | End iterator for the second data |
| proj1 | Projection function for the first data |
| proj2 | Projection function for the second data |
| std::invalid_argument | If range is empty, lengths differ, or number of elements is less than 2 |
Definition at line 829 of file correlation_covariance.hpp.
|
inline |
K-means clustering.
Performs clustering using the K-means algorithm.
| data | Vector of data points |
| k | Number of clusters |
| max_iter | Maximum number of iterations (default: 100) |
| tol | Convergence tolerance (default: 1e-6) |
| std::invalid_argument | If data is empty, k is 0, or k exceeds number of data points |
Definition at line 168 of file clustering.hpp.
|
inline |
K-means++ initialization.
Selects initial cluster centroids using the K-means++ algorithm.
| data | Vector of data points |
| k | Number of clusters |
Definition at line 101 of file clustering.hpp.
|
inline |
Perform Kruskal-Wallis test (k-sample)
Tests whether three or more independent samples come from the same distribution. The nonparametric version of one-way ANOVA that does not assume normal distribution. Uses chi-square approximation for p-value calculation.
| groups | Vector of vectors containing data for each group |
| std::invalid_argument | If there are fewer than 2 groups |
| std::invalid_argument | If any group is empty |
Definition at line 805 of file nonparametric_tests.hpp.
| test_result statcpp::ks_test_normal | ( | Iterator | first, |
| Iterator | last | ||
| ) |
Perform Kolmogorov-Smirnov test for normality (deprecated)
Definition at line 372 of file nonparametric_tests.hpp.
| double statcpp::kurtosis | ( | Iterator | first, |
| Iterator | last | ||
| ) |
Calculate kurtosis (alias for sample_kurtosis)
| Iterator | Input iterator type |
| first | Beginning iterator of data range |
| last | End iterator of data range |
Definition at line 635 of file shape_of_distribution.hpp.
| double statcpp::kurtosis | ( | Iterator | first, |
| Iterator | last, | ||
| double | precomputed_mean | ||
| ) |
Calculate kurtosis (precomputed mean version)
| Iterator | Input iterator type |
| first | Beginning iterator of data range |
| last | End iterator of data range |
| precomputed_mean | Precomputed mean value |
Definition at line 650 of file shape_of_distribution.hpp.
| double statcpp::kurtosis | ( | Iterator | first, |
| Iterator | last, | ||
| Projection | proj | ||
| ) |
Calculate kurtosis (projection version)
| Iterator | Input iterator type |
| Projection | Projection function type |
| first | Beginning iterator of data range |
| last | End iterator of data range |
| proj | Projection function |
Definition at line 669 of file shape_of_distribution.hpp.
| double statcpp::kurtosis | ( | Iterator | first, |
| Iterator | last, | ||
| Projection | proj, | ||
| double | precomputed_mean | ||
| ) |
Calculate kurtosis (projection version, precomputed mean)
| Iterator | Input iterator type |
| Projection | Projection function type |
| first | Beginning iterator of data range |
| last | End iterator of data range |
| proj | Projection function |
| precomputed_mean | Precomputed mean value |
Definition at line 686 of file shape_of_distribution.hpp.
| label_encoding_result< T > statcpp::label_encode | ( | const std::vector< T > & | data | ) |
Label encoding.
| T | Data type |
| data | Data vector |
Definition at line 969 of file data_wrangling.hpp.
| std::vector< double > statcpp::lag | ( | Iterator | first, |
| Iterator | last, | ||
| std::size_t | k | ||
| ) |
Generate lag series.
Creates a lag series from time series data.
| Iterator | RandomAccessIterator type |
| first | Beginning iterator |
| last | End iterator |
| k | Lag |
| std::invalid_argument | If lag exceeds data length |
Definition at line 499 of file time_series.hpp.
|
inline |
Perform Lasso regression (L1 regularization)
Solves Lasso regression using coordinate descent. L1 penalty shrinks some coefficients exactly to zero, performing variable selection.
| X | Predictor matrix (each row is one sample, no intercept column) |
| y | Response variable vector |
| lambda | Regularization parameter (>= 0) |
| standardize | Whether to standardize data (default: true) |
| max_iter | Maximum number of iterations (default: 1000) |
| tol | Convergence tolerance (default: 1e-6) |
| std::invalid_argument | If lambda is negative, data is empty, or X and y have different sizes |
Definition at line 582 of file model_selection.hpp.
|
inline |
Log-beta function.
Computes the natural logarithm of the beta function.
| a | First parameter (must be positive) |
| b | Second parameter (must be positive) |
| std::domain_error | If a or b is non-positive |
Definition at line 166 of file special_functions.hpp.
|
inline |
Perform Levene test (homogeneity of variance test)
Tests whether variances are equal across multiple groups. Uses the median-based Brown-Forsythe version, which is robust to departures from normality.
| groups | Vector of vectors containing data for each group |
| std::invalid_argument | If there are fewer than 2 groups |
| std::invalid_argument | If any group has fewer than 2 elements |
Definition at line 397 of file nonparametric_tests.hpp.
|
inline |
Log-gamma function.
Computes the natural logarithm of the gamma function.
| x | Argument |
| std::domain_error | If x is a non-positive integer |
Definition at line 100 of file special_functions.hpp.
|
inline |
Internal log-gamma function implementation.
Calculates log(Gamma(x)) using Lanczos approximation.
| x | Argument (must be positive or non-integer if negative) |
| std::domain_error | If x is a non-positive integer |
Definition at line 57 of file special_functions.hpp.
| test_result statcpp::lilliefors_test | ( | Iterator | first, |
| Iterator | last | ||
| ) |
Perform Lilliefors test for normality.
Tests whether data follows a normal distribution. This is a Lilliefors test (not a standard KS test): parameters (mean, variance) are estimated from data, and the Lilliefors correction is applied to the p-value.
| Iterator | Input iterator type |
| first | Beginning iterator of range |
| last | Ending iterator of range |
| std::invalid_argument | If there are fewer than 2 elements |
| std::invalid_argument | If variance is zero |
Definition at line 312 of file nonparametric_tests.hpp.
|
inline |
Safely compute log(1 + x) for small x.
Uses std::log1p which is more accurate than log(1 + x) for small x
| x | Input value |
Definition at line 172 of file numerical_utils.hpp.
|
inline |
Logarithmic transformation (log1p: log(1 + x))
| data | Data vector |
Definition at line 346 of file data_wrangling.hpp.
|
inline |
Calculate log binomial coefficient.
Calculates log(C(n, k)) = log(n! / (k! * (n-k)!))
| n | Total number of elements |
| k | Number of elements to choose |
Definition at line 49 of file discrete_distributions.hpp.
|
inline |
Calculate log factorial.
| n | Non-negative integer |
Definition at line 34 of file discrete_distributions.hpp.
|
inline |
Logarithmic transformation (natural logarithm)
| data | Data vector |
Definition at line 326 of file data_wrangling.hpp.
| double statcpp::logarithmic_mean | ( | T1 | a, |
| T2 | b | ||
| ) |
Logarithmic Mean.
Computes the logarithmic mean of two positive values. LM(a, b) = (b - a) / (ln(b) - ln(a)) for a != b LM(a, a) = a
| T1 | Type of first argument |
| T2 | Type of second argument |
| a | First value |
| b | Second value |
| std::invalid_argument | If arguments are not positive |
Definition at line 845 of file basic_statistics.hpp.
|
inline |
Logistic regression.
Fits a generalized linear model using binomial distribution and logit link function.
| X | Predictor matrix (intercept is added automatically) |
| y | Response variable vector (range 0 to 1) |
| max_iter | Maximum number of iterations (default: 100) |
| tol | Convergence tolerance (default: 1e-8) |
| std::invalid_argument | If y is outside [0,1] range or X contains an intercept column |
|
inline |
Log-normal distribution cumulative distribution function (CDF)
F(x) = Phi((ln(x) - mu) / sigma)
| x | Random variable value |
| mu | Log-mean (default: 0.0) |
| sigma | Log-standard deviation (default: 1.0) |
| std::invalid_argument | If sigma <= 0 |
Definition at line 1020 of file continuous_distributions.hpp.
|
inline |
Log-normal distribution probability density function (PDF)
f(x) = (1 / (x * sigma * sqrt(2*pi))) * exp(-(ln(x) - mu)^2 / (2*sigma^2))
| x | Random variable value |
| mu | Log-mean (default: 0.0) |
| sigma | Log-standard deviation (default: 1.0) |
| std::invalid_argument | If sigma <= 0 |
Definition at line 996 of file continuous_distributions.hpp.
|
inline |
Log-normal distribution quantile function.
Q(p) = exp(mu + sigma * Phi^(-1)(p))
| p | Probability (0 < p < 1) |
| mu | Log-mean (default: 0.0) |
| sigma | Log-standard deviation (default: 1.0) |
| std::invalid_argument | If sigma <= 0 or p is outside (0, 1) |
Definition at line 1043 of file continuous_distributions.hpp.
| double statcpp::lognormal_rand | ( | double | mu, |
| double | sigma, | ||
| Engine & | engine | ||
| ) |
Log-normal distribution random number generation.
| Engine | Random engine type |
| mu | Log-mean |
| sigma | Log-standard deviation |
| engine | Random engine |
| std::invalid_argument | If sigma <= 0 |
Definition at line 1067 of file continuous_distributions.hpp.
|
inline |
Log-normal distribution random number generation (using default engine)
| mu | Log-mean (default: 0.0) |
| sigma | Log-standard deviation (default: 1.0) |
Definition at line 1083 of file continuous_distributions.hpp.
|
inline |
Log-rank test (comparison of two survival curves)
Tests whether the survival curves of two groups are equal. A nonparametric test that considers the risk set at each time point.
| times1 | Observation times for group 1 |
| events1 | Event occurrence flags for group 1 |
| times2 | Observation times for group 2 |
| events2 | Event occurrence flags for group 2 |
| std::invalid_argument | If times and events sizes don't match or data is empty |
Definition at line 184 of file survival.hpp.
|
inline |
Perform leave-one-out cross-validation.
Performs cross-validation using each sample as test data one at a time.
| X | Predictor matrix (each row is one sample) |
| y | Response variable vector |
Definition at line 366 of file model_selection.hpp.
| double statcpp::mad | ( | Iterator | first, |
| Iterator | last | ||
| ) |
Median Absolute Deviation (MAD)
Computes the median of absolute deviations from the median.
| Iterator | Iterator type |
| first | Beginning of range |
| last | End of range |
| std::invalid_argument | If range is empty |
Definition at line 42 of file robust.hpp.
| double statcpp::mad_scaled | ( | Iterator | first, |
| Iterator | last | ||
| ) |
Scaled MAD for normal distribution.
Computes MAD scaled to estimate standard deviation for normal distribution.
| Iterator | Iterator type |
| first | Beginning of range |
| last | End of range |
| std::invalid_argument | If range is empty |
This factor is exact only when the data follows a normal distribution. For non-normal distributions, the standard deviation estimate using this factor is an approximation.
Definition at line 93 of file robust.hpp.
| double statcpp::mae | ( | Iterator1 | first1, |
| Iterator1 | last1, | ||
| Iterator2 | first2 | ||
| ) |
Mean Absolute Error (MAE)
Calculates the mean absolute error between actual and predicted values.
| Iterator1 | RandomAccessIterator type for actual values |
| Iterator2 | RandomAccessIterator type for predicted values |
| first1 | Beginning iterator of actual values |
| last1 | End iterator of actual values |
| first2 | Beginning iterator of predicted values |
| std::invalid_argument | If range is empty |
Definition at line 207 of file time_series.hpp.
|
inline |
Mahalanobis distance.
Computes the Mahalanobis distance between a point and a distribution. This accounts for correlations in the data and is scale-invariant.
For a point x and a distribution with mean μ and covariance matrix Σ: d(x, μ) = sqrt((x - μ)ᵀ Σ⁻¹ (x - μ))
Current implementation supports 2-dimensional data only.
| x | Point to measure distance from |
| mean | Mean of the distribution |
| cov_matrix | Covariance matrix (2x2) |
| std::invalid_argument | if dimensions mismatch or covariance matrix is singular |
Definition at line 322 of file distance_metrics.hpp.
|
inline |
Manhattan distance.
Computes the Manhattan distance between two vectors.
| a | First vector |
| b | Second vector |
| std::invalid_argument | If vector dimensions mismatch |
Definition at line 63 of file clustering.hpp.
| double statcpp::manhattan_distance | ( | Iterator1 | first1, |
| Iterator1 | last1, | ||
| Iterator2 | first2, | ||
| Iterator2 | last2 | ||
| ) |
Manhattan distance (L1 norm, taxicab distance)
Computes the Manhattan distance between two points: d(x, y) = sum(|x_i - y_i|)
| Iterator1 | RandomAccessIterator type for first sequence |
| Iterator2 | RandomAccessIterator type for second sequence |
| first1 | Beginning of first sequence |
| last1 | End of first sequence |
| first2 | Beginning of second sequence |
| last2 | End of second sequence |
| std::invalid_argument | if sequences have different lengths |
Definition at line 108 of file distance_metrics.hpp.
| double statcpp::manhattan_distance | ( | Iterator1 | first1, |
| Iterator1 | last1, | ||
| Iterator2 | first2, | ||
| Iterator2 | last2, | ||
| Proj1 | proj1, | ||
| Proj2 | proj2 | ||
| ) |
Manhattan distance with projection.
Definition at line 139 of file distance_metrics.hpp.
| test_result statcpp::mann_whitney_u_test | ( | Iterator1 | first1, |
| Iterator1 | last1, | ||
| Iterator2 | first2, | ||
| Iterator2 | last2, | ||
| alternative_hypothesis | alt = alternative_hypothesis::two_sided, |
||
| bool | correct = true |
||
| ) |
Perform Mann-Whitney U test (two-sample)
Tests whether two independent samples come from the same distribution. Also known as Wilcoxon rank-sum test, a nonparametric test that does not assume normal distribution. Uses normal approximation for p-value calculation.
| Iterator1 | Iterator type for first sample |
| Iterator2 | Iterator type for second sample |
| first1 | Beginning iterator of first sample |
| last1 | Ending iterator of first sample |
| first2 | Beginning iterator of second sample |
| last2 | Ending iterator of second sample |
| alt | Type of alternative hypothesis (default: two-sided) |
| std::invalid_argument | If either sample has fewer than 2 elements |
Definition at line 672 of file nonparametric_tests.hpp.
| double statcpp::mape | ( | Iterator1 | first1, |
| Iterator1 | last1, | ||
| Iterator2 | first2 | ||
| ) |
Mean Absolute Percentage Error (MAPE)
Calculates the mean absolute percentage error between actual and predicted values.
| Iterator1 | RandomAccessIterator type for actual values |
| Iterator2 | RandomAccessIterator type for predicted values |
| first1 | Beginning iterator of actual values |
| last1 | End iterator of actual values |
| first2 | Beginning iterator of predicted values |
| std::invalid_argument | If range is empty or all actual values are zero |
Definition at line 285 of file time_series.hpp.
| double statcpp::margin_of_error_mean | ( | Iterator | first, |
| Iterator | last, | ||
| double | confidence, | ||
| Projection | proj | ||
| ) |
Calculate margin of error for mean (projection version)
| Iterator | Iterator type |
| Projection | Projection function type |
| first | Beginning iterator of data range |
| last | Ending iterator of data range |
| confidence | Confidence level |
| proj | Projection function |
| std::invalid_argument | If confidence level is outside (0, 1) or there are fewer than 2 elements |
Definition at line 499 of file estimation.hpp.
| double statcpp::margin_of_error_mean | ( | Iterator | first, |
| Iterator | last, | ||
| double | confidence = 0.95 |
||
| ) |
Calculate margin of error for mean.
MoE = t_{alpha/2, df} * SE
| Iterator | Iterator type |
| first | Beginning iterator of data range |
| last | Ending iterator of data range |
| confidence | Confidence level (default: 0.95) |
| std::invalid_argument | If confidence level is outside (0, 1) or there are fewer than 2 elements |
Definition at line 467 of file estimation.hpp.
|
inline |
Calculate margin of error for proportion.
MoE = z_{alpha/2} * sqrt(p(1-p)/n)
| successes | Number of successes |
| n | Sample size |
| confidence | Confidence level (default: 0.95) |
| std::invalid_argument | If confidence level is outside (0, 1), n is 0, or successes exceeds n |
Definition at line 529 of file estimation.hpp.
|
inline |
Calculate worst-case margin of error for proportion.
Maximum at p=0.5: MoE = z_{alpha/2} * 0.5/sqrt(n)
| n | Sample size |
| confidence | Confidence level (default: 0.95) |
| std::invalid_argument | If confidence level is outside (0, 1) or n is 0 |
Definition at line 560 of file estimation.hpp.
| auto statcpp::maximum | ( | Iterator | first, |
| Iterator | last | ||
| ) |
Return maximum value.
| Iterator | Iterator type |
| first | Beginning of range |
| last | End of range |
| std::invalid_argument | If range is empty |
Definition at line 177 of file order_statistics.hpp.
| auto statcpp::maximum | ( | Iterator | first, |
| Iterator | last, | ||
| Projection | proj | ||
| ) |
Return maximum value with projection.
| Iterator | Iterator type |
| Projection | Projection function type |
| first | Beginning of range |
| last | End of range |
| proj | Projection function |
| std::invalid_argument | If range is empty |
Definition at line 197 of file order_statistics.hpp.
| double statcpp::mean | ( | Iterator | first, |
| Iterator | last | ||
| ) |
Arithmetic mean.
Computes the arithmetic mean of elements in the range.
| Iterator | Iterator type |
| first | Begin iterator |
| last | End iterator |
| std::invalid_argument | If range is empty |
Definition at line 112 of file basic_statistics.hpp.
| double statcpp::mean | ( | Iterator | first, |
| Iterator | last, | ||
| Projection | proj | ||
| ) |
Arithmetic mean of projected values using a lambda expression.
Computes the arithmetic mean of the results after applying a projection function to each element.
| Iterator | Iterator type |
| Projection | Projection function type |
| first | Begin iterator |
| last | End iterator |
| proj | Projection function |
| std::invalid_argument | If range is empty |
Definition at line 139 of file basic_statistics.hpp.
| double statcpp::mean_absolute_deviation | ( | Iterator | first, |
| Iterator | last | ||
| ) |
Mean absolute deviation.
Computes the mean of absolute deviations from the mean. A measure of dispersion less sensitive to outliers than variance.
| Iterator | Iterator type |
| first | Begin iterator |
| last | End iterator |
| std::invalid_argument | If the range is empty |
Definition at line 1010 of file dispersion_spread.hpp.
| double statcpp::mean_absolute_deviation | ( | Iterator | first, |
| Iterator | last, | ||
| double | precomputed_mean | ||
| ) |
Mean absolute deviation using precomputed mean.
Computes mean absolute deviation when the mean has been precomputed.
| Iterator | Iterator type |
| first | Begin iterator |
| last | End iterator |
| precomputed_mean | Precomputed mean value |
| std::invalid_argument | If the range is empty |
Definition at line 1037 of file dispersion_spread.hpp.
| double statcpp::mean_absolute_deviation | ( | Iterator | first, |
| Iterator | last, | ||
| Projection | proj | ||
| ) |
Mean absolute deviation of projected values using a lambda expression.
Computes the mean absolute deviation of results after applying a projection function to each element.
| Iterator | Iterator type |
| Projection | Projection function type |
| first | Begin iterator |
| last | End iterator |
| proj | Projection function |
| std::invalid_argument | If the range is empty |
Definition at line 1067 of file dispersion_spread.hpp.
| double statcpp::mean_absolute_deviation | ( | Iterator | first, |
| Iterator | last, | ||
| Projection | proj, | ||
| double | precomputed_mean | ||
| ) |
Mean absolute deviation of projected values using precomputed mean.
Computes mean absolute deviation using a projection function and precomputed mean.
| Iterator | Iterator type |
| Projection | Projection function type |
| first | Begin iterator |
| last | End iterator |
| proj | Projection function |
| precomputed_mean | Precomputed mean value |
| std::invalid_argument | If the range is empty |
Definition at line 1096 of file dispersion_spread.hpp.
| double statcpp::median | ( | Iterator | first, |
| Iterator | last | ||
| ) |
Median (accepts a sorted range)
Computes the median of a sorted range. Returns the average of the two middle values if the number of elements is even.
| Iterator | Iterator type |
| first | Begin iterator |
| last | End iterator |
| std::invalid_argument | If range is empty |
Definition at line 169 of file basic_statistics.hpp.
| double statcpp::median | ( | Iterator | first, |
| Iterator | last, | ||
| Projection | proj | ||
| ) |
Median of projected values using a lambda expression (projection results must be in sorted order)
Computes the median of the results after applying a projection function to each element. Assumes that projection results are sorted.
| Iterator | Iterator type |
| Projection | Projection function type |
| first | Begin iterator |
| last | End iterator |
| proj | Projection function |
| std::invalid_argument | If range is empty |
Definition at line 204 of file basic_statistics.hpp.
|
inline |
Calculate median survival time.
Returns the time at which survival probability reaches 50%. Returns NaN if 50% is not reached.
| km | Kaplan-Meier estimation result |
Definition at line 286 of file survival.hpp.
|
inline |
Min-Max normalization (0-1 scaling)
Scales each variable to the [0, 1] range. Data is passed with rows=observations and columns=variables.
| data | Matrix data (rows=observations, columns=variables) |
| std::invalid_argument | If data is empty, rows have different column counts, or any variable has zero range |
Definition at line 198 of file multivariate.hpp.
| auto statcpp::minimum | ( | Iterator | first, |
| Iterator | last | ||
| ) |
Return minimum value.
| Iterator | Iterator type |
| first | Beginning of range |
| last | End of range |
| std::invalid_argument | If range is empty |
Definition at line 128 of file order_statistics.hpp.
| auto statcpp::minimum | ( | Iterator | first, |
| Iterator | last, | ||
| Projection | proj | ||
| ) |
Return minimum value with projection.
| Iterator | Iterator type |
| Projection | Projection function type |
| first | Beginning of range |
| last | End of range |
| proj | Projection function |
| std::invalid_argument | If range is empty |
Definition at line 148 of file order_statistics.hpp.
| double statcpp::minkowski_distance | ( | Iterator1 | first1, |
| Iterator1 | last1, | ||
| Iterator2 | first2, | ||
| Iterator2 | last2, | ||
| double | p | ||
| ) |
Minkowski distance (generalized Lp distance)
Computes the Minkowski distance with parameter p: d(x, y) = (sum(|x_i - y_i|^p))^(1/p)
Special cases:
| Iterator1 | RandomAccessIterator type for first sequence |
| Iterator2 | RandomAccessIterator type for second sequence |
| first1 | Beginning of first sequence |
| last1 | End of first sequence |
| first2 | Beginning of second sequence |
| last2 | End of second sequence |
| p | The order of the Minkowski distance (must be >= 1) |
| std::invalid_argument | if sequences have different lengths or p < 1 |
Definition at line 401 of file distance_metrics.hpp.
| double statcpp::minkowski_distance | ( | Iterator1 | first1, |
| Iterator1 | last1, | ||
| Iterator2 | first2, | ||
| Iterator2 | last2, | ||
| double | p, | ||
| Proj1 | proj1, | ||
| Proj2 | proj2 | ||
| ) |
Minkowski distance with projection.
Definition at line 437 of file distance_metrics.hpp.
| auto statcpp::mode | ( | Iterator | first, |
| Iterator | last | ||
| ) |
Mode (returns the smallest value when there are multiple modes: guarantees deterministic behavior)
Returns the most frequent value in the range. When there are multiple modes, returns the smallest value.
| Iterator | Iterator type |
| first | Begin iterator |
| last | End iterator |
| std::invalid_argument | If range is empty |
Definition at line 242 of file basic_statistics.hpp.
| auto statcpp::mode | ( | Iterator | first, |
| Iterator | last, | ||
| Projection | proj | ||
| ) |
Mode of projected values using a lambda expression.
Returns the most frequent value after applying a projection function to each element. When there are multiple modes, returns the smallest value.
| Iterator | Iterator type |
| Projection | Projection function type |
| first | Begin iterator |
| last | End iterator |
| proj | Projection function |
| std::invalid_argument | If range is empty |
Definition at line 286 of file basic_statistics.hpp.
| auto statcpp::modes | ( | Iterator | first, |
| Iterator | last | ||
| ) | -> std::vector<typename std::iterator_traits<Iterator>::value_type> |
Returns all modes (returns a vector sorted in ascending order)
Returns all most frequent values in the range. When there are multiple modes, returns all of them in ascending order as a vector.
| Iterator | Iterator type |
| first | Begin iterator |
| last | End iterator |
| std::invalid_argument | If range is empty |
Definition at line 334 of file basic_statistics.hpp.
| auto statcpp::modes | ( | Iterator | first, |
| Iterator | last, | ||
| Projection | proj | ||
| ) | -> std::vector<std::invoke_result_t<Projection, typename std::iterator_traits<Iterator>::value_type>> |
Returns all modes of projected values using a lambda expression.
Returns all most frequent values after applying a projection function to each element. When there are multiple modes, returns all of them in ascending order as a vector.
| Iterator | Iterator type |
| Projection | Projection function type |
| first | Begin iterator |
| last | End iterator |
| proj | Projection function |
| std::invalid_argument | If range is empty |
Definition at line 389 of file basic_statistics.hpp.
| std::vector< double > statcpp::moving_average | ( | Iterator | first, |
| Iterator | last, | ||
| std::size_t | window | ||
| ) |
Simple moving average.
Calculates the simple moving average with the specified window size.
| Iterator | RandomAccessIterator type |
| first | Beginning iterator |
| last | End iterator |
| window | Window size |
| std::invalid_argument | If range is empty or window size is invalid |
Definition at line 328 of file time_series.hpp.
| double statcpp::mse | ( | Iterator1 | first1, |
| Iterator1 | last1, | ||
| Iterator2 | first2 | ||
| ) |
Mean Squared Error (MSE)
Calculates the mean squared error between actual and predicted values.
| Iterator1 | RandomAccessIterator type for actual values |
| Iterator2 | RandomAccessIterator type for predicted values |
| first1 | Beginning iterator of actual values |
| last1 | End iterator of actual values |
| first2 | Beginning iterator of predicted values |
| std::invalid_argument | If range is empty |
Definition at line 237 of file time_series.hpp.
|
inline |
Calculate multicollinearity score.
Score ranges from 0 to 1, with values closer to 1 indicating stronger multicollinearity. Calculated as Score = 1 - |det(R)|.
| X | Predictor matrix (n x p) |
| std::invalid_argument | If there are fewer than 2 observations |
| std::invalid_argument | If there are fewer than 2 or more than 3 predictors |
Definition at line 1098 of file linear_regression.hpp.
|
inline |
Multiple imputation (simplified Bootstrap EM method)
Performs multiple imputation combining bootstrap sampling with stochastic imputation from normal distribution. Results are pooled based on Rubin's rules.
| data | Input data (rows: observations, columns: variables) |
| m | Number of imputations (default: 5) |
| seed | Random seed (0 for random seed) |
| std::invalid_argument | If data is empty |
Definition at line 646 of file missing_data.hpp.
|
inline |
Multiple imputation (PMM: Predictive Mean Matching)
Performs multiple imputation using Predictive Mean Matching method. Randomly selects a donor from k observations closest to the predicted value. Results are pooled based on Rubin's rules.
| data | Input data (rows: observations, columns: variables) |
| m | Number of imputations (default: 5) |
| seed | Random seed (0 for random seed) |
| std::invalid_argument | If data is empty |
Definition at line 480 of file missing_data.hpp.
|
inline |
Perform multiple linear regression.
Estimates multiple regression model y = b0 + b1*x1 + ... + bp*xp using least squares method. The intercept is added automatically, so X should not contain an intercept column.
| X | Predictor matrix (n x p). Each row is one observation, each column is one predictor |
| y | Response variable vector (n-dimensional) |
| std::invalid_argument | If data is empty |
| std::invalid_argument | If X and Y have different numbers of observations |
| std::invalid_argument | If number of predictors is greater than or equal to number of observations |
| std::invalid_argument | If X contains an intercept column (all 1s column) |
Definition at line 523 of file linear_regression.hpp.
|
inline |
Negative binomial distribution cumulative distribution function (CDF)
P(X <= k) = I_p(r, k+1) (using incomplete beta function)
| k | Upper bound of failures |
| r | Number of successes required |
| p | Probability of success |
| std::invalid_argument | If r <= 0 or p is outside (0, 1] |
Definition at line 629 of file discrete_distributions.hpp.
|
inline |
Negative binomial distribution probability mass function (PMF)
P(X = k) = C(k+r-1, k) * p^r * (1-p)^k X = Number of failures before r successes (support: k = 0, 1, 2, ...)
| k | Number of failures |
| r | Number of successes required (dispersion parameter, > 0, can be non-integer) |
| p | Probability of success |
| std::invalid_argument | If r <= 0 or p is outside (0, 1] |
There is also a "mean-dispersion" parameterization:
Definition at line 603 of file discrete_distributions.hpp.
|
inline |
Negative binomial distribution quantile function (inverse CDF)
| prob | Cumulative probability |
| r | Number of successes required |
| p | Probability of success |
| std::invalid_argument | If parameters are outside valid range |
Definition at line 651 of file discrete_distributions.hpp.
|
inline |
Negative binomial distribution random number generation (using default engine)
| r | Number of successes required |
| p | Probability of success |
Definition at line 727 of file discrete_distributions.hpp.
| std::uint64_t statcpp::nbinom_rand | ( | double | r, |
| double | p, | ||
| Engine & | engine | ||
| ) |
Negative binomial distribution random number generation.
Generated as a Poisson-Gamma mixture.
| Engine | Random engine type |
| r | Number of successes required |
| p | Probability of success |
| engine | Random engine |
| std::invalid_argument | If parameters are outside valid range |
Definition at line 703 of file discrete_distributions.hpp.
|
inline |
Nelson-Aalen cumulative hazard estimation.
Estimates the cumulative hazard function H(t) using the Nelson-Aalen estimator. Handles survival time data with censoring.
Relationship between cumulative hazard and survival function:
Advantages of Nelson-Aalen estimation:
| times | Vector of observation times |
| events | Event occurrence flags (true = event occurred, false = censored) |
| std::invalid_argument | If times and events have different sizes or data is empty |
Definition at line 337 of file survival.hpp.
|
inline |
Standard normal CDF.
Computes the cumulative distribution function Phi(x) of the standard normal distribution.
| x | Argument |
Definition at line 394 of file special_functions.hpp.
|
inline |
Standard normal quantile function.
Computes the quantile function Phi^{-1}(p) of the standard normal distribution.
| p | Probability (must be in (0, 1)) |
Definition at line 410 of file special_functions.hpp.
|
inline |
Normal distribution cumulative distribution function (CDF)
F(x) = Phi((x - mu) / sigma)
| x | Random variable value |
| mu | Mean (default: 0.0) |
| sigma | Standard deviation (default: 1.0) |
| std::invalid_argument | If sigma <= 0 |
Definition at line 159 of file continuous_distributions.hpp.
|
inline |
Normal distribution probability density function (PDF)
f(x) = (1 / (sigma * sqrt(2 * pi))) * exp(-(x-mu)^2/(2*sigma^2))
| x | Random variable value |
| mu | Mean (default: 0.0) |
| sigma | Standard deviation (default: 1.0) |
| std::invalid_argument | If sigma <= 0 |
Definition at line 139 of file continuous_distributions.hpp.
|
inline |
Normal distribution quantile function (inverse CDF, percent point function)
Returns the quantile (percentile value) corresponding to probability p. Q(p) = mu + sigma * Phi^(-1)(p)
where Phi^(-1)(p) is the inverse cumulative distribution function of the standard normal distribution (probit function). Example: Q(0.975) is approximately mu + 1.96*sigma (upper bound of 95% confidence interval)
| p | Probability (0 < p < 1) |
| mu | Mean (default: 0.0) |
| sigma | Standard deviation (default: 1.0) |
| std::invalid_argument | If sigma <= 0 or p is outside (0, 1) |
Definition at line 185 of file continuous_distributions.hpp.
| double statcpp::normal_rand | ( | double | mu, |
| double | sigma, | ||
| Engine & | engine | ||
| ) |
Normal distribution random number generation.
| Engine | Random engine type |
| mu | Mean |
| sigma | Standard deviation |
| engine | Random engine |
| std::invalid_argument | If sigma <= 0 |
Definition at line 209 of file continuous_distributions.hpp.
|
inline |
Normal distribution random number generation (using default engine)
| mu | Mean (default: 0.0) |
| sigma | Standard deviation (default: 1.0) |
Definition at line 225 of file continuous_distributions.hpp.
|
inline |
Calculate Number Needed to Treat (NNT)
Calculated as the reciprocal of the risk difference. Represents the number of patients that need to be treated to prevent one outcome.
| table | 2x2 contingency table |
| std::invalid_argument | If risk difference is zero |
Definition at line 331 of file categorical.hpp.
|
inline |
Calculate odds ratio from a 2x2 contingency table.
Calculates the odds ratio and its confidence interval. Odds ratio = (a * d) / (b * c)
| table | 2x2 contingency table in the form [[a, b], [c, d]]
|
| std::invalid_argument | If table is not 2x2 or if cell count is zero |
Definition at line 115 of file categorical.hpp.
|
inline |
Odds ratio.
Calculates the odds ratio from a 2x2 contingency table.
| a | Cell (1,1) frequency (exposed, disease present) |
| b | Cell (1,2) frequency (exposed, disease absent) |
| c | Cell (2,1) frequency (unexposed, disease present) |
| d | Cell (2,2) frequency (unexposed, disease absent) |
| std::invalid_argument | If b or c is zero |
Definition at line 381 of file effect_size.hpp.
|
inline |
Calculate odds ratio from a 2x2 contingency table (specifying cell values directly)
| a | Exposed and diseased |
| b | Exposed and not diseased |
| c | Not exposed and diseased |
| d | Not exposed and not diseased |
| std::invalid_argument | If cell count is zero |
Definition at line 152 of file categorical.hpp.
|
inline |
Calculate odds ratios.
Calculates odds ratios from logistic regression model coefficients.
| model | Fitted logistic regression model |
| std::invalid_argument | If model is not logistic regression |
|
inline |
Confidence intervals for odds ratios.
Calculates confidence intervals for odds ratios from a logistic regression model.
| model | Fitted logistic regression model |
| confidence | Confidence level (default: 0.95) |
| std::invalid_argument | If model is not logistic regression or confidence level is outside (0,1) |
|
inline |
|
inline |
Omega-squared.
A less biased estimate of effect size than eta-squared.
| ss_effect | Sum of squares for effect |
| ss_total | Total sum of squares |
| ms_error | Mean square error |
| df_effect | Degrees of freedom for effect |
| std::invalid_argument | If ss_total is not positive |
Definition at line 333 of file effect_size.hpp.
| std::vector< std::vector< double > > statcpp::one_hot_encode | ( | const std::vector< T > & | data | ) |
One-hot encoding.
| T | Data type |
| data | Data vector |
Definition at line 1001 of file data_wrangling.hpp.
|
inline |
Perform one-way analysis of covariance.
Tests differences in group means while controlling for the effect of a covariate. Each observation is specified as a pair of dependent variable (y) and covariate (x).
| groups | Data for each group. groups[i] is a vector of (y, x) pairs for group i |
| std::invalid_argument | If number of groups is less than 2 |
| std::invalid_argument | If an empty group exists |
| std::invalid_argument | If number of observations is insufficient |
|
inline |
Perform one-way analysis of variance.
Tests whether there are significant differences in means among multiple groups. Uses F-test to compare between-group and within-group variation.
| groups | Vector of vectors containing data for each group |
| std::invalid_argument | If number of groups is less than 2 |
| std::invalid_argument | If an empty group exists |
| std::invalid_argument | If total number of observations is less than or equal to number of groups |
|
inline |
Overdispersion test (for Poisson regression)
Calculates the overdispersion parameter for a Poisson regression model. Values greater than 1 suggest the presence of overdispersion.
| model | Fitted Poisson regression model |
| X | Predictor matrix |
| y | Response variable vector |
| std::invalid_argument | If model is not Poisson |
| std::vector< double > statcpp::pacf | ( | Iterator | first, |
| Iterator | last, | ||
| std::size_t | max_lag | ||
| ) |
Calculate partial autocorrelation function (PACF) (Durbin-Levinson algorithm)
Calculates PACF using the Durbin-Levinson algorithm.
| Iterator | RandomAccessIterator type |
| first | Beginning iterator |
| last | End iterator |
| max_lag | Maximum lag |
| std::invalid_argument | If range is empty |
Definition at line 134 of file time_series.hpp.
|
inline |
Calculate partial eta-squared from F-test.
| f | F-statistic |
| df1 | Numerator degrees of freedom |
| df2 | Denominator degrees of freedom |
Definition at line 312 of file effect_size.hpp.
|
inline |
|
inline |
|
inline |
Calculate Partial eta-squared for interaction in two-way ANOVA.
Indicates the proportion of interaction effect relative to the sum of interaction effect and error.
| result | Result from two-way ANOVA |
|
inline |
Principal Component Analysis.
Finds principal components through eigenvalue decomposition of the covariance matrix. Uses deflation method to compute multiple principal components.
| data | Matrix data (rows=observations, columns=variables) |
| n_components | Number of principal components to extract |
| std::invalid_argument | If data is empty or rows have different column counts |
Definition at line 325 of file multivariate.hpp.
|
inline |
Project data onto principal component space.
Transforms data to principal component space using PCA results.
| data | Matrix data (rows=observations, columns=variables) |
| pca | PCA result |
| std::invalid_argument | If data is empty, PCA components are empty, or dimensions don't match |
Definition at line 385 of file multivariate.hpp.
| double statcpp::pearson_correlation | ( | Iterator1 | first1, |
| Iterator1 | last1, | ||
| Iterator2 | first2, | ||
| Iterator2 | last2 | ||
| ) |
Pearson correlation coefficient.
Computes the Pearson product-moment correlation coefficient of two variables. r = Cov(X, Y) / (sigma_x * sigma_y) Values range from -1 to 1, where 1 indicates perfect positive correlation and -1 indicates perfect negative correlation.
| Iterator1 | Iterator type for the first data |
| Iterator2 | Iterator type for the second data |
| first1 | Begin iterator for the first data |
| last1 | End iterator for the first data |
| first2 | Begin iterator for the second data |
| last2 | End iterator for the second data |
| std::invalid_argument | If range is empty, lengths differ, number of elements is less than 2, or variance of either variable is zero |
Definition at line 376 of file correlation_covariance.hpp.
| double statcpp::pearson_correlation | ( | Iterator1 | first1, |
| Iterator1 | last1, | ||
| Iterator2 | first2, | ||
| Iterator2 | last2, | ||
| double | mean_x, | ||
| double | mean_y | ||
| ) |
Pearson correlation coefficient with precomputed means.
| Iterator1 | Iterator type for the first data |
| Iterator2 | Iterator type for the second data |
| first1 | Begin iterator for the first data |
| last1 | End iterator for the first data |
| first2 | Begin iterator for the second data |
| last2 | End iterator for the second data |
| mean_x | Mean of the first data |
| mean_y | Mean of the second data |
| std::invalid_argument | If range is empty, lengths differ, number of elements is less than 2, or variance of either variable is zero |
Definition at line 432 of file correlation_covariance.hpp.
| double statcpp::pearson_correlation | ( | Iterator1 | first1, |
| Iterator1 | last1, | ||
| Iterator2 | first2, | ||
| Iterator2 | last2, | ||
| Projection1 | proj1, | ||
| Projection2 | proj2 | ||
| ) |
Pearson correlation coefficient (projection version)
| Iterator1 | Iterator type for the first data |
| Iterator2 | Iterator type for the second data |
| Projection1 | Projection function type for the first data |
| Projection2 | Projection function type for the second data |
| first1 | Begin iterator for the first data |
| last1 | End iterator for the first data |
| first2 | Begin iterator for the second data |
| last2 | End iterator for the second data |
| proj1 | Projection function for the first data |
| proj2 | Projection function for the second data |
| std::invalid_argument | If range is empty, lengths differ, number of elements is less than 2, or variance of either variable is zero |
Definition at line 488 of file correlation_covariance.hpp.
| double statcpp::percentile | ( | Iterator | first, |
| Iterator | last, | ||
| double | p | ||
| ) |
Return percentile.
Calculates specified percentile from sorted range.
| Iterator | Iterator type |
| first | Beginning of sorted range |
| last | End of sorted range |
| p | Percentile as proportion 0.0-1.0 (e.g., 90th percentile -> p = 0.9) |
| std::invalid_argument | If range is empty or p is out of range |
Definition at line 285 of file order_statistics.hpp.
| double statcpp::percentile | ( | Iterator | first, |
| Iterator | last, | ||
| double | p, | ||
| Projection | proj | ||
| ) |
Return percentile with projection.
| Iterator | Iterator type |
| Projection | Projection function type |
| first | Beginning of sorted range |
| last | End of sorted range |
| p | Percentile as proportion 0.0-1.0 |
| proj | Projection function |
| std::invalid_argument | If range is empty or p is out of range |
Definition at line 310 of file order_statistics.hpp.
| permutation_result statcpp::permutation_test_correlation | ( | Iterator1 | first1, |
| Iterator1 | last1, | ||
| Iterator2 | first2, | ||
| Iterator2 | last2, | ||
| std::size_t | n_permutations = 10000, |
||
| Engine & | engine = get_random_engine() |
||
| ) |
Perform permutation test for correlation.
Performs a permutation test for Pearson correlation coefficient between two variables. Generates the null distribution by shuffling one variable. The null hypothesis is "there is no correlation between the two variables (correlation is 0)". Computes two-sided p-value.
| Iterator1 | Iterator type for first variable |
| Iterator2 | Iterator type for second variable |
| Engine | Random engine type (default: default_random_engine) |
| first1 | Beginning iterator of first variable |
| last1 | End iterator of first variable |
| first2 | Beginning iterator of second variable |
| last2 | End iterator of second variable |
| n_permutations | Number of permutations (default: 10000) |
| engine | Reference to random engine |
| std::invalid_argument | If the two variables have different lengths |
| std::invalid_argument | If number of data pairs is less than 3 |
Definition at line 625 of file resampling.hpp.
| permutation_result statcpp::permutation_test_paired | ( | Iterator1 | first1, |
| Iterator1 | last1, | ||
| Iterator2 | first2, | ||
| Iterator2 | last2, | ||
| std::size_t | n_permutations = 10000, |
||
| Engine & | engine = get_random_engine() |
||
| ) |
Perform paired permutation test.
Performs a permutation test for differences between two paired samples. Generates the null distribution by randomly flipping the signs of differences. The null hypothesis is "the mean of differences is zero". Computes two-sided p-value.
P-value calculation uses the inclusive method: p = (count(|T*| >= |T_obs|) + 1) / (n_permutations + 1)
| Iterator1 | Iterator type for first sample |
| Iterator2 | Iterator type for second sample |
| Engine | Random engine type (default: default_random_engine) |
| first1 | Beginning iterator of first sample |
| last1 | End iterator of first sample |
| first2 | Beginning iterator of second sample |
| last2 | End iterator of second sample |
| n_permutations | Number of permutations (default: 10000) |
| engine | Reference to random engine |
| std::invalid_argument | If the two samples have different lengths |
| std::invalid_argument | If samples are empty |
Definition at line 538 of file resampling.hpp.
| permutation_result statcpp::permutation_test_two_sample | ( | Iterator1 | first1, |
| Iterator1 | last1, | ||
| Iterator2 | first2, | ||
| Iterator2 | last2, | ||
| std::size_t | n_permutations = 10000, |
||
| Engine & | engine = get_random_engine() |
||
| ) |
Perform two-sample permutation test (test of difference in means)
Performs a permutation test for the difference in means between two independent samples. The null hypothesis is "the two group means are equal". Computes two-sided p-value.
P-value calculation uses the inclusive method: p = (count(|T*| >= |T_obs|) + 1) / (n_permutations + 1) This includes the observed data itself as part of the null distribution, preventing p-values from being zero (Phipson & Smyth, 2010).
| Iterator1 | Iterator type for first sample |
| Iterator2 | Iterator type for second sample |
| Engine | Random engine type (default: default_random_engine) |
| first1 | Beginning iterator of first sample |
| last1 | End iterator of first sample |
| first2 | Beginning iterator of second sample |
| last2 | End iterator of second sample |
| n_permutations | Number of permutations (default: 10000) |
| engine | Reference to random engine |
| std::invalid_argument | If either sample is empty |
Definition at line 457 of file resampling.hpp.
|
inline |
Poisson distribution cumulative distribution function (CDF)
Calculates P(X <= k).
| k | Upper bound of number of event occurrences |
| lambda | Mean rate |
| std::invalid_argument | If lambda is negative |
Definition at line 228 of file discrete_distributions.hpp.
|
inline |
Poisson distribution probability mass function (PMF)
P(X = k) = (lambda^k * e^(-lambda)) / k!
| k | Number of event occurrences |
| lambda | Mean rate (lambda > 0) |
| std::invalid_argument | If lambda is negative |
Definition at line 207 of file discrete_distributions.hpp.
|
inline |
Poisson distribution quantile function.
| p | Probability value |
| lambda | Mean rate |
| std::invalid_argument | If lambda is negative or p is in an invalid range |
Definition at line 247 of file discrete_distributions.hpp.
|
inline |
Poisson distribution random number generation (using default engine)
| lambda | Mean rate |
Definition at line 306 of file discrete_distributions.hpp.
| std::uint64_t statcpp::poisson_rand | ( | double | lambda, |
| Engine & | engine | ||
| ) |
Poisson distribution random number generation.
| Engine | Random engine type |
| lambda | Mean rate |
| engine | Random engine |
| std::invalid_argument | If lambda is negative |
Definition at line 291 of file discrete_distributions.hpp.
|
inline |
Poisson regression.
Fits a generalized linear model using Poisson distribution and log link function. Used for regression analysis of count data.
| X | Predictor matrix (intercept is added automatically) |
| y | Response variable vector (non-negative count data) |
| max_iter | Maximum number of iterations (default: 100) |
| tol | Convergence tolerance (default: 1e-8) |
| std::invalid_argument | If y is negative or X contains an intercept column |
| double statcpp::population_covariance | ( | Iterator1 | first1, |
| Iterator1 | last1, | ||
| Iterator2 | first2, | ||
| Iterator2 | last2 | ||
| ) |
Population covariance.
Computes the population covariance of two variables. Cov(X, Y) = E[(X - mu_x)(Y - mu_y)] = (1/n) * sum((x_i - x_bar)(y_i - y_bar))
| Iterator1 | Iterator type for the first data |
| Iterator2 | Iterator type for the second data |
| first1 | Begin iterator for the first data |
| last1 | End iterator for the first data |
| first2 | Begin iterator for the second data |
| last2 | End iterator for the second data |
| std::invalid_argument | If range is empty or lengths differ |
Definition at line 46 of file correlation_covariance.hpp.
| double statcpp::population_covariance | ( | Iterator1 | first1, |
| Iterator1 | last1, | ||
| Iterator2 | first2, | ||
| Iterator2 | last2, | ||
| double | mean_x, | ||
| double | mean_y | ||
| ) |
Population covariance with precomputed means.
| Iterator1 | Iterator type for the first data |
| Iterator2 | Iterator type for the second data |
| first1 | Begin iterator for the first data |
| last1 | End iterator for the first data |
| first2 | Begin iterator for the second data |
| last2 | End iterator for the second data |
| mean_x | Mean of the first data |
| mean_y | Mean of the second data |
| std::invalid_argument | If range is empty or lengths differ |
Definition at line 87 of file correlation_covariance.hpp.
| double statcpp::population_covariance | ( | Iterator1 | first1, |
| Iterator1 | last1, | ||
| Iterator2 | first2, | ||
| Iterator2 | last2, | ||
| Projection1 | proj1, | ||
| Projection2 | proj2 | ||
| ) |
Population covariance (projection version)
| Iterator1 | Iterator type for the first data |
| Iterator2 | Iterator type for the second data |
| Projection1 | Projection function type for the first data |
| Projection2 | Projection function type for the second data |
| first1 | Begin iterator for the first data |
| last1 | End iterator for the first data |
| first2 | Begin iterator for the second data |
| last2 | End iterator for the second data |
| proj1 | Projection function for the first data |
| proj2 | Projection function for the second data |
| std::invalid_argument | If range is empty or lengths differ |
Definition at line 128 of file correlation_covariance.hpp.
| double statcpp::population_kurtosis | ( | Iterator | first, |
| Iterator | last | ||
| ) |
Calculate population kurtosis (Excess Kurtosis)
Calculates the kurtosis of a population. An indicator of tail heaviness.
Formula: g2 = E[(X - mu)^4] / sigma^4 - 3 Subtracts 3 so that normal distribution kurtosis is 0 (excess kurtosis)
| Iterator | Input iterator type |
| first | Beginning iterator of data range |
| last | End iterator of data range |
| std::invalid_argument | If range is empty or variance is zero |
Definition at line 375 of file shape_of_distribution.hpp.
| double statcpp::population_kurtosis | ( | Iterator | first, |
| Iterator | last, | ||
| double | precomputed_mean | ||
| ) |
Calculate population kurtosis with precomputed mean.
| Iterator | Input iterator type |
| first | Beginning iterator of data range |
| last | End iterator of data range |
| precomputed_mean | Precomputed mean value |
| std::invalid_argument | If range is empty or variance is zero |
Definition at line 413 of file shape_of_distribution.hpp.
| double statcpp::population_kurtosis | ( | Iterator | first, |
| Iterator | last, | ||
| Projection | proj | ||
| ) |
Calculate population kurtosis with projection.
| Iterator | Input iterator type |
| Projection | Projection function type |
| first | Beginning iterator of data range |
| last | End iterator of data range |
| proj | Projection function |
| std::invalid_argument | If range is empty or variance is zero |
Definition at line 454 of file shape_of_distribution.hpp.
| double statcpp::population_kurtosis | ( | Iterator | first, |
| Iterator | last, | ||
| Projection | proj, | ||
| double | precomputed_mean | ||
| ) |
Calculate population kurtosis with projection and precomputed mean.
| Iterator | Input iterator type |
| Projection | Projection function type |
| first | Beginning iterator of data range |
| last | End iterator of data range |
| proj | Projection function |
| precomputed_mean | Precomputed mean value |
| std::invalid_argument | If range is empty or variance is zero |
Definition at line 494 of file shape_of_distribution.hpp.
| double statcpp::population_skewness | ( | Iterator | first, |
| Iterator | last | ||
| ) |
Calculate population skewness (Fisher's definition)
Calculates the skewness of a population. An indicator of distribution asymmetry.
Formula: g1 = E[(X - mu)^3] / sigma^3
| Iterator | Input iterator type |
| first | Beginning iterator of data range |
| last | End iterator of data range |
| std::invalid_argument | If range is empty or variance is zero |
Definition at line 42 of file shape_of_distribution.hpp.
| double statcpp::population_skewness | ( | Iterator | first, |
| Iterator | last, | ||
| double | precomputed_mean | ||
| ) |
Calculate population skewness with precomputed mean.
Use when the mean has already been calculated. Improves computational efficiency.
| Iterator | Input iterator type |
| first | Beginning iterator of data range |
| last | End iterator of data range |
| precomputed_mean | Precomputed mean value |
| std::invalid_argument | If range is empty or variance is zero |
Definition at line 81 of file shape_of_distribution.hpp.
| double statcpp::population_skewness | ( | Iterator | first, |
| Iterator | last, | ||
| Projection | proj | ||
| ) |
Calculate population skewness with projection.
Uses a projection function to extract specific values from the data to calculate skewness.
| Iterator | Input iterator type |
| Projection | Projection function type |
| first | Beginning iterator of data range |
| last | End iterator of data range |
| proj | Projection function |
| std::invalid_argument | If range is empty or variance is zero |
Definition at line 123 of file shape_of_distribution.hpp.
| double statcpp::population_skewness | ( | Iterator | first, |
| Iterator | last, | ||
| Projection | proj, | ||
| double | precomputed_mean | ||
| ) |
Calculate population skewness with projection and precomputed mean.
| Iterator | Input iterator type |
| Projection | Projection function type |
| first | Beginning iterator of data range |
| last | End iterator of data range |
| proj | Projection function |
| precomputed_mean | Precomputed mean value |
| std::invalid_argument | If range is empty or variance is zero |
Definition at line 162 of file shape_of_distribution.hpp.
| double statcpp::population_stddev | ( | Iterator | first, |
| Iterator | last | ||
| ) |
Population standard deviation.
Computes the population standard deviation (square root of variance divided by N).
| Iterator | Iterator type |
| first | Begin iterator |
| last | End iterator |
| std::invalid_argument | If the range is empty |
Definition at line 588 of file dispersion_spread.hpp.
| double statcpp::population_stddev | ( | Iterator | first, |
| Iterator | last, | ||
| double | precomputed_mean | ||
| ) |
Population standard deviation using precomputed mean.
Computes population standard deviation when the mean has been precomputed.
| Iterator | Iterator type |
| first | Begin iterator |
| last | End iterator |
| precomputed_mean | Precomputed mean value |
| std::invalid_argument | If the range is empty |
Definition at line 606 of file dispersion_spread.hpp.
| double statcpp::population_stddev | ( | Iterator | first, |
| Iterator | last, | ||
| Projection | proj | ||
| ) |
Population standard deviation of projected values using a lambda expression.
Computes the population standard deviation of results after applying a projection function to each element.
| Iterator | Iterator type |
| Projection | Projection function type |
| first | Begin iterator |
| last | End iterator |
| proj | Projection function |
| std::invalid_argument | If the range is empty |
Definition at line 628 of file dispersion_spread.hpp.
| double statcpp::population_stddev | ( | Iterator | first, |
| Iterator | last, | ||
| Projection | proj, | ||
| double | precomputed_mean | ||
| ) |
Population standard deviation of projected values using precomputed mean.
Computes population standard deviation using a projection function and precomputed mean.
| Iterator | Iterator type |
| Projection | Projection function type |
| first | Begin iterator |
| last | End iterator |
| proj | Projection function |
| precomputed_mean | Precomputed mean value |
| std::invalid_argument | If the range is empty |
Definition at line 648 of file dispersion_spread.hpp.
| double statcpp::population_variance | ( | Iterator | first, |
| Iterator | last | ||
| ) |
Population variance.
Computes the population variance (divide by N).
| Iterator | Iterator type |
| first | Begin iterator |
| last | End iterator |
| std::invalid_argument | If the range is empty |
Definition at line 258 of file dispersion_spread.hpp.
| double statcpp::population_variance | ( | Iterator | first, |
| Iterator | last, | ||
| double | precomputed_mean | ||
| ) |
Population variance using precomputed mean.
Computes population variance when the mean has been precomputed.
| Iterator | Iterator type |
| first | Begin iterator |
| last | End iterator |
| precomputed_mean | Precomputed mean value |
| std::invalid_argument | If the range is empty |
Definition at line 276 of file dispersion_spread.hpp.
| double statcpp::population_variance | ( | Iterator | first, |
| Iterator | last, | ||
| Projection | proj | ||
| ) |
Population variance of projected values using a lambda expression.
Computes the population variance of results after applying a projection function to each element.
| Iterator | Iterator type |
| Projection | Projection function type |
| first | Begin iterator |
| last | End iterator |
| proj | Projection function |
| std::invalid_argument | If the range is empty |
Definition at line 298 of file dispersion_spread.hpp.
| double statcpp::population_variance | ( | Iterator | first, |
| Iterator | last, | ||
| Projection | proj, | ||
| double | precomputed_mean | ||
| ) |
Population variance of projected values using precomputed mean.
Computes population variance using a projection function and precomputed mean.
| Iterator | Iterator type |
| Projection | Projection function type |
| first | Begin iterator |
| last | End iterator |
| proj | Projection function |
| precomputed_mean | Precomputed mean value |
| std::invalid_argument | If the range is empty |
Definition at line 318 of file dispersion_spread.hpp.
|
inline |
Power analysis for one-sample t-test (enum overload, returning struct)
| effect_size | Effect size |
| n | Sample size |
| alpha | Significance level (default: 0.05) |
| alt | Type of alternative hypothesis (default: two_sided) |
Definition at line 615 of file power_analysis.hpp.
|
inline |
Power analysis for one-sample t-test (calculate power)
| effect_size | Effect size |
| n | Sample size |
| alpha | Significance level (default: 0.05) |
| alternative | Type of alternative hypothesis (default: "two.sided") |
Definition at line 469 of file power_analysis.hpp.
|
inline |
Power analysis for one-sample t-test, sample size (enum overload, returning struct)
| effect_size | Effect size |
| power | Target power (default: 0.80) |
| alpha | Significance level (default: 0.05) |
| alt | Type of alternative hypothesis (default: two_sided) |
Definition at line 631 of file power_analysis.hpp.
|
inline |
Power analysis for one-sample t-test (calculate sample size)
| effect_size | Effect size |
| power | Target power (default: 0.80) |
| alpha | Significance level (default: 0.05) |
| alternative | Type of alternative hypothesis (default: "two.sided") |
Definition at line 490 of file power_analysis.hpp.
|
inline |
Find largest eigenvalue and eigenvector using power iteration.
Finds the largest eigenvalue and corresponding eigenvector of a matrix through iterative computation.
| matrix | Symmetric matrix |
| max_iter | Maximum number of iterations (default: 1000) |
| tol | Convergence threshold (default: 1e-10) |
Definition at line 259 of file multivariate.hpp.
|
inline |
Calculate power for two-sample proportion test (enum overload)
| p1 | Proportion of group 1 |
| p2 | Proportion of group 2 |
| n | Sample size per group |
| alpha | Significance level (default: 0.05) |
| alt | Type of alternative hypothesis (default: two_sided) |
Definition at line 582 of file power_analysis.hpp.
|
inline |
Calculate power for two-sample proportion test.
| p1 | Proportion of group 1 |
| p2 | Proportion of group 2 |
| n | Sample size per group |
| alpha | Significance level (default: 0.05) |
| alternative | Type of alternative hypothesis (default: "two.sided") |
| std::invalid_argument | If parameters are invalid |
Definition at line 355 of file power_analysis.hpp.
|
inline |
Calculate power for one-sample t-test (enum overload)
| effect_size | Effect size (Cohen's d) |
| n | Sample size |
| alpha | Significance level (default: 0.05) |
| alt | Type of alternative hypothesis (default: two_sided) |
Definition at line 515 of file power_analysis.hpp.
|
inline |
Calculate power for one-sample t-test.
| effect_size | Effect size (Cohen's d) |
| n | Sample size |
| alpha | Significance level (default: 0.05) |
| alternative | Type of alternative hypothesis: "two.sided", "greater", "less" (default: "two.sided") |
| std::invalid_argument | If parameters are invalid |
Definition at line 156 of file power_analysis.hpp.
|
inline |
Calculate power for two-sample t-test (enum overload)
| effect_size | Effect size (Cohen's d) |
| n1 | Sample size of group 1 |
| n2 | Sample size of group 2 |
| alpha | Significance level (default: 0.05) |
| alt | Type of alternative hypothesis (default: two_sided) |
Definition at line 548 of file power_analysis.hpp.
|
inline |
Calculate power for two-sample t-test.
| effect_size | Effect size (Cohen's d) |
| n1 | Sample size of group 1 |
| n2 | Sample size of group 2 |
| alpha | Significance level (default: 0.05) |
| alternative | Type of alternative hypothesis (default: "two.sided") |
| std::invalid_argument | If parameters are invalid |
Definition at line 255 of file power_analysis.hpp.
|
inline |
Make prediction using multiple regression model.
| model | Multiple regression analysis results |
| x | Predictor variable vector (do not include intercept) |
| std::invalid_argument | If x dimension doesn't match model's number of predictors |
Definition at line 662 of file linear_regression.hpp.
|
inline |
Make prediction using simple regression model.
| model | Simple regression analysis results |
| x | Predictor variable value |
Definition at line 649 of file linear_regression.hpp.
|
inline |
Expected count prediction with Poisson regression.
Uses a fitted Poisson regression model to predict expected counts for new data points.
| model | Fitted GLM model (Poisson distribution) |
| x | Predictor variable vector |
| std::invalid_argument | If model is not Poisson or x dimension doesn't match |
|
inline |
Probability prediction with logistic regression.
Uses a fitted logistic regression model to predict probabilities for new data points.
| model | Fitted GLM model (binomial distribution) |
| x | Predictor variable vector |
| std::invalid_argument | If model is not binomial or x dimension doesn't match |
| prediction_interval statcpp::prediction_interval_simple | ( | const simple_regression_result & | model, |
| IteratorX | x_first, | ||
| IteratorX | x_last, | ||
| double | x_new, | ||
| double | confidence = 0.95 |
||
| ) |
Calculate prediction interval for simple regression model.
Calculates the prediction interval for a new observation. The prediction interval shows the probability that a future individual observation falls within this interval.
| IteratorX | Iterator type for predictor variable |
| model | Simple regression analysis results |
| x_first | Beginning iterator for original predictor variable data |
| x_last | Ending iterator for original predictor variable data |
| x_new | x value of the point to predict |
| confidence | Confidence level (default: 0.95) |
| std::invalid_argument | If confidence is outside (0, 1) range |
Definition at line 695 of file linear_regression.hpp.
| double statcpp::press_statistic | ( | IteratorX | x_first, |
| IteratorX | x_last, | ||
| IteratorY | y_first, | ||
| IteratorY | y_last, | ||
| const simple_regression_result & | model | ||
| ) |
Calculate PRESS statistic.
Calculates the Prediction Sum of Squares (prediction residual sum of squares). Used for efficient computation of leave-one-out cross-validation.
| IteratorX | Iterator type for predictor variable |
| IteratorY | Iterator type for response variable |
| x_first | Beginning iterator for predictor variable |
| x_last | Ending iterator for predictor variable |
| y_first | Beginning iterator for response variable |
| y_last | Ending iterator for response variable |
| model | Simple regression model |
| std::invalid_argument | If x and y have different lengths |
Definition at line 183 of file model_selection.hpp.
|
inline |
|
inline |
Nagelkerke's pseudo R-squared.
Calculates Nagelkerke's pseudo R-squared. Cox-Snell pseudo R-squared adjusted to have a maximum value of 1.
Uses the relationship: deviance = -2 * (LL_model - LL_saturated), so LL_null = LL_saturated - null_deviance / 2. For binomial (0/1 responses) and Poisson, the saturated model log-likelihood is computed explicitly.
| model | Fitted GLM model |
| y | Response variable vector (needed to compute saturated LL for non-Gaussian) |
| n | Sample size |
| quartile_result statcpp::quartiles | ( | Iterator | first, |
| Iterator | last | ||
| ) |
Return quartiles.
Calculates quartiles (Q1, Q2, Q3) from sorted range.
| Iterator | Iterator type |
| first | Beginning of sorted range |
| last | End of sorted range |
| std::invalid_argument | If range is empty |
Definition at line 230 of file order_statistics.hpp.
| quartile_result statcpp::quartiles | ( | Iterator | first, |
| Iterator | last, | ||
| Projection | proj | ||
| ) |
Return quartiles with projection.
| Iterator | Iterator type |
| Projection | Projection function type |
| first | Beginning of sorted range |
| last | End of sorted range |
| proj | Projection function |
| std::invalid_argument | If range is empty |
Definition at line 255 of file order_statistics.hpp.
| double statcpp::r_squared | ( | IteratorY | y_first, |
| IteratorY | y_last, | ||
| IteratorPred | pred_first, | ||
| IteratorPred | pred_last | ||
| ) |
Calculate coefficient of determination from observed and predicted values.
Calculated as R^2 = 1 - SS_residual / SS_total.
| IteratorY | Iterator type for observed values |
| IteratorPred | Iterator type for predicted values |
| y_first | Beginning iterator for observed values |
| y_last | Ending iterator for observed values |
| pred_first | Beginning iterator for predicted values |
| pred_last | Ending iterator for predicted values |
| std::invalid_argument | If y and predictions have different lengths |
| std::invalid_argument | If there are fewer than 2 observations |
Definition at line 1125 of file linear_regression.hpp.
|
inline |
Convert correlation coefficient to Cohen's d.
| r | Correlation coefficient |
| std::invalid_argument | If |r| >= 1 |
Definition at line 273 of file effect_size.hpp.
|
inline |
Randomly reset the random engine seed.
Re-initializes the global random engine seed with a value obtained from a random device. Use this when unpredictable random sequences are needed.
Definition at line 56 of file random_engine.hpp.
| double statcpp::range | ( | Iterator | first, |
| Iterator | last | ||
| ) |
Range (maximum - minimum)
Computes the difference between the maximum and minimum values in the range.
| Iterator | Iterator type |
| first | Begin iterator |
| last | End iterator |
| std::invalid_argument | If the range is empty |
Definition at line 50 of file dispersion_spread.hpp.
| double statcpp::range | ( | Iterator | first, |
| Iterator | last, | ||
| Projection | proj | ||
| ) |
Range of projected values using a lambda expression.
Computes the range of results after applying a projection function to each element.
| Iterator | Iterator type |
| Projection | Projection function type |
| first | Begin iterator |
| last | End iterator |
| proj | Projection function |
| std::invalid_argument | If the range is empty |
Definition at line 73 of file dispersion_spread.hpp.
|
inline |
Rank transformation.
Uses average rank for ties
| data | Data vector |
Definition at line 415 of file data_wrangling.hpp.
|
inline |
Compute the relative error between two values.
relative_error = |x - x_ref| / max(|x_ref|, eps)
| x | Computed value |
| x_ref | Reference value |
Definition at line 229 of file numerical_utils.hpp.
| auto statcpp::relative_frequency | ( | Iterator | first, |
| Iterator | last | ||
| ) | -> std::unordered_map<typename std::iterator_traits<Iterator>::value_type, double> |
Return relative frequency for each value.
Calculates the relative frequency by dividing each value's frequency by the total count.
| Iterator | Iterator type |
| first | Beginning iterator |
| last | Ending iterator |
Definition at line 232 of file frequency_distribution.hpp.
| auto statcpp::relative_frequency | ( | Iterator | first, |
| Iterator | last, | ||
| Projection | proj | ||
| ) | -> std::unordered_map<std::invoke_result_t<Projection, typename std::iterator_traits<Iterator>::value_type>, double> |
Relative frequency with projection.
Returns the relative frequency of results after applying a projection function to each element.
| Iterator | Iterator type |
| Projection | Projection function type |
| first | Beginning iterator |
| last | Ending iterator |
| proj | Projection function |
Definition at line 266 of file frequency_distribution.hpp.
|
inline |
Calculate relative risk (risk ratio) from a 2x2 contingency table.
Calculates the relative risk and its confidence interval. Relative risk = (a/(a+b)) / (c/(c+d))
Standard error is calculated on the log scale (Greenland-Robins method): SE(log RR) = sqrt((1-p1)/(n1*p1) + (1-p0)/(n0*p0)) = sqrt((1-p1)/a + (1-p0)/c) where p1 = a/(a+b), p0 = c/(c+d)
| table | 2x2 contingency table in the form [[a, b], [c, d]]
|
| std::invalid_argument | If table is not 2x2, if row total is zero, or if risk is zero |
Definition at line 191 of file categorical.hpp.
|
inline |
Calculate relative risk from a 2x2 contingency table (specifying cell values directly)
| a | Exposed and diseased |
| b | Exposed and not diseased |
| c | Not exposed and diseased |
| d | Not exposed and not diseased |
| std::invalid_argument | If row total is zero or if risk is zero |
Definition at line 239 of file categorical.hpp.
|
inline |
Perform Ridge regression (L2 regularization)
Solves Ridge regression using coordinate descent. L2 penalty shrinks coefficients and handles multicollinearity.
| X | Predictor matrix (each row is one sample, no intercept column) |
| y | Response variable vector |
| lambda | Regularization parameter (>= 0) |
| standardize | Whether to standardize data (default: true) |
| max_iter | Maximum number of iterations (default: 1000) |
| tol | Convergence tolerance (default: 1e-6) |
| std::invalid_argument | If lambda is negative, data is empty, or X and y have different sizes |
Definition at line 463 of file model_selection.hpp.
|
inline |
Calculate risk difference from a 2x2 contingency table.
Calculates the risk difference (attributable risk) and its confidence interval. Risk difference = (a/(a+b)) - (c/(c+d))
| table | 2x2 contingency table in the form [[a, b], [c, d]] |
| std::invalid_argument | If table is not 2x2 or if row total is zero |
Definition at line 268 of file categorical.hpp.
|
inline |
Calculate risk difference from a 2x2 contingency table (specifying cell values directly)
| a | Exposed and diseased |
| b | Exposed and not diseased |
| c | Not exposed and diseased |
| d | Not exposed and not diseased |
| std::invalid_argument | If row total is zero |
Definition at line 312 of file categorical.hpp.
|
inline |
Relative risk (risk ratio)
Calculates the relative risk from a 2x2 contingency table.
| a | Cell (1,1) frequency (exposed, disease present) |
| b | Cell (1,2) frequency (exposed, disease absent) |
| c | Cell (2,1) frequency (unexposed, disease present) |
| d | Cell (2,2) frequency (unexposed, disease absent) |
| std::invalid_argument | If row total is zero or risk in group 2 is zero |
Definition at line 402 of file effect_size.hpp.
| double statcpp::rmse | ( | Iterator1 | first1, |
| Iterator1 | last1, | ||
| Iterator2 | first2 | ||
| ) |
Root Mean Squared Error (RMSE)
| Iterator1 | RandomAccessIterator type for actual values |
| Iterator2 | RandomAccessIterator type for predicted values |
| first1 | Beginning iterator of actual values |
| last1 | End iterator of actual values |
| first2 | Beginning iterator of predicted values |
| std::invalid_argument | If range is empty |
Definition at line 266 of file time_series.hpp.
|
inline |
Moving maximum.
| data | Data vector |
| window | Window size |
Definition at line 885 of file data_wrangling.hpp.
|
inline |
Moving average.
| data | Data vector |
| window | Window size |
Definition at line 788 of file data_wrangling.hpp.
|
inline |
Moving minimum.
| data | Data vector |
| window | Window size |
Definition at line 862 of file data_wrangling.hpp.
|
inline |
Moving standard deviation.
| data | Data vector |
| window | Window size |
Definition at line 833 of file data_wrangling.hpp.
|
inline |
Moving sum.
| data | Data vector |
| window | Window size |
Definition at line 908 of file data_wrangling.hpp.
|
inline |
Safe division with check for division by zero.
| numerator | Numerator |
| denominator | Denominator |
| default_value | Value to return if denominator is zero (default: NaN) |
Definition at line 243 of file numerical_utils.hpp.
| double statcpp::sample_covariance | ( | Iterator1 | first1, |
| Iterator1 | last1, | ||
| Iterator2 | first2, | ||
| Iterator2 | last2 | ||
| ) |
Sample covariance (unbiased covariance)
Computes the sample covariance (unbiased estimator) of two variables. s_xy = (1/(n-1)) * sum((x_i - x_bar)(y_i - y_bar))
| Iterator1 | Iterator type for the first data |
| Iterator2 | Iterator type for the second data |
| first1 | Begin iterator for the first data |
| last1 | End iterator for the first data |
| first2 | Begin iterator for the second data |
| last2 | End iterator for the second data |
| std::invalid_argument | If range is empty, lengths differ, or number of elements is less than 2 |
Definition at line 172 of file correlation_covariance.hpp.
| double statcpp::sample_covariance | ( | Iterator1 | first1, |
| Iterator1 | last1, | ||
| Iterator2 | first2, | ||
| Iterator2 | last2, | ||
| double | mean_x, | ||
| double | mean_y | ||
| ) |
Sample covariance with precomputed means.
| Iterator1 | Iterator type for the first data |
| Iterator2 | Iterator type for the second data |
| first1 | Begin iterator for the first data |
| last1 | End iterator for the first data |
| first2 | Begin iterator for the second data |
| last2 | End iterator for the second data |
| mean_x | Mean of the first data |
| mean_y | Mean of the second data |
| std::invalid_argument | If range is empty, lengths differ, or number of elements is less than 2 |
Definition at line 216 of file correlation_covariance.hpp.
| double statcpp::sample_covariance | ( | Iterator1 | first1, |
| Iterator1 | last1, | ||
| Iterator2 | first2, | ||
| Iterator2 | last2, | ||
| Projection1 | proj1, | ||
| Projection2 | proj2 | ||
| ) |
Sample covariance (projection version)
| Iterator1 | Iterator type for the first data |
| Iterator2 | Iterator type for the second data |
| Projection1 | Projection function type for the first data |
| Projection2 | Projection function type for the second data |
| first1 | Begin iterator for the first data |
| last1 | End iterator for the first data |
| first2 | Begin iterator for the second data |
| last2 | End iterator for the second data |
| proj1 | Projection function for the first data |
| proj2 | Projection function for the second data |
| std::invalid_argument | If range is empty, lengths differ, or number of elements is less than 2 |
Definition at line 260 of file correlation_covariance.hpp.
| double statcpp::sample_kurtosis | ( | Iterator | first, |
| Iterator | last | ||
| ) |
Calculate sample kurtosis (bias-corrected version)
Calculates the bias-corrected kurtosis estimate from a sample.
Formula: G2 = ((n+1) * g2 + 6) * (n-1) / ((n-2)(n-3)) where g2 is the population kurtosis estimator (excess kurtosis)
| Iterator | Input iterator type |
| first | Beginning iterator of data range |
| last | End iterator of data range |
| std::invalid_argument | If number of elements is less than 4 |
Definition at line 535 of file shape_of_distribution.hpp.
| double statcpp::sample_kurtosis | ( | Iterator | first, |
| Iterator | last, | ||
| double | precomputed_mean | ||
| ) |
Calculate sample kurtosis with precomputed mean.
| Iterator | Input iterator type |
| first | Beginning iterator of data range |
| last | End iterator of data range |
| precomputed_mean | Precomputed mean value |
| std::invalid_argument | If number of elements is less than 4 |
Definition at line 559 of file shape_of_distribution.hpp.
| double statcpp::sample_kurtosis | ( | Iterator | first, |
| Iterator | last, | ||
| Projection | proj | ||
| ) |
Calculate sample kurtosis with projection.
| Iterator | Input iterator type |
| Projection | Projection function type |
| first | Beginning iterator of data range |
| last | End iterator of data range |
| proj | Projection function |
| std::invalid_argument | If number of elements is less than 4 |
Definition at line 587 of file shape_of_distribution.hpp.
| double statcpp::sample_kurtosis | ( | Iterator | first, |
| Iterator | last, | ||
| Projection | proj, | ||
| double | precomputed_mean | ||
| ) |
Calculate sample kurtosis with projection and precomputed mean.
| Iterator | Input iterator type |
| Projection | Projection function type |
| first | Beginning iterator of data range |
| last | End iterator of data range |
| proj | Projection function |
| precomputed_mean | Precomputed mean value |
| std::invalid_argument | If number of elements is less than 4 |
Definition at line 613 of file shape_of_distribution.hpp.
|
inline |
Calculate sample size for mean estimation (known population standard deviation)
Calculates the sample size required to achieve the specified margin of error. n = (z_{alpha/2} * sigma / MoE)^2
| margin_of_error | Target margin of error |
| sigma | Population standard deviation (known or estimated) |
| confidence_level | Confidence level (default: 0.95) |
| std::invalid_argument | If parameters are outside valid range |
Definition at line 627 of file estimation.hpp.
|
inline |
Calculate sample size for proportion estimation.
Calculates the sample size required to achieve the specified margin of error. n = (z_{alpha/2} / MoE)^2 * p(1-p)
| margin_of_error | Target margin of error |
| confidence_level | Confidence level (default: 0.95) |
| p_estimate | Prior estimate of proportion (default: 0.5 for most conservative estimate) |
| std::invalid_argument | If parameters are outside valid range |
Definition at line 591 of file estimation.hpp.
|
inline |
Calculate required sample size for two-sample proportion test (enum overload)
| p1 | Proportion of group 1 |
| p2 | Proportion of group 2 |
| power | Target power (default: 0.80) |
| alpha | Significance level (default: 0.05) |
| alt | Type of alternative hypothesis (default: two_sided) |
Definition at line 599 of file power_analysis.hpp.
|
inline |
Calculate required sample size for two-sample proportion test.
| p1 | Proportion of group 1 |
| p2 | Proportion of group 2 |
| power | Target power (default: 0.80) |
| alpha | Significance level (default: 0.05) |
| alternative | Type of alternative hypothesis (default: "two.sided") |
| std::invalid_argument | If parameters are invalid |
Definition at line 409 of file power_analysis.hpp.
|
inline |
Calculate required sample size for one-sample t-test (enum overload)
| effect_size | Effect size (Cohen's d) |
| power | Target power (default: 0.80) |
| alpha | Significance level (default: 0.05) |
| alt | Type of alternative hypothesis (default: two_sided) |
Definition at line 531 of file power_analysis.hpp.
|
inline |
Calculate required sample size for one-sample t-test.
| effect_size | Effect size (Cohen's d) |
| power | Target power (default: 0.80) |
| alpha | Significance level (default: 0.05) |
| alternative | Type of alternative hypothesis (default: "two.sided") |
| std::invalid_argument | If parameters are invalid |
Definition at line 195 of file power_analysis.hpp.
|
inline |
Calculate required sample size for two-sample t-test (enum overload)
| effect_size | Effect size (Cohen's d) |
| power | Target power (default: 0.80) |
| alpha | Significance level (default: 0.05) |
| ratio | Ratio n2/n1 (default: 1.0) |
| alt | Type of alternative hypothesis (default: two_sided) |
Definition at line 565 of file power_analysis.hpp.
|
inline |
Calculate required sample size for two-sample t-test (per group)
| effect_size | Effect size (Cohen's d) |
| power | Target power (default: 0.80) |
| alpha | Significance level (default: 0.05) |
| ratio | Ratio n2/n1 (default: 1.0 = equal sizes) |
| alternative | Type of alternative hypothesis (default: "two.sided") |
| std::invalid_argument | If parameters are invalid |
Definition at line 295 of file power_analysis.hpp.
| double statcpp::sample_skewness | ( | Iterator | first, |
| Iterator | last | ||
| ) |
Calculate sample skewness (bias-corrected version)
Calculates the bias-corrected skewness estimate from a sample.
Formula: G1 = sqrt(n(n-1)) / (n-2) * g1 where g1 is the population skewness estimator
| Iterator | Input iterator type |
| first | Beginning iterator of data range |
| last | End iterator of data range |
| std::invalid_argument | If number of elements is less than 3 |
Definition at line 202 of file shape_of_distribution.hpp.
| double statcpp::sample_skewness | ( | Iterator | first, |
| Iterator | last, | ||
| double | precomputed_mean | ||
| ) |
Calculate sample skewness with precomputed mean.
| Iterator | Input iterator type |
| first | Beginning iterator of data range |
| last | End iterator of data range |
| precomputed_mean | Precomputed mean value |
| std::invalid_argument | If number of elements is less than 3 |
Definition at line 225 of file shape_of_distribution.hpp.
| double statcpp::sample_skewness | ( | Iterator | first, |
| Iterator | last, | ||
| Projection | proj | ||
| ) |
Calculate sample skewness with projection.
| Iterator | Input iterator type |
| Projection | Projection function type |
| first | Beginning iterator of data range |
| last | End iterator of data range |
| proj | Projection function |
| std::invalid_argument | If number of elements is less than 3 |
Definition at line 252 of file shape_of_distribution.hpp.
| double statcpp::sample_skewness | ( | Iterator | first, |
| Iterator | last, | ||
| Projection | proj, | ||
| double | precomputed_mean | ||
| ) |
Calculate sample skewness with projection and precomputed mean.
| Iterator | Input iterator type |
| Projection | Projection function type |
| first | Beginning iterator of data range |
| last | End iterator of data range |
| proj | Projection function |
| precomputed_mean | Precomputed mean value |
| std::invalid_argument | If number of elements is less than 3 |
Definition at line 277 of file shape_of_distribution.hpp.
| double statcpp::sample_stddev | ( | Iterator | first, |
| Iterator | last | ||
| ) |
Sample standard deviation.
Computes the sample standard deviation (square root of variance divided by N-1).
| Iterator | Iterator type |
| first | Begin iterator |
| last | End iterator |
| std::invalid_argument | If the range is empty or has fewer than 2 elements |
Definition at line 669 of file dispersion_spread.hpp.
| double statcpp::sample_stddev | ( | Iterator | first, |
| Iterator | last, | ||
| double | precomputed_mean | ||
| ) |
Sample standard deviation using precomputed mean.
Computes sample standard deviation when the mean has been precomputed.
| Iterator | Iterator type |
| first | Begin iterator |
| last | End iterator |
| precomputed_mean | Precomputed mean value |
| std::invalid_argument | If the range is empty or has fewer than 2 elements |
Definition at line 687 of file dispersion_spread.hpp.
| double statcpp::sample_stddev | ( | Iterator | first, |
| Iterator | last, | ||
| Projection | proj | ||
| ) |
Sample standard deviation of projected values using a lambda expression.
Computes the sample standard deviation of results after applying a projection function to each element.
| Iterator | Iterator type |
| Projection | Projection function type |
| first | Begin iterator |
| last | End iterator |
| proj | Projection function |
| std::invalid_argument | If the range is empty or has fewer than 2 elements |
Definition at line 709 of file dispersion_spread.hpp.
| double statcpp::sample_stddev | ( | Iterator | first, |
| Iterator | last, | ||
| Projection | proj, | ||
| double | precomputed_mean | ||
| ) |
Sample standard deviation of projected values using precomputed mean.
Computes sample standard deviation using a projection function and precomputed mean.
| Iterator | Iterator type |
| Projection | Projection function type |
| first | Begin iterator |
| last | End iterator |
| proj | Projection function |
| precomputed_mean | Precomputed mean value |
| std::invalid_argument | If the range is empty or has fewer than 2 elements |
Definition at line 729 of file dispersion_spread.hpp.
| double statcpp::sample_variance | ( | Iterator | first, |
| Iterator | last | ||
| ) |
Sample variance (unbiased variance)
Computes the unbiased sample variance (divide by N-1).
| Iterator | Iterator type |
| first | Begin iterator |
| last | End iterator |
| std::invalid_argument | If the range is empty or has fewer than 2 elements |
Definition at line 339 of file dispersion_spread.hpp.
| double statcpp::sample_variance | ( | Iterator | first, |
| Iterator | last, | ||
| double | precomputed_mean | ||
| ) |
Sample variance using precomputed mean.
Computes sample variance when the mean has been precomputed.
| Iterator | Iterator type |
| first | Begin iterator |
| last | End iterator |
| precomputed_mean | Precomputed mean value |
| std::invalid_argument | If the range is empty or has fewer than 2 elements |
Definition at line 357 of file dispersion_spread.hpp.
| double statcpp::sample_variance | ( | Iterator | first, |
| Iterator | last, | ||
| Projection | proj | ||
| ) |
Sample variance of projected values using a lambda expression.
Computes the sample variance of results after applying a projection function to each element.
| Iterator | Iterator type |
| Projection | Projection function type |
| first | Begin iterator |
| last | End iterator |
| proj | Projection function |
| std::invalid_argument | If the range is empty or has fewer than 2 elements |
Definition at line 379 of file dispersion_spread.hpp.
| double statcpp::sample_variance | ( | Iterator | first, |
| Iterator | last, | ||
| Projection | proj, | ||
| double | precomputed_mean | ||
| ) |
Sample variance of projected values using precomputed mean.
Computes sample variance using a projection function and precomputed mean.
| Iterator | Iterator type |
| Projection | Projection function type |
| first | Begin iterator |
| last | End iterator |
| proj | Projection function |
| precomputed_mean | Precomputed mean value |
| std::invalid_argument | If the range is empty or has fewer than 2 elements |
Definition at line 399 of file dispersion_spread.hpp.
| std::vector< T > statcpp::sample_with_replacement | ( | const std::vector< T > & | data, |
| std::size_t | n | ||
| ) |
Random sampling (with replacement)
| T | Data type |
| data | Data vector |
| n | Sample size |
Definition at line 625 of file data_wrangling.hpp.
| std::vector< T > statcpp::sample_without_replacement | ( | const std::vector< T > & | data, |
| std::size_t | n | ||
| ) |
Random sampling (without replacement)
| T | Data type |
| data | Data vector |
| n | Sample size |
Definition at line 651 of file data_wrangling.hpp.
|
inline |
Perform Scheffe's method for multiple comparisons.
Performs multiple comparisons among all pairs of groups using Scheffe's method as a post-hoc test following one-way ANOVA. This is the most conservative method.
Scheffe's method is valid for any linear contrast, applicable not only to pairwise comparisons but also to complex contrasts. The F statistic is calculated as t^2 / (k-1) and compared to F(k-1, df_error) distribution. The p-value is computed as 1 - F_cdf(F_s, k-1, df_error).
| anova_result | Result from one-way ANOVA |
| alpha | Significance level (default: 0.05) |
| std::invalid_argument | If alpha is outside the range (0, 1) |
| std::vector< double > statcpp::seasonal_diff | ( | Iterator | first, |
| Iterator | last, | ||
| std::size_t | period | ||
| ) |
Seasonal differencing.
Calculates the seasonal difference for time series data with seasonality.
| Iterator | RandomAccessIterator type |
| first | Beginning iterator |
| last | End iterator |
| period | Seasonal period |
| std::invalid_argument | If data is insufficient for the period |
Definition at line 455 of file time_series.hpp.
|
inline |
Sensitivity analysis using pattern mixture model.
Evaluates robustness of estimates by varying the difference (delta) between missing and observed values under MNAR (Missing Not At Random) assumption.
Basic formula of pattern mixture model:
Interpretation of delta:
| data | 1D data for analysis |
| delta_values | Vector of sensitivity parameter delta values |
| std::invalid_argument | If data is empty or all values are missing |
Definition at line 810 of file missing_data.hpp.
|
inline |
Sensitivity analysis using selection model.
Evaluates robustness of estimates by varying the degree (phi) to which missingness depends on the response value. phi = 0 corresponds to MAR assumption, and phi > 0 indicates that missing values tend to be lower than observed values.
| data | 1D data for analysis |
| phi_values | Vector of sensitivity parameter phi values |
| std::invalid_argument | If data is empty or all values are missing |
Definition at line 888 of file missing_data.hpp.
|
inline |
Set the seed of the random engine.
Sets the seed of the global random engine to the specified value. Use this when reproducible random sequences are needed.
| seed | Seed value to set |
Definition at line 45 of file random_engine.hpp.
| test_result statcpp::shapiro_wilk_test | ( | Iterator | first, |
| Iterator | last | ||
| ) |
Perform Shapiro-Wilk test.
Tests whether data follows a normal distribution. Uses Royston's algorithm for approximation. Optimized for sample sizes n <= 50, but supports up to n <= 5000.
| Iterator | Input iterator type |
| first | Beginning iterator of range |
| last | Ending iterator of range |
| std::invalid_argument | If there are fewer than 3 elements |
| std::invalid_argument | If there are more than 5000 elements |
| std::invalid_argument | If variance is zero |
Definition at line 144 of file nonparametric_tests.hpp.
|
inline |
Calculate silhouette score.
Calculates the silhouette score to evaluate clustering quality.
| data | Vector of data points |
| labels | Cluster labels |
| std::invalid_argument | If data is empty or sizes don't match |
Definition at line 498 of file clustering.hpp.
| simple_regression_result statcpp::simple_linear_regression | ( | IteratorX | x_first, |
| IteratorX | x_last, | ||
| IteratorY | y_first, | ||
| IteratorY | y_last | ||
| ) |
Perform simple linear regression.
Estimates simple regression model y = b0 + b1*x using least squares method. Calculates regression coefficients, standard errors, t-tests, F-test, and coefficient of determination.
| IteratorX | Iterator type for predictor variable |
| IteratorY | Iterator type for response variable |
| x_first | Beginning iterator for predictor variable |
| x_last | Ending iterator for predictor variable |
| y_first | Beginning iterator for response variable |
| y_last | Ending iterator for response variable |
| std::invalid_argument | If x and y have different lengths |
| std::invalid_argument | If there are fewer than 3 observations |
| std::invalid_argument | If x has zero variance |
Definition at line 128 of file linear_regression.hpp.
| double statcpp::skewness | ( | Iterator | first, |
| Iterator | last | ||
| ) |
Calculate skewness (alias for sample_skewness)
| Iterator | Input iterator type |
| first | Beginning iterator of data range |
| last | End iterator of data range |
Definition at line 298 of file shape_of_distribution.hpp.
| double statcpp::skewness | ( | Iterator | first, |
| Iterator | last, | ||
| double | precomputed_mean | ||
| ) |
Calculate skewness (precomputed mean version)
| Iterator | Input iterator type |
| first | Beginning iterator of data range |
| last | End iterator of data range |
| precomputed_mean | Precomputed mean value |
Definition at line 313 of file shape_of_distribution.hpp.
| double statcpp::skewness | ( | Iterator | first, |
| Iterator | last, | ||
| Projection | proj | ||
| ) |
Calculate skewness (projection version)
| Iterator | Input iterator type |
| Projection | Projection function type |
| first | Beginning iterator of data range |
| last | End iterator of data range |
| proj | Projection function |
Definition at line 332 of file shape_of_distribution.hpp.
| double statcpp::skewness | ( | Iterator | first, |
| Iterator | last, | ||
| Projection | proj, | ||
| double | precomputed_mean | ||
| ) |
Calculate skewness (projection version, precomputed mean)
| Iterator | Input iterator type |
| Projection | Projection function type |
| first | Beginning iterator of data range |
| last | End iterator of data range |
| proj | Projection function |
| precomputed_mean | Precomputed mean value |
Definition at line 349 of file shape_of_distribution.hpp.
| std::vector< T > statcpp::sort_values | ( | const std::vector< T > & | data, |
| bool | ascending = true |
||
| ) |
Return a sorted vector (ascending)
| T | Data type |
| data | Data vector |
| ascending | true for ascending, false for descending |
Definition at line 579 of file data_wrangling.hpp.
| double statcpp::spearman_correlation | ( | Iterator1 | first1, |
| Iterator1 | last1, | ||
| Iterator2 | first2, | ||
| Iterator2 | last2 | ||
| ) |
Spearman's rank correlation coefficient.
Computes Spearman's rank correlation coefficient of two variables. rho = Pearson(rank(X), rank(Y)) Applies Pearson correlation coefficient to ranked data. Can detect monotonic relationships and is robust to outliers.
| Iterator1 | Iterator type for the first data |
| Iterator2 | Iterator type for the second data |
| first1 | Begin iterator for the first data |
| last1 | End iterator for the first data |
| first2 | Begin iterator for the second data |
| last2 | End iterator for the second data |
| std::invalid_argument | If range is empty, lengths differ, or number of elements is less than 2 |
Definition at line 650 of file correlation_covariance.hpp.
| double statcpp::spearman_correlation | ( | Iterator1 | first1, |
| Iterator1 | last1, | ||
| Iterator2 | first2, | ||
| Iterator2 | last2, | ||
| Projection1 | proj1, | ||
| Projection2 | proj2 | ||
| ) |
Spearman's rank correlation coefficient (projection version)
| Iterator1 | Iterator type for the first data |
| Iterator2 | Iterator type for the second data |
| Projection1 | Projection function type for the first data |
| Projection2 | Projection function type for the second data |
| first1 | Begin iterator for the first data |
| last1 | End iterator for the first data |
| first2 | Begin iterator for the second data |
| last2 | End iterator for the second data |
| proj1 | Projection function for the first data |
| proj2 | Projection function for the second data |
| std::invalid_argument | If range is empty, lengths differ, or number of elements is less than 2 |
Definition at line 690 of file correlation_covariance.hpp.
|
inline |
Square root transformation.
| data | Data vector |
Definition at line 366 of file data_wrangling.hpp.
| double statcpp::standard_error | ( | Iterator | first, |
| Iterator | last | ||
| ) |
Calculate standard error of the mean.
Standard error: SE = s / sqrt(n)
| Iterator | Iterator type |
| first | Beginning iterator of data range |
| last | Ending iterator of data range |
| std::invalid_argument | If there are fewer than 2 elements |
Definition at line 38 of file estimation.hpp.
| double statcpp::standard_error | ( | Iterator | first, |
| Iterator | last, | ||
| double | precomputed_stddev | ||
| ) |
Calculate standard error of the mean (using precomputed standard deviation)
| Iterator | Iterator type |
| first | Beginning iterator of data range |
| last | Ending iterator of data range |
| precomputed_stddev | Precomputed standard deviation |
| std::invalid_argument | If the range is empty |
Definition at line 81 of file estimation.hpp.
| double statcpp::standard_error | ( | Iterator | first, |
| Iterator | last, | ||
| Projection | proj | ||
| ) |
Calculate standard error of the mean (projection version)
| Iterator | Iterator type |
| Projection | Projection function type |
| first | Beginning iterator of data range |
| last | Ending iterator of data range |
| proj | Projection function |
| std::invalid_argument | If there are fewer than 2 elements |
Definition at line 60 of file estimation.hpp.
|
inline |
Z-score standardization.
Standardizes each variable to mean 0 and standard deviation 1. Data is passed with rows=observations and columns=variables.
| data | Matrix data (rows=observations, columns=variables) |
| std::invalid_argument | If data is empty, rows have different column counts, there are fewer than 2 observations, or any variable has zero variance |
Definition at line 139 of file multivariate.hpp.
| double statcpp::stddev | ( | Iterator | first, |
| Iterator | last | ||
| ) |
Standard deviation (alias for sample_stddev)
Computes sample standard deviation. Equivalent to sample_stddev.
| Iterator | Iterator type |
| first | Begin iterator |
| last | End iterator |
| std::invalid_argument | If the range is empty or has fewer than 2 elements |
Definition at line 750 of file dispersion_spread.hpp.
| double statcpp::stddev | ( | Iterator | first, |
| Iterator | last, | ||
| double | precomputed_mean | ||
| ) |
Standard deviation using precomputed mean.
Computes sample standard deviation when the mean has been precomputed.
| Iterator | Iterator type |
| first | Begin iterator |
| last | End iterator |
| precomputed_mean | Precomputed mean value |
| std::invalid_argument | If the range is empty or has fewer than 2 elements |
Definition at line 768 of file dispersion_spread.hpp.
| double statcpp::stddev | ( | Iterator | first, |
| Iterator | last, | ||
| Projection | proj | ||
| ) |
Standard deviation of projected values using a lambda expression.
Computes the sample standard deviation of results after applying a projection function to each element.
| Iterator | Iterator type |
| Projection | Projection function type |
| first | Begin iterator |
| last | End iterator |
| proj | Projection function |
| std::invalid_argument | If the range is empty or has fewer than 2 elements |
Definition at line 790 of file dispersion_spread.hpp.
| double statcpp::stddev | ( | Iterator | first, |
| Iterator | last, | ||
| Projection | proj, | ||
| double | precomputed_mean | ||
| ) |
Standard deviation of projected values using precomputed mean.
Computes sample standard deviation using a projection function and precomputed mean.
| Iterator | Iterator type |
| Projection | Projection function type |
| first | Begin iterator |
| last | End iterator |
| proj | Projection function |
| precomputed_mean | Precomputed mean value |
| std::invalid_argument | If the range is empty or has fewer than 2 elements |
Definition at line 810 of file dispersion_spread.hpp.
| double statcpp::stdev | ( | Iterator | first, |
| Iterator | last, | ||
| double | precomputed_mean, | ||
| std::size_t | ddof | ||
| ) |
Standard deviation using precomputed mean (with ddof)
Use when the mean has been precomputed.
| Iterator | Iterator type |
| first | Begin iterator |
| last | End iterator |
| precomputed_mean | Precomputed mean value |
| ddof | Degrees of freedom correction (0 or 1) |
| std::invalid_argument | If range is empty, ddof is not 0 or 1, or ddof=1 with fewer than 2 elements |
Definition at line 523 of file dispersion_spread.hpp.
| double statcpp::stdev | ( | Iterator | first, |
| Iterator | last, | ||
| Projection | proj, | ||
| double | precomputed_mean, | ||
| std::size_t | ddof | ||
| ) |
Standard deviation of projected values using precomputed mean (with ddof)
Computes standard deviation using a projection function and precomputed mean.
| Iterator | Iterator type |
| Projection | Projection function type |
| first | Begin iterator |
| last | End iterator |
| proj | Projection function |
| precomputed_mean | Precomputed mean value |
| ddof | Degrees of freedom correction (0 or 1) |
| std::invalid_argument | If range is empty, ddof is not 0 or 1, or ddof=1 with fewer than 2 elements |
Definition at line 567 of file dispersion_spread.hpp.
| double statcpp::stdev | ( | Iterator | first, |
| Iterator | last, | ||
| Projection | proj, | ||
| std::size_t | ddof = 0 |
||
| ) |
Standard deviation of projected values using a lambda expression (with ddof)
Computes the standard deviation of results after applying a projection function to each element.
| Iterator | Iterator type |
| Projection | Projection function type |
| first | Begin iterator |
| last | End iterator |
| proj | Projection function |
| ddof | Degrees of freedom correction (0 or 1) |
| std::invalid_argument | If range is empty, ddof is not 0 or 1, or ddof=1 with fewer than 2 elements |
Definition at line 546 of file dispersion_spread.hpp.
| double statcpp::stdev | ( | Iterator | first, |
| Iterator | last, | ||
| std::size_t | ddof = 0 |
||
| ) |
Standard deviation (ddof = Delta Degrees of Freedom)
ddof = 0: Population standard deviation (square root of variance divided by N) ddof = 1: Sample standard deviation (square root of variance divided by N-1) Behaves like NumPy's np.std(a, ddof=...).
| Iterator | Iterator type |
| first | Begin iterator |
| last | End iterator |
| ddof | Degrees of freedom correction (0 or 1) |
| std::invalid_argument | If range is empty, ddof is not 0 or 1, or ddof=1 with fewer than 2 elements |
Definition at line 504 of file dispersion_spread.hpp.
| std::vector< V > statcpp::stratified_sample | ( | const std::vector< K > & | strata, |
| const std::vector< V > & | data, | ||
| double | sample_ratio | ||
| ) |
Stratified sampling.
| K | Stratum type |
| V | Data type |
| strata | Vector of strata |
| data | Data vector |
| sample_ratio | Sampling ratio |
Definition at line 682 of file data_wrangling.hpp.
|
inline |
CDF of the studentized range distribution.
Computes P(Q <= q) where Q follows the studentized range distribution with k groups and df degrees of freedom.
Uses the Copenhaver & Holland (1988) algorithm with nested Gauss-Legendre quadrature, equivalent to R's ptukey().
| q | Quantile value |
| k | Number of groups (must be >= 2) |
| df | Degrees of freedom (must be > 0) |
| std::invalid_argument | If k < 2 or df <= 0 |
Definition at line 1235 of file continuous_distributions.hpp.
|
inline |
Quantile function of the studentized range distribution.
Computes q such that P(Q <= q) = p where Q follows the studentized range distribution with k groups and df degrees of freedom.
Uses Newton-Raphson iteration with numerical differentiation (central difference).
| p | Probability (must be in [0, 1]) |
| k | Number of groups (must be >= 2) |
| df | Degrees of freedom (must be > 0) |
| std::invalid_argument | If k < 2, df <= 0, or p is outside [0, 1] |
Definition at line 1460 of file continuous_distributions.hpp.
| auto statcpp::sum | ( | Iterator | first, |
| Iterator | last | ||
| ) |
Sum.
Computes the sum of all elements in the range.
| Iterator | Iterator type |
| first | Begin iterator |
| last | End iterator |
Definition at line 46 of file basic_statistics.hpp.
| auto statcpp::sum | ( | Iterator | first, |
| Iterator | last, | ||
| Projection | proj | ||
| ) |
Sum of projected values using a lambda expression.
Computes the sum of the results after applying a projection function to each element.
| Iterator | Iterator type |
| Projection | Projection function type |
| first | Begin iterator |
| last | End iterator |
| proj | Projection function |
Definition at line 65 of file basic_statistics.hpp.
|
inline |
t-distribution cumulative distribution function (CDF)
Computed using the regularized incomplete beta function. The CDF of t-distribution is expressed as:
F(x; nu) = 1 - 0.5 * I_{nu/(nu+x^2)}(nu/2, 1/2) (for x >= 0) F(x; nu) = 0.5 * I_{nu/(nu+x^2)}(nu/2, 1/2) (for x < 0)
where I_z(a,b) is the regularized incomplete beta function and nu is degrees of freedom. This transformation enables efficient computation of t-distribution CDF via beta distribution CDF.
| x | Random variable value |
| df | Degrees of freedom nu |
| std::invalid_argument | If df <= 0 |
Definition at line 707 of file continuous_distributions.hpp.
|
inline |
t-distribution probability density function (PDF)
f(x) = Gamma((nu+1)/2) / (sqrt(nu*pi) * Gamma(nu/2)) * (1 + x^2/nu)^(-(nu+1)/2)
| x | Random variable value |
| df | Degrees of freedom |
| std::invalid_argument | If df <= 0 |
Definition at line 680 of file continuous_distributions.hpp.
|
inline |
t-distribution quantile function (Newton-Raphson method)
| p | Probability (0 < p < 1) |
| df | Degrees of freedom |
| std::invalid_argument | If df <= 0 or p is outside (0, 1) |
Definition at line 739 of file continuous_distributions.hpp.
|
inline |
t-distribution random number generation (using default engine)
| df | Degrees of freedom |
Definition at line 812 of file continuous_distributions.hpp.
| double statcpp::t_rand | ( | double | df, |
| Engine & | engine | ||
| ) |
t-distribution random number generation
| Engine | Random engine type |
| df | Degrees of freedom |
| engine | Random engine |
| std::invalid_argument | If df <= 0 |
Definition at line 797 of file continuous_distributions.hpp.
| test_result statcpp::t_test | ( | Iterator | first, |
| Iterator | last, | ||
| double | mu0, | ||
| alternative_hypothesis | alt = alternative_hypothesis::two_sided |
||
| ) |
One-sample t-test.
Tests whether the sample mean equals a specific value (unknown population variance).
| Iterator | Input iterator type |
| first | Beginning iterator of sample data |
| last | End iterator of sample data |
| mu0 | Population mean under null hypothesis |
| alt | Type of alternative hypothesis (default: two-sided) |
| std::invalid_argument | If number of elements is less than 2 or variance is zero |
Definition at line 231 of file parametric_tests.hpp.
| test_result statcpp::t_test_paired | ( | Iterator1 | first1, |
| Iterator1 | last1, | ||
| Iterator2 | first2, | ||
| Iterator2 | last2, | ||
| alternative_hypothesis | alt = alternative_hypothesis::two_sided |
||
| ) |
Paired t-test.
Tests whether the mean of differences between two paired samples equals zero.
| Iterator1 | Input iterator type for first sample |
| Iterator2 | Input iterator type for second sample |
| first1 | Beginning iterator of first sample |
| last1 | End iterator of first sample |
| first2 | Beginning iterator of second sample |
| last2 | End iterator of second sample |
| alt | Type of alternative hypothesis (default: two-sided) |
| std::invalid_argument | If sample lengths differ or are less than 2 |
Definition at line 415 of file parametric_tests.hpp.
| test_result statcpp::t_test_two_sample | ( | Iterator1 | first1, |
| Iterator1 | last1, | ||
| Iterator2 | first2, | ||
| Iterator2 | last2, | ||
| alternative_hypothesis | alt = alternative_hypothesis::two_sided |
||
| ) |
Two-sample t-test (independent samples, pooled variance)
Tests whether the means of two independent samples are equal. Assumes equal variance and uses pooled variance.
| Iterator1 | Input iterator type for first sample |
| Iterator2 | Input iterator type for second sample |
| first1 | Beginning iterator of first sample |
| last1 | End iterator of first sample |
| first2 | Beginning iterator of second sample |
| last2 | End iterator of second sample |
| alt | Type of alternative hypothesis (default: two-sided) |
| std::invalid_argument | If either sample has less than 2 elements or variance is zero |
Definition at line 284 of file parametric_tests.hpp.
| test_result statcpp::t_test_welch | ( | Iterator1 | first1, |
| Iterator1 | last1, | ||
| Iterator2 | first2, | ||
| Iterator2 | last2, | ||
| alternative_hypothesis | alt = alternative_hypothesis::two_sided |
||
| ) |
Two-sample t-test (Welch's method)
Tests whether the means of two independent samples are equal. Does not assume equal variance; uses Welch-Satterthwaite approximation for degrees of freedom.
| Iterator1 | Input iterator type for first sample |
| Iterator2 | Input iterator type for second sample |
| first1 | Beginning iterator of first sample |
| last1 | End iterator of first sample |
| first2 | Beginning iterator of second sample |
| last2 | End iterator of second sample |
| alt | Type of alternative hypothesis (default: two-sided) |
| std::invalid_argument | If either sample has less than 2 elements or variance is zero |
Definition at line 345 of file parametric_tests.hpp.
|
inline |
Convert t-value to correlation coefficient.
| t | t-statistic |
| df | Degrees of freedom |
Definition at line 249 of file effect_size.hpp.
|
inline |
Little's MCAR test (simplified version)
Tests whether the mean difference between complete and incomplete data is significant, determining if data is MCAR (Missing Completely At Random).
| data | 2D data for testing (rows: observations, columns: variables) |
| std::invalid_argument | If data is empty |
Definition at line 209 of file missing_data.hpp.
|
inline |
Gamma function.
Computes the gamma function Gamma(x).
| x | Argument |
| std::domain_error | If x is a non-positive integer |
Definition at line 116 of file special_functions.hpp.
| double statcpp::trimmed_mean | ( | Iterator | first, |
| Iterator | last, | ||
| double | proportion | ||
| ) |
Trimmed mean (accepts a sorted range. proportion: exclusion ratio per side, 0.0 to less than 0.5)
Computes the mean after excluding a certain proportion of data from both ends. Useful for reducing the influence of outliers.
| Iterator | Iterator type |
| first | Begin iterator |
| last | End iterator |
| proportion | Exclusion ratio per side (0.0 to less than 0.5) |
| std::invalid_argument | If range is empty, proportion is out of range, or all elements are excluded |
Definition at line 590 of file basic_statistics.hpp.
| double statcpp::trimmed_mean | ( | Iterator | first, |
| Iterator | last, | ||
| double | proportion, | ||
| Projection | proj | ||
| ) |
Trimmed mean of projected values using a lambda expression (projection results must be in sorted order)
Computes the trimmed mean of the results after applying a projection function to each element. Assumes that projection results are sorted.
| Iterator | Iterator type |
| Projection | Projection function type |
| first | Begin iterator |
| last | End iterator |
| proportion | Exclusion ratio per side (0.0 to less than 0.5) |
| proj | Projection function |
| std::invalid_argument | If range is empty, proportion is out of range, or all elements are excluded |
Definition at line 634 of file basic_statistics.hpp.
|
inline |
Perform Tukey's Honestly Significant Difference (HSD) test.
Performs all pairwise comparisons among groups using the studentized range distribution (Tukey-Kramer method for unequal sample sizes).
The q statistic is computed as |mean_i - mean_j| / SE where SE = sqrt(MSE/2 * (1/n_i + 1/n_j)), and p-values are obtained from the studentized range distribution with k groups and df_error degrees of freedom.
| anova_result | Result from one-way ANOVA |
| groups | Data for each group (currently unused; retained for API compatibility and potential future use such as input validation) |
| alpha | Significance level (default: 0.05) |
| std::invalid_argument | If alpha is outside the range (0, 1) |
|
inline |
Perform two-way analysis of variance (with replication)
Tests the effects of two factors (A, B) and their interaction on the dependent variable. Assumes equal cell sizes.
| data | 3-dimensional data array. data[i][j] is the vector of observations for factor A=i, factor B=j |
| std::invalid_argument | If number of levels for factor A is less than 2 |
| std::invalid_argument | If number of levels for factor B is less than 2 |
| std::invalid_argument | If number of levels for factor B is inconsistent |
| std::invalid_argument | If cell sizes are unequal |
| std::invalid_argument | If an empty cell exists |
|
inline |
Uniform distribution cumulative distribution function (CDF)
F(x) = (x - a) / (b - a)
| x | Random variable value |
| a | Lower bound (default: 0.0) |
| b | Upper bound (default: 1.0) |
| std::invalid_argument | If a >= b |
Definition at line 60 of file continuous_distributions.hpp.
|
inline |
Uniform distribution probability density function (PDF)
f(x) = 1 / (b - a) for a <= x <= b
| x | Random variable value |
| a | Lower bound (default: 0.0) |
| b | Upper bound (default: 1.0) |
| std::invalid_argument | If a >= b |
Definition at line 38 of file continuous_distributions.hpp.
|
inline |
Uniform distribution quantile function (inverse CDF)
Q(p) = a + p * (b - a)
| p | Probability (0 <= p <= 1) |
| a | Lower bound (default: 0.0) |
| b | Upper bound (default: 1.0) |
| std::invalid_argument | If a >= b or p is outside [0, 1] |
Definition at line 81 of file continuous_distributions.hpp.
| double statcpp::uniform_rand | ( | double | a, |
| double | b, | ||
| Engine & | engine | ||
| ) |
Uniform distribution random number generation.
| Engine | Random engine type |
| a | Lower bound |
| b | Upper bound |
| engine | Random engine |
| std::invalid_argument | If a >= b |
Definition at line 103 of file continuous_distributions.hpp.
|
inline |
Uniform distribution random number generation (using default engine)
| a | Lower bound (default: 0.0) |
| b | Upper bound (default: 1.0) |
Definition at line 119 of file continuous_distributions.hpp.
|
inline |
Data validation.
| data | Data vector |
| allow_missing | Allow missing values |
| allow_infinite | Allow infinite values |
| allow_negative | Allow negative values |
Definition at line 1109 of file data_wrangling.hpp.
|
inline |
Range validation.
| data | Data vector |
| min_val | Minimum value |
| max_val | Maximum value |
Definition at line 1149 of file data_wrangling.hpp.
| std::map< T, std::size_t > statcpp::value_counts | ( | const std::vector< T > & | data | ) |
Count duplicates.
| T | Data type |
| data | Data vector |
Definition at line 744 of file data_wrangling.hpp.
| double statcpp::var | ( | Iterator | first, |
| Iterator | last, | ||
| double | precomputed_mean, | ||
| std::size_t | ddof | ||
| ) |
Variance using precomputed mean (with ddof)
Use when the mean has been precomputed.
| Iterator | Iterator type |
| first | Begin iterator |
| last | End iterator |
| precomputed_mean | Precomputed mean value |
| ddof | Degrees of freedom correction (0 or 1) |
| std::invalid_argument | If range is empty, ddof is not 0 or 1, or ddof=1 with fewer than 2 elements |
Definition at line 147 of file dispersion_spread.hpp.
| double statcpp::var | ( | Iterator | first, |
| Iterator | last, | ||
| Projection | proj, | ||
| double | precomputed_mean, | ||
| std::size_t | ddof | ||
| ) |
Variance of projected values using precomputed mean (with ddof)
Computes variance using a projection function and precomputed mean.
| Iterator | Iterator type |
| Projection | Projection function type |
| first | Begin iterator |
| last | End iterator |
| proj | Projection function |
| precomputed_mean | Precomputed mean value |
| ddof | Degrees of freedom correction (0 or 1) |
| std::invalid_argument | If range is empty, ddof is not 0 or 1, or ddof=1 with fewer than 2 elements |
Definition at line 222 of file dispersion_spread.hpp.
| double statcpp::var | ( | Iterator | first, |
| Iterator | last, | ||
| Projection | proj, | ||
| std::size_t | ddof = 0 |
||
| ) |
Variance of projected values using a lambda expression (with ddof)
Computes the variance of results after applying a projection function to each element.
| Iterator | Iterator type |
| Projection | Projection function type |
| first | Begin iterator |
| last | End iterator |
| proj | Projection function |
| ddof | Degrees of freedom correction (0 or 1) |
| std::invalid_argument | If range is empty, ddof is not 0 or 1, or ddof=1 with fewer than 2 elements |
Definition at line 185 of file dispersion_spread.hpp.
| double statcpp::var | ( | Iterator | first, |
| Iterator | last, | ||
| std::size_t | ddof = 0 |
||
| ) |
Variance (ddof = Delta Degrees of Freedom)
ddof = 0: Population variance (divide by N) ddof = 1: Sample variance / unbiased variance (divide by N-1)
| Iterator | Iterator type |
| first | Begin iterator |
| last | End iterator |
| ddof | Degrees of freedom correction (0 or 1) |
| std::invalid_argument | If range is empty, ddof is not 0 or 1, or ddof=1 with fewer than 2 elements |
Definition at line 112 of file dispersion_spread.hpp.
| double statcpp::variance | ( | Iterator | first, |
| Iterator | last | ||
| ) |
Variance (alias for sample_variance)
Computes sample variance. Equivalent to sample_variance.
| Iterator | Iterator type |
| first | Begin iterator |
| last | End iterator |
| std::invalid_argument | If the range is empty or has fewer than 2 elements |
Definition at line 420 of file dispersion_spread.hpp.
| double statcpp::variance | ( | Iterator | first, |
| Iterator | last, | ||
| double | precomputed_mean | ||
| ) |
Variance using precomputed mean.
Computes sample variance when the mean has been precomputed.
| Iterator | Iterator type |
| first | Begin iterator |
| last | End iterator |
| precomputed_mean | Precomputed mean value |
| std::invalid_argument | If the range is empty or has fewer than 2 elements |
Definition at line 438 of file dispersion_spread.hpp.
| double statcpp::variance | ( | Iterator | first, |
| Iterator | last, | ||
| Projection | proj | ||
| ) |
Variance of projected values using a lambda expression.
Computes the sample variance of results after applying a projection function to each element.
| Iterator | Iterator type |
| Projection | Projection function type |
| first | Begin iterator |
| last | End iterator |
| proj | Projection function |
| std::invalid_argument | If the range is empty or has fewer than 2 elements |
Definition at line 460 of file dispersion_spread.hpp.
| double statcpp::variance | ( | Iterator | first, |
| Iterator | last, | ||
| Projection | proj, | ||
| double | precomputed_mean | ||
| ) |
Variance of projected values using precomputed mean.
Computes sample variance using a projection function and precomputed mean.
| Iterator | Iterator type |
| Projection | Projection function type |
| first | Begin iterator |
| last | End iterator |
| proj | Projection function |
| precomputed_mean | Precomputed mean value |
| std::invalid_argument | If the range is empty or has fewer than 2 elements |
Definition at line 480 of file dispersion_spread.hpp.
|
inline |
Weibull distribution cumulative distribution function (CDF)
F(x) = 1 - exp(-(x/lambda)^k)
| x | Random variable value |
| shape | Shape parameter k |
| scale | Scale parameter lambda (default: 1.0) |
| std::invalid_argument | If shape <= 0 or scale <= 0 |
Definition at line 1138 of file continuous_distributions.hpp.
|
inline |
Weibull distribution probability density function (PDF)
f(x) = (k/lambda) * (x/lambda)^(k-1) * exp(-(x/lambda)^k)
| x | Random variable value |
| shape | Shape parameter k |
| scale | Scale parameter lambda (default: 1.0) |
| std::invalid_argument | If shape <= 0 or scale <= 0 |
Definition at line 1103 of file continuous_distributions.hpp.
|
inline |
Weibull distribution quantile function.
Q(p) = lambda * (-ln(1 - p))^(1/k)
| p | Probability (0 <= p <= 1) |
| shape | Shape parameter k |
| scale | Scale parameter lambda (default: 1.0) |
| std::invalid_argument | If shape <= 0, scale <= 0, or p is outside [0, 1] |
Definition at line 1164 of file continuous_distributions.hpp.
| double statcpp::weibull_rand | ( | double | shape, |
| double | scale, | ||
| Engine & | engine | ||
| ) |
Weibull distribution random number generation.
| Engine | Random engine type |
| shape | Shape parameter k |
| scale | Scale parameter lambda |
| engine | Random engine |
| std::invalid_argument | If shape <= 0 or scale <= 0 |
Definition at line 1191 of file continuous_distributions.hpp.
|
inline |
Weibull distribution random number generation (using default engine)
| shape | Shape parameter k |
| scale | Scale parameter lambda (default: 1.0) |
Definition at line 1210 of file continuous_distributions.hpp.
| double statcpp::weighted_covariance | ( | Iterator1 | first1, |
| Iterator1 | last1, | ||
| Iterator2 | first2, | ||
| Iterator2 | last2, | ||
| WeightIterator | weight_first | ||
| ) |
Weighted covariance.
Computes covariance with weights applied. Applies Bessel correction.
| Iterator1 | Iterator type for the first data |
| Iterator2 | Iterator type for the second data |
| WeightIterator | Iterator type for weights |
| first1 | Begin iterator for the first data |
| last1 | End iterator for the first data |
| first2 | Begin iterator for the second data |
| last2 | End iterator for the second data |
| weight_first | Begin iterator for weights |
| std::invalid_argument | If range is empty, lengths differ, negative weight exists, or sum of weights is zero |
Definition at line 925 of file correlation_covariance.hpp.
| double statcpp::weighted_covariance | ( | Iterator1 | first1, |
| Iterator1 | last1, | ||
| Iterator2 | first2, | ||
| Iterator2 | last2, | ||
| WeightIterator | weight_first, | ||
| Projection1 | proj1, | ||
| Projection2 | proj2 | ||
| ) |
Weighted covariance (projection version)
| Iterator1 | Iterator type for the first data |
| Iterator2 | Iterator type for the second data |
| WeightIterator | Iterator type for weights |
| Projection1 | Projection function type for the first data |
| Projection2 | Projection function type for the second data |
| first1 | Begin iterator for the first data |
| last1 | End iterator for the first data |
| first2 | Begin iterator for the second data |
| last2 | End iterator for the second data |
| weight_first | Begin iterator for weights |
| proj1 | Projection function for the first data |
| proj2 | Projection function for the second data |
| std::invalid_argument | If range is empty, lengths differ, negative weight exists, or sum of weights is zero |
Definition at line 1019 of file correlation_covariance.hpp.
| double statcpp::weighted_harmonic_mean | ( | Iterator | first, |
| Iterator | last, | ||
| WeightIterator | weight_first | ||
| ) |
Weighted harmonic mean.
Computes the harmonic mean with weights applied to each element.
| Iterator | Iterator type |
| WeightIterator | Weight iterator type |
| first | Begin iterator |
| last | End iterator |
| weight_first | Begin iterator for weights |
| std::invalid_argument | If range is empty, if negative weight exists, if value is zero, or if sum of weights is zero |
Definition at line 939 of file basic_statistics.hpp.
| double statcpp::weighted_harmonic_mean | ( | Iterator | first, |
| Iterator | last, | ||
| WeightIterator | weight_first, | ||
| Projection | proj | ||
| ) |
Weighted harmonic mean (projection version)
Computes the weighted harmonic mean of the results after applying a projection function to each element.
| Iterator | Iterator type |
| WeightIterator | Weight iterator type |
| Projection | Projection function type |
| first | Begin iterator |
| last | End iterator |
| weight_first | Begin iterator for weights |
| proj | Projection function |
| std::invalid_argument | If range is empty, if negative weight exists, if value is zero, or if sum of weights is zero |
Definition at line 1047 of file basic_statistics.hpp.
| double statcpp::weighted_harmonic_mean | ( | Iterator | first, |
| Iterator | last, | ||
| WeightIterator | weight_first, | ||
| WeightIterator | weight_last | ||
| ) |
Weighted harmonic mean (safe range version)
Computes the harmonic mean with weights applied to each element. Validates that data and weight ranges have the same size.
| Iterator | Iterator type |
| WeightIterator | Weight iterator type |
| first | Begin iterator |
| last | End iterator |
| weight_first | Begin iterator for weights |
| weight_last | End iterator for weights |
| std::invalid_argument | If range is empty, if ranges differ in size, if negative weight exists, if value is zero, or if sum of weights is zero |
Definition at line 885 of file basic_statistics.hpp.
| double statcpp::weighted_harmonic_mean | ( | Iterator | first, |
| Iterator | last, | ||
| WeightIterator | weight_first, | ||
| WeightIterator | weight_last, | ||
| Projection | proj | ||
| ) |
Weighted harmonic mean (safe range version with projection)
Computes the weighted harmonic mean of the results after applying a projection function to each element. Validates that data and weight ranges have the same size.
| Iterator | Iterator type |
| WeightIterator | Weight iterator type |
| Projection | Projection function type |
| first | Begin iterator |
| last | End iterator |
| weight_first | Begin iterator for weights |
| weight_last | End iterator for weights |
| proj | Projection function |
| std::invalid_argument | If range is empty, if ranges differ in size, if negative weight exists, if value is zero, or if sum of weights is zero |
Definition at line 991 of file basic_statistics.hpp.
| double statcpp::weighted_mean | ( | Iterator | first, |
| Iterator | last, | ||
| WeightIterator | weight_first | ||
| ) |
Definition at line 715 of file basic_statistics.hpp.
| double statcpp::weighted_mean | ( | Iterator | first, |
| Iterator | last, | ||
| WeightIterator | weight_first, | ||
| Projection | proj | ||
| ) |
Definition at line 796 of file basic_statistics.hpp.
| double statcpp::weighted_mean | ( | Iterator | first, |
| Iterator | last, | ||
| WeightIterator | weight_first, | ||
| WeightIterator | weight_last | ||
| ) |
Weighted mean.
Computes the mean with weights applied to each element.
| Iterator | Iterator type |
| WeightIterator | Weight iterator type |
| first | Begin iterator |
| last | End iterator |
| weight_first | Begin iterator for weights |
| std::invalid_argument | If range is empty, if negative weight exists, or if sum of weights is zero |
Definition at line 680 of file basic_statistics.hpp.
| double statcpp::weighted_mean | ( | Iterator | first, |
| Iterator | last, | ||
| WeightIterator | weight_first, | ||
| WeightIterator | weight_last, | ||
| Projection | proj | ||
| ) |
Weighted mean (projection version)
Computes the weighted mean of the results after applying a projection function to each element.
| Iterator | Iterator type |
| WeightIterator | Weight iterator type |
| Projection | Projection function type |
| first | Begin iterator |
| last | End iterator |
| weight_first | Begin iterator for weights |
| proj | Projection function |
| std::invalid_argument | If range is empty, if negative weight exists, or if sum of weights is zero |
Definition at line 761 of file basic_statistics.hpp.
| double statcpp::weighted_median | ( | Iterator | first, |
| Iterator | last, | ||
| WeightIterator | weight_first | ||
| ) |
Weighted median.
Calculates the weighted median.
| Iterator | Iterator type |
| WeightIterator | Weight iterator type |
| first | Beginning of range |
| last | End of range |
| weight_first | Beginning of weights |
| std::invalid_argument | If range is empty, weight is negative, or sum of weights is zero |
Definition at line 493 of file order_statistics.hpp.
| double statcpp::weighted_median | ( | Iterator | first, |
| Iterator | last, | ||
| WeightIterator | weight_first, | ||
| Projection | proj | ||
| ) |
Weighted median with projection.
| Iterator | Iterator type |
| WeightIterator | Weight iterator type |
| Projection | Projection function type |
| first | Beginning of range |
| last | End of range |
| weight_first | Beginning of weights |
| proj | Projection function |
| std::invalid_argument | If range is empty, weight is negative, or sum of weights is zero |
Definition at line 651 of file order_statistics.hpp.
| double statcpp::weighted_median | ( | Iterator | first, |
| Iterator | last, | ||
| WeightIterator | weight_first, | ||
| WeightIterator | weight_last | ||
| ) |
Weighted median (safe overload)
Calculates the weighted median with range safety validation.
| Iterator | Iterator type |
| WeightIterator | Weight iterator type |
| first | Beginning of range |
| last | End of range |
| weight_first | Beginning of weights |
| weight_last | End of weights |
| std::invalid_argument | If range is empty, sizes mismatch, weight is negative, or sum of weights is zero |
Definition at line 413 of file order_statistics.hpp.
| double statcpp::weighted_median | ( | Iterator | first, |
| Iterator | last, | ||
| WeightIterator | weight_first, | ||
| WeightIterator | weight_last, | ||
| Projection | proj | ||
| ) |
Weighted median with projection (safe overload)
Calculates the weighted median with range safety validation.
| Iterator | Iterator type |
| WeightIterator | Weight iterator type |
| Projection | Projection function type |
| first | Beginning of range |
| last | End of range |
| weight_first | Beginning of weights |
| weight_last | End of weights |
| proj | Projection function |
| std::invalid_argument | If range is empty, sizes mismatch, weight is negative, or sum of weights is zero |
Definition at line 571 of file order_statistics.hpp.
| double statcpp::weighted_percentile | ( | Iterator | first, |
| Iterator | last, | ||
| WeightIterator | weight_first, | ||
| double | p | ||
| ) |
Weighted percentile.
Calculates the weighted percentile.
| Iterator | Iterator type |
| WeightIterator | Weight iterator type |
| first | Beginning of range |
| last | End of range |
| weight_first | Beginning of weights |
| p | Percentile as proportion 0.0-1.0 |
| std::invalid_argument | If parameters are invalid |
Definition at line 814 of file order_statistics.hpp.
| double statcpp::weighted_percentile | ( | Iterator | first, |
| Iterator | last, | ||
| WeightIterator | weight_first, | ||
| double | p, | ||
| Projection | proj | ||
| ) |
Weighted percentile with projection.
| Iterator | Iterator type |
| WeightIterator | Weight iterator type |
| Projection | Projection function type |
| first | Beginning of range |
| last | End of range |
| weight_first | Beginning of weights |
| p | Percentile as proportion 0.0-1.0 |
| proj | Projection function |
| std::invalid_argument | If parameters are invalid |
Definition at line 976 of file order_statistics.hpp.
| double statcpp::weighted_percentile | ( | Iterator | first, |
| Iterator | last, | ||
| WeightIterator | weight_first, | ||
| WeightIterator | weight_last, | ||
| double | p | ||
| ) |
Weighted percentile (safe overload)
Calculates the weighted percentile with range safety validation.
| Iterator | Iterator type |
| WeightIterator | Weight iterator type |
| first | Beginning of range |
| last | End of range |
| weight_first | Beginning of weights |
| weight_last | End of weights |
| p | Percentile as proportion 0.0-1.0 |
| std::invalid_argument | If parameters are invalid or sizes mismatch |
Definition at line 732 of file order_statistics.hpp.
| double statcpp::weighted_percentile | ( | Iterator | first, |
| Iterator | last, | ||
| WeightIterator | weight_first, | ||
| WeightIterator | weight_last, | ||
| double | p, | ||
| Projection | proj | ||
| ) |
Weighted percentile with projection (safe overload)
Calculates the weighted percentile with range safety validation.
| Iterator | Iterator type |
| WeightIterator | Weight iterator type |
| Projection | Projection function type |
| first | Beginning of range |
| last | End of range |
| weight_first | Beginning of weights |
| weight_last | End of weights |
| p | Percentile as proportion 0.0-1.0 |
| proj | Projection function |
| std::invalid_argument | If parameters are invalid or sizes mismatch |
Definition at line 894 of file order_statistics.hpp.
| double statcpp::weighted_stddev | ( | Iterator | first, |
| Iterator | last, | ||
| WeightIterator | weight_first | ||
| ) |
Weighted standard deviation.
Computes the square root of weighted variance.
| Iterator | Iterator type |
| WeightIterator | Weight iterator type |
| first | Begin iterator |
| last | End iterator |
| weight_first | Begin iterator for weights |
| std::invalid_argument | If range is empty, negative weights exist, sum of weights is zero, or insufficient effective sample size |
Definition at line 1446 of file dispersion_spread.hpp.
| double statcpp::weighted_stddev | ( | Iterator | first, |
| Iterator | last, | ||
| WeightIterator | weight_first, | ||
| Projection | proj | ||
| ) |
Weighted standard deviation (projection version)
Computes the weighted standard deviation of results after applying a projection function to each element.
| Iterator | Iterator type |
| WeightIterator | Weight iterator type |
| Projection | Projection function type |
| first | Begin iterator |
| last | End iterator |
| weight_first | Begin iterator for weights |
| proj | Projection function |
| std::invalid_argument | If range is empty, negative weights exist, sum of weights is zero, or insufficient effective sample size |
Definition at line 1492 of file dispersion_spread.hpp.
| double statcpp::weighted_stddev | ( | Iterator | first, |
| Iterator | last, | ||
| WeightIterator | weight_first, | ||
| WeightIterator | weight_last | ||
| ) |
Weighted standard deviation.
Computes the square root of weighted variance.
| Iterator | Iterator type |
| WeightIterator | Weight iterator type |
| first | Begin iterator |
| last | End iterator |
| weight_first | Begin iterator for weights |
| weight_last | End iterator for weights |
| std::invalid_argument | If range is empty, data and weight ranges differ in length, negative weights exist, sum of weights is zero, or insufficient effective sample size |
Definition at line 1424 of file dispersion_spread.hpp.
| double statcpp::weighted_stddev | ( | Iterator | first, |
| Iterator | last, | ||
| WeightIterator | weight_first, | ||
| WeightIterator | weight_last, | ||
| Projection | proj | ||
| ) |
Weighted standard deviation (projection version)
Computes the weighted standard deviation of results after applying a projection function to each element.
| Iterator | Iterator type |
| WeightIterator | Weight iterator type |
| Projection | Projection function type |
| first | Begin iterator |
| last | End iterator |
| weight_first | Begin iterator for weights |
| weight_last | End iterator for weights |
| proj | Projection function |
| std::invalid_argument | If range is empty, data and weight ranges differ in length, negative weights exist, sum of weights is zero, or insufficient effective sample size |
Definition at line 1468 of file dispersion_spread.hpp.
| double statcpp::weighted_variance | ( | Iterator | first, |
| Iterator | last, | ||
| WeightIterator | weight_first | ||
| ) |
Weighted variance (reliability weights / analytic weights)
Computes variance with weights applied to each element. Returns unbiased estimator with Bessel's correction.
| Iterator | Iterator type |
| WeightIterator | Weight iterator type |
| first | Begin iterator |
| last | End iterator |
| weight_first | Begin iterator for weights |
| std::invalid_argument | If range is empty, negative weights exist, sum of weights is zero, or insufficient effective sample size |
Definition at line 1206 of file dispersion_spread.hpp.
| double statcpp::weighted_variance | ( | Iterator | first, |
| Iterator | last, | ||
| WeightIterator | weight_first, | ||
| Projection | proj | ||
| ) |
Weighted variance (projection version)
Computes weighted variance of results after applying a projection function to each element. Returns unbiased estimator with Bessel's correction.
| Iterator | Iterator type |
| WeightIterator | Weight iterator type |
| Projection | Projection function type |
| first | Begin iterator |
| last | End iterator |
| weight_first | Begin iterator for weights |
| proj | Projection function |
| std::invalid_argument | If range is empty, negative weights exist, sum of weights is zero, or insufficient effective sample size |
Definition at line 1356 of file dispersion_spread.hpp.
| double statcpp::weighted_variance | ( | Iterator | first, |
| Iterator | last, | ||
| WeightIterator | weight_first, | ||
| WeightIterator | weight_last | ||
| ) |
Weighted variance (reliability weights / analytic weights)
Computes variance with weights applied to each element. Returns unbiased estimator with Bessel's correction.
| Iterator | Iterator type |
| WeightIterator | Weight iterator type |
| first | Begin iterator |
| last | End iterator |
| weight_first | Begin iterator for weights |
| weight_last | End iterator for weights |
| std::invalid_argument | If range is empty, data and weight ranges differ in length, negative weights exist, sum of weights is zero, or insufficient effective sample size |
Definition at line 1129 of file dispersion_spread.hpp.
| double statcpp::weighted_variance | ( | Iterator | first, |
| Iterator | last, | ||
| WeightIterator | weight_first, | ||
| WeightIterator | weight_last, | ||
| Projection | proj | ||
| ) |
Weighted variance (projection version)
Computes weighted variance of results after applying a projection function to each element. Returns unbiased estimator with Bessel's correction.
| Iterator | Iterator type |
| WeightIterator | Weight iterator type |
| Projection | Projection function type |
| first | Begin iterator |
| last | End iterator |
| weight_first | Begin iterator for weights |
| weight_last | End iterator for weights |
| proj | Projection function |
| std::invalid_argument | If range is empty, data and weight ranges differ in length, negative weights exist, sum of weights is zero, or insufficient effective sample size |
Definition at line 1279 of file dispersion_spread.hpp.
| test_result statcpp::wilcoxon_signed_rank_test | ( | Iterator | first, |
| Iterator | last, | ||
| double | mu0 = 0.0, |
||
| alternative_hypothesis | alt = alternative_hypothesis::two_sided |
||
| ) |
Perform Wilcoxon signed-rank test (one-sample)
Tests whether the median of data equals a specified value. A nonparametric test that does not assume normal distribution. Uses normal approximation (with continuity correction) for p-value calculation.
| Iterator | Input iterator type |
| first | Beginning iterator of range |
| last | Ending iterator of range |
| mu0 | Median under null hypothesis (default: 0.0) |
| alt | Type of alternative hypothesis (default: two-sided) |
| std::invalid_argument | If there are fewer than 2 elements |
| std::invalid_argument | If there are fewer than 2 non-zero differences |
Definition at line 559 of file nonparametric_tests.hpp.
| std::vector< double > statcpp::winsorize | ( | Iterator | first, |
| Iterator | last, | ||
| double | limits = 0.05 |
||
| ) |
Winsorization.
Replaces extreme values with specified percentile values.
| Iterator | Iterator type |
| first | Beginning of range |
| last | End of range |
| limits | Proportion to replace from each tail (e.g., 0.05 = replace top and bottom 5%) |
| std::invalid_argument | If range is empty or limits is invalid |
Definition at line 303 of file robust.hpp.
| test_result statcpp::z_test | ( | Iterator | first, |
| Iterator | last, | ||
| double | mu0, | ||
| double | sigma, | ||
| alternative_hypothesis | alt = alternative_hypothesis::two_sided |
||
| ) |
One-sample z-test (known variance)
Tests whether the sample mean equals a specific value when the population variance is known.
| Iterator | Input iterator type |
| first | Beginning iterator of sample data |
| last | End iterator of sample data |
| mu0 | Population mean under null hypothesis |
| sigma | Known population standard deviation |
| alt | Type of alternative hypothesis (default: two-sided) |
| std::invalid_argument | If sigma is not positive or range is empty |
Definition at line 72 of file parametric_tests.hpp.
|
inline |
One-sample proportion z-test.
Tests whether the sample proportion equals a specific population proportion.
| successes | Number of successes |
| trials | Number of trials |
| p0 | Population proportion under null hypothesis |
| alt | Type of alternative hypothesis (default: two-sided) |
| std::invalid_argument | If p0 is outside (0,1), trials is 0, or successes exceeds trials |
Definition at line 121 of file parametric_tests.hpp.
|
inline |
Two-sample proportion z-test.
Tests whether two sample proportions are equal (using pooled proportion).
| successes1 | Number of successes in first sample |
| trials1 | Number of trials in first sample |
| successes2 | Number of successes in second sample |
| trials2 | Number of trials in second sample |
| alt | Type of alternative hypothesis (default: two-sided) |
| std::invalid_argument | If trials is 0 or successes exceeds trials |
Definition at line 169 of file parametric_tests.hpp.
|
constexpr |
Default absolute tolerance for floating-point comparisons.
Definition at line 29 of file numerical_utils.hpp.
|
constexpr |
Default relative tolerance for floating-point comparisons.
Definition at line 24 of file numerical_utils.hpp.
|
constexpr |
Machine epsilon for double precision.
Definition at line 19 of file numerical_utils.hpp.
|
inlineconstexpr |
Variable template version of is_random_engine.
| T | Type to check |
Definition at line 131 of file random_engine.hpp.
|
inlineconstexpr |
Natural logarithm of sqrt(2*pi)
Definition at line 39 of file special_functions.hpp.
|
inlineconstexpr |
Constant representing NA (NaN)
Definition at line 38 of file data_wrangling.hpp.
|
inlineconstexpr |
Pi constant.
Definition at line 24 of file special_functions.hpp.
|
inlineconstexpr |
Square root of 2.
Definition at line 29 of file special_functions.hpp.
|
inlineconstexpr |
Square root of 2*pi.
Definition at line 34 of file special_functions.hpp.