17#ifndef __math_stats_glm_h__
18#define __math_stats_glm_h__
69 matrix_type (matrix_type::Zero (X.rows(), X.rows()))),
70 Rz (matrix_type::Identity (X.rows(), X.rows()) - Hz),
81 const size_t rank_x, rank_z;
88 i (
index) { check_nonzero(); }
91 c (check_rank (in,
index)),
94 i (
index) { check_nonzero(); }
99 ssize_t cols()
const {
return c.cols(); }
100 size_t rank()
const {
return r; }
101 bool is_F()
const {
return F; }
102 std::string name()
const {
return std::string(F ?
"F" :
"t") +
str(i+1); }
110 void check_nonzero()
const;
221 assert (
y.rows() ==
M.rows());
246 size_t num_inputs ()
const {
return M.rows(); }
247 size_t num_elements ()
const {
return y.cols(); }
248 size_t num_hypotheses ()
const {
return c.size(); }
250 virtual size_t num_factors()
const {
return M.cols(); }
255 std::shared_ptr<Math::Zstatistic>
stat2z;
329 size_t num_variance_groups()
const {
return num_vgs; }
393 size_t num_factors()
const override {
return M.cols() +
importers.size(); }
401 matrix_type::ConstColXpr data,
448 size_t num_factors()
const override {
return M.cols() +
importers.size(); }
449 size_t num_variance_groups()
const {
return num_vgs; }
a class to hold a named list of Option's
a class for storing bitwise information
vector_type gamma_weights
void get_mask(const size_t ie, BitSet &, const matrix_type &extra_columns) const
vector< default_type > one_over_dof
void all_stats(const matrix_type &measurements, const matrix_type &design, const vector< Hypothesis > &hypotheses, const index_array_type &variance_groups, matrix_type &betas, matrix_type &abs_effect_size, matrix_type &std_effect_size, matrix_type &stdev)
vector_type gamma_weights
const vector< Hypothesis > & c
matrix_type solve_betas(const matrix_type &measurements, const matrix_type &design)
std::shared_ptr< Math::Zstatistic > stat2z
void apply_mask_VG(const BitSet &mask, index_array_type &VG_masked, index_array_type &VG_counts) const
vector< size_t > inputs_per_vg
vector_type abs_effect_size(const matrix_type &measurements, const matrix_type &design, const Hypothesis &hypothesis)
const vector< CohortDataImport > & importers
matrix_type stdev(const matrix_type &measurements, const matrix_type &design)
const index_array_type & VG
void apply_mask(const BitSet &mask, matrix_type::ConstColXpr data, const matrix_type &shuffling_matrix, const matrix_type &extra_column_data, matrix_type &Mfull_masked, matrix_type &shuffling_matrix_masked, vector_type &y_masked) const
const bool nans_in_columns
const index_array_type & VG
vector< matrix_type > XtX
vector< Hypothesis::Partition > partitions
vector_type std_effect_size(const matrix_type &measurements, const matrix_type &design, const Hypothesis &hypothesis)
Eigen::Matrix< typename MatrixType::Scalar, Eigen::Dynamic, Eigen::Dynamic > pinv(const MatrixType &M)
return Moore-Penrose pseudo-inverse of M
size_t rank(const MatrixType &M)
const char *const column_ones_description
void check_design(const matrix_type &, const bool)
index_array_type load_variance_groups(const size_t num_inputs)
App::OptionGroup glm_options(const std::string &element_name)
vector< Hypothesis > load_hypotheses(const std::string &file_path)
Eigen::Array< size_t, Eigen::Dynamic, 1 > index_array_type
Eigen::Array< value_type, Eigen::Dynamic, 1 > vector_type
Eigen::Matrix< value_type, Eigen::Dynamic, Eigen::Dynamic > matrix_type
std::string str(const T &value, int precision=0)