A library for working with phylogenetic and population genetic data.
v0.32.0
glm.cpp File Reference
#include "genesis/utils/math/regression/glm.hpp"
#include "genesis/utils/core/logging.hpp"
#include "genesis/utils/math/common.hpp"
#include "genesis/utils/math/regression/family.hpp"
#include "genesis/utils/math/regression/helper.hpp"
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <limits>
#include <stdexcept>

Go to the source code of this file.

Namespaces

 genesis
 Container namespace for all symbols of genesis in order to keep them separate when used as a library.
 
 genesis::utils
 

Functions

std::vector< double > glm_coefficients (Matrix< double > const &x_predictors, std::vector< double > const &y_response, GlmLink const &link, GlmOutput const &output)
 Compute the model coefficients of a glm_fit(). More...
 
std::vector< double > glm_coefficients (Matrix< double > const &x_predictors, std::vector< double > const &y_response, GlmOutput const &output)
 Compute the model coefficients of a glm_fit(). More...
 
std::vector< double > glm_estimate_betas (GlmOutput const &output)
 Compute the beta estimates resulting from a glm_fit(). More...
 
std::pair< std::vector< double >, std::vector< double > > glm_estimate_betas_and_var_covar (GlmOutput const &output, std::vector< double > const &meat)
 
std::vector< double > glm_estimate_betas_inv_tri_ (GlmOutput const &output, std::vector< double > const &inv_tri)
 Helper function to compute the betas, given that we have already inverted the tri matrix. More...
 
double glm_estimate_intercept (Matrix< double > const &x_predictors, std::vector< double > const &y_response, GlmLink const &link, GlmOutput const &output, std::vector< double > const &betas)
 Compute the intercept resulting from a glm_fit(). More...
 
double glm_estimate_intercept (Matrix< double > const &x_predictors, std::vector< double > const &y_response, GlmOutput const &output, std::vector< double > const &betas)
 Compute the intercept resulting from a glm_fit(). More...
 
GlmOutput glm_fit (Matrix< double > const &x_predictors, std::vector< double > const &y_response, GlmExtras const &extras={}, GlmControl const &control={})
 Fit a Generalized Linear Model (GLM) using a linear gaussian model. More...
 
GlmOutput glm_fit (Matrix< double > const &x_predictors, std::vector< double > const &y_response, GlmFamily const &family, GlmExtras const &extras={}, GlmControl const &control={})
 Fit a Generalized Linear Model (GLM). More...
 
GlmOutput glm_fit (Matrix< double > const &x_predictors, std::vector< double > const &y_response, GlmFamily const &family, GlmLink const &link, GlmExtras const &extras={}, GlmControl const &control={})
 Fit a Generalized Linear Model (GLM). More...
 
static void glm_gaussian_ (Matrix< double > const &x_predictors, std::vector< double > const &y_response, GlmExtras const &extras, GlmControl const &control, GlmFreedom const &freedom, GlmOutput &result)
 
std::vector< double > glm_inv_tri_ (std::vector< double > const &tri, size_t M)
 Invert diagonal and unit upper triangular matrices stored as one array. More...
 
static void glm_irls_ (Matrix< double > const &x_predictors, std::vector< double > const &y_response, GlmFamily const &family, GlmLink const &link, GlmExtras const &extras, GlmControl const &control, GlmOutput &result)
 
std::vector< double > udu_transpose_ (size_t M, std::vector< double > const &U, double scale)
 Calculate U.D.U-transpose. More...
 
std::vector< double > udvdu_transpose_ (size_t M, std::vector< double > const &U, std::vector< double > const &V, double scale)
 Calculate U.D.V.D.U-transpose. More...