|
A library for working with phylogenetic and population genetic data.
v0.32.0
|
|
Go to the documentation of this file. 1 #ifndef GENESIS_UTILS_MATH_REGRESSION_GLM_H_
2 #define GENESIS_UTILS_MATH_REGRESSION_GLM_H_
189 std::vector<double>
const& y_response,
193 GlmControl
const& control = {}
205 Matrix<double>
const& x_predictors,
206 std::vector<double>
const& y_response,
207 GlmFamily
const& family,
208 GlmExtras
const& extras = {},
209 GlmControl
const& control = {}
219 Matrix<double>
const& x_predictors,
220 std::vector<double>
const& y_response,
221 GlmExtras
const& extras = {},
222 GlmControl
const& control = {}
262 Matrix<double>
const& x_predictors,
263 std::vector<double>
const& y_response,
264 GlmOutput
const& output,
265 std::vector<double>
const& betas
285 Matrix<double>
const& x_predictors,
286 std::vector<double>
const& y_response,
288 GlmOutput
const& output,
289 std::vector<double>
const& betas
304 Matrix<double>
const& x_predictors,
305 std::vector<double>
const& y_response,
306 GlmOutput
const& output
320 Matrix<double>
const& x_predictors,
321 std::vector<double>
const& y_response,
323 GlmOutput
const& output
329 #endif // include guard
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().
size_t rank
Rank of X after regression on strata.
double scale
Scale factor (scalar).
size_t max_iterations
Maximum number of iterations to run the IRLS algorithm for (if needed).
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).
Matrix< double > Xb
Orthogonal basis for X space (N * M matrix, with N * rank being used).
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().
double null_deviance
Null deviance.
std::vector< double > tri
Upper unit triangular transformation matrix, with Xb - tr.Xb placed in the diagonal (size (M * (M+1))...
std::vector< double > weights
Weights (size N)
double max_r2
Threshold for singluarities. Internally used as eta = 1.0 - max_r2.
Container namespace for all symbols of genesis in order to keep them separate when used as a library.
double epsilon
Proportional change in weighted sum of squares residuals to declare convergence between two iteration...
size_t df_resid
Residual degrees of freedom.
std::vector< double > glm_estimate_betas(GlmOutput const &output)
Compute the beta estimates resulting from a glm_fit().
std::vector< double > which
Which columns in the X matrix were estimated (first = 0) (size M).
std::vector< double > fitted
Fitted values (size N).
std::vector< double > betaQ
Vector of parameter estimates (in terms of basis matrix, Xb) (size M).
std::vector< double > resid
Working residuals (on linear predictor scale) (size N).