|
statcpp
C++17 Header-Only Statistics Library
|
Linear regression analysis. More...
#include "statcpp/basic_statistics.hpp"#include "statcpp/continuous_distributions.hpp"#include "statcpp/correlation_covariance.hpp"#include <cmath>#include <cstddef>#include <limits>#include <stdexcept>#include <string>#include <vector>Go to the source code of this file.
Classes | |
| struct | statcpp::simple_regression_result |
| Structure to store simple regression analysis results. More... | |
| struct | statcpp::multiple_regression_result |
| Structure to store multiple regression analysis results. More... | |
| struct | statcpp::prediction_interval |
| Structure to store prediction interval results. More... | |
| struct | statcpp::residual_diagnostics |
| Structure to store residual diagnostics results. More... | |
Namespaces | |
| namespace | statcpp |
| namespace | statcpp::detail |
| Internal helper functions. | |
Functions | |
| template<typename IteratorX , typename IteratorY > | |
| simple_regression_result | statcpp::simple_linear_regression (IteratorX x_first, IteratorX x_last, IteratorY y_first, IteratorY y_last) |
| Perform simple linear regression. | |
| void | statcpp::detail::validate_matrix_structure (const std::vector< std::vector< double > > &data, const char *func_name) |
| Validate 2D matrix structure. | |
| void | statcpp::detail::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 > > | statcpp::detail::transpose (const std::vector< std::vector< double > > &A) |
| Calculate transpose matrix. | |
| std::vector< std::vector< double > > | statcpp::detail::matrix_multiply (const std::vector< std::vector< double > > &A, const std::vector< std::vector< double > > &B) |
| Calculate matrix product. | |
| std::vector< double > | statcpp::detail::matrix_vector_multiply (const std::vector< std::vector< double > > &A, const std::vector< double > &v) |
| Calculate matrix-vector product. | |
| std::vector< std::vector< double > > | statcpp::detail::cholesky (const std::vector< std::vector< double > > &A) |
| Perform Cholesky decomposition. | |
| std::vector< double > | statcpp::detail::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 > > | statcpp::detail::inverse_cholesky (const std::vector< std::vector< double > > &L) |
| Calculate inverse matrix using Cholesky decomposition. | |
| multiple_regression_result | statcpp::multiple_linear_regression (const std::vector< std::vector< double > > &X, const std::vector< double > &y) |
| Perform multiple linear regression. | |
| double | statcpp::predict (const simple_regression_result &model, double x) |
| Make prediction using simple regression model. | |
| double | statcpp::predict (const multiple_regression_result &model, const std::vector< double > &x) |
| Make prediction using multiple regression model. | |
| template<typename IteratorX > | |
| 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. | |
| template<typename IteratorX > | |
| 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. | |
| template<typename IteratorX , typename IteratorY > | |
| 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. | |
| residual_diagnostics | statcpp::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 > | statcpp::compute_vif (const std::vector< std::vector< double > > &X) |
| Calculate VIF (Variance Inflation Factor) for each predictor. | |
| double | statcpp::correlation_matrix_determinant (const std::vector< std::vector< double > > &X) |
| Calculate determinant of correlation matrix. | |
| double | statcpp::multicollinearity_score (const std::vector< std::vector< double > > &X) |
| Calculate multicollinearity score. | |
| template<typename IteratorY , typename IteratorPred > | |
| 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. | |
| template<typename IteratorY , typename IteratorPred > | |
| 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. | |
Linear regression analysis.
Provides linear regression analysis functionality including simple regression, multiple regression, and polynomial regression. Includes prediction, confidence intervals, residual diagnostics, and multicollinearity diagnostics.
Definition in file linear_regression.hpp.