|
statcpp
C++17 Header-Only Statistics Library
|
Internal helper functions. More...
Functions | |
| template<typename Iterator > | |
| std::vector< double > | compute_ranks (Iterator first, Iterator last) |
| Helper function to compute ranks. | |
| template<typename Iterator , typename Projection > | |
| std::vector< double > | compute_ranks (Iterator first, Iterator last, Projection proj) |
| Rank computation (projection version) | |
| double | link_transform (double mu, link_function link) |
| Link function g(mu) -> eta. | |
| double | inverse_link (double eta, link_function link) |
| Inverse link function g^{-1}(eta) -> mu. | |
| double | link_derivative (double mu, link_function link) |
| Derivative of link function d(eta)/d(mu) = g'(mu) | |
| double | variance_function (double mu, distribution_family family) |
| Variance function V(mu) | |
| double | deviance_residual (double y, double mu, distribution_family family) |
| Calculate deviance (for a single observation) | |
| std::vector< double > | solve_weighted_least_squares (const std::vector< std::vector< double > > &X, const std::vector< double > &z, const std::vector< double > &w, std::vector< std::vector< double > > &XtWX_inv) |
| Solve weighted least squares. | |
| void | validate_matrix_structure (const std::vector< std::vector< double > > &data, const char *func_name) |
| Validate 2D matrix structure. | |
| void | validate_no_intercept_column (const std::vector< std::vector< double > > &X, const char *func_name) |
| Check that X data does not contain an intercept column. | |
| std::vector< std::vector< double > > | transpose (const std::vector< std::vector< double > > &A) |
| Calculate transpose matrix. | |
| std::vector< std::vector< double > > | matrix_multiply (const std::vector< std::vector< double > > &A, const std::vector< std::vector< double > > &B) |
| Calculate matrix product. | |
| std::vector< double > | matrix_vector_multiply (const std::vector< std::vector< double > > &A, const std::vector< double > &v) |
| Calculate matrix-vector product. | |
| std::vector< std::vector< double > > | cholesky (const std::vector< std::vector< double > > &A) |
| Perform Cholesky decomposition. | |
| std::vector< double > | solve_cholesky (const std::vector< std::vector< double > > &L, const std::vector< double > &b) |
| Solve system of equations using Cholesky decomposition. | |
| std::vector< std::vector< double > > | inverse_cholesky (const std::vector< std::vector< double > > &L) |
| Calculate inverse matrix using Cholesky decomposition. | |
| void | standardize_features (const std::vector< std::vector< double > > &X, std::vector< std::vector< double > > &X_scaled, std::vector< double > &X_mean, std::vector< double > &X_std, std::size_t n, std::size_t p) |
| 特徴量の標準化 (平均0, 標準偏差1) | |
| std::vector< double > | rescale_coefficients (const std::vector< double > &beta, const std::vector< double > &X_mean, const std::vector< double > &X_std, double y_mean, std::size_t p, bool standardize) |
| 標準化済み係数を元のスケールに逆変換する | |
| double | noncentrality_parameter_t (double effect_size, double n) |
| Calculate noncentrality parameter for t-distribution. | |
| double | noncentrality_parameter_t_two_sample (double effect_size, double n1, double n2) |
| Calculate noncentrality parameter for two-sample case. | |
| double | critical_t_two_sided (double alpha, double df) |
| Calculate critical value for two-sided t-test. | |
| double | critical_t_one_sided (double alpha, double df) |
| Calculate critical value for one-sided t-test. | |
| double | critical_z_two_sided (double alpha) |
| Calculate critical value for two-sided normal test. | |
| double | critical_z_one_sided (double alpha) |
| Calculate critical value for one-sided normal test. | |
| const char * | alternative_to_string (alternative_hypothesis alt) |
| Convert alternative_hypothesis enum to string. | |
Internal helper functions.
|
inline |
Convert alternative_hypothesis enum to string.
| alt | Alternative hypothesis enum value |
Definition at line 127 of file power_analysis.hpp.
|
inline |
Perform Cholesky decomposition.
Computes lower triangular matrix L such that L * L^T = A for positive definite symmetric matrix A.
| A | Positive definite symmetric matrix |
| std::runtime_error | If matrix is not positive definite |
Definition at line 419 of file linear_regression.hpp.
| std::vector< double > statcpp::detail::compute_ranks | ( | Iterator | first, |
| Iterator | last | ||
| ) |
Helper function to compute ranks.
Uses average rank for ties.
| Iterator | Iterator type |
| first | Begin iterator |
| last | End iterator |
Definition at line 546 of file correlation_covariance.hpp.
| std::vector< double > statcpp::detail::compute_ranks | ( | Iterator | first, |
| Iterator | last, | ||
| Projection | proj | ||
| ) |
Rank computation (projection version)
| Iterator | Iterator type |
| Projection | Projection function type |
| first | Begin iterator |
| last | End iterator |
| proj | Projection function |
Definition at line 596 of file correlation_covariance.hpp.
|
inline |
Calculate critical value for one-sided t-test.
| alpha | Significance level |
| df | Degrees of freedom |
Definition at line 97 of file power_analysis.hpp.
|
inline |
Calculate critical value for two-sided t-test.
| alpha | Significance level |
| df | Degrees of freedom |
Definition at line 86 of file power_analysis.hpp.
|
inline |
Calculate critical value for one-sided normal test.
| alpha | Significance level |
Definition at line 117 of file power_analysis.hpp.
|
inline |
Calculate critical value for two-sided normal test.
| alpha | Significance level |
Definition at line 107 of file power_analysis.hpp.
|
inline |
|
inline |
Calculate inverse matrix using Cholesky decomposition.
| L | Lower triangular matrix from Cholesky decomposition |
Definition at line 489 of file linear_regression.hpp.
|
inline |
|
inline |
Derivative of link function d(eta)/d(mu) = g'(mu)
Calculates the derivative of the link function with respect to the expected value mu.
| mu | Expected value |
| link | Link function to use |
| std::runtime_error | If mu is close to 0 for cloglog link |
|
inline |
|
inline |
Calculate matrix product.
| A | Left matrix (m x n) |
| B | Right matrix (n x p) |
| std::invalid_argument | If matrix dimensions are incompatible |
| std::invalid_argument | If matrix rows are inconsistent |
Definition at line 345 of file linear_regression.hpp.
|
inline |
Calculate matrix-vector product.
| A | Matrix (m x n) |
| v | Vector (n-dimensional) |
| std::invalid_argument | If matrix and vector dimensions are incompatible |
Definition at line 389 of file linear_regression.hpp.
|
inline |
Calculate noncentrality parameter for t-distribution.
| effect_size | Effect size |
| n | Sample size |
Definition at line 63 of file power_analysis.hpp.
|
inline |
Calculate noncentrality parameter for two-sample case.
| effect_size | Effect size |
| n1 | Sample size of group 1 |
| n2 | Sample size of group 2 |
Definition at line 75 of file power_analysis.hpp.
|
inline |
標準化済み係数を元のスケールに逆変換する
Definition at line 424 of file model_selection.hpp.
|
inline |
Solve system of equations using Cholesky decomposition.
Solves A * x = b (where A = L * L^T). Efficiently finds the solution using forward and back substitution.
| L | Lower triangular matrix from Cholesky decomposition |
| b | Right-hand side vector |
Definition at line 454 of file linear_regression.hpp.
|
inline |
Solve weighted least squares.
Computes (X'WX)^{-1} X'Wz using Cholesky decomposition.
| X | Design matrix |
| z | Working variable vector |
| w | Weight vector |
| XtWX_inv | Output: inverse of (X'WX) |
| std::runtime_error | If matrix is not positive definite |
|
inline |
特徴量の標準化 (平均0, 標準偏差1)
Definition at line 393 of file model_selection.hpp.
|
inline |
Calculate transpose matrix.
| A | Input matrix |
| std::invalid_argument | If rows have different column counts |
Definition at line 314 of file linear_regression.hpp.
|
inline |
Validate 2D matrix structure.
Verifies that the matrix is not empty and all rows have the same number of columns.
| data | Matrix to validate |
| func_name | Function name for error messages |
| std::invalid_argument | If matrix is empty |
| std::invalid_argument | If first row is empty |
| std::invalid_argument | If rows have different column counts |
Definition at line 231 of file linear_regression.hpp.
|
inline |
Check that X data does not contain an intercept column.
Warns if the first column is all 1.0, as the user may have mistakenly included an intercept column. The intercept is added automatically within the function, so users don't need to include it.
| X | Predictor matrix |
| func_name | Function name for error messages |
| std::invalid_argument | If the first column is all 1.0 |
Definition at line 276 of file linear_regression.hpp.
|
inline |