MuGen
Multitrait genetics
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
BetaGrpFt Class Reference

Multivariate multiple regression. More...

#include <MuGen.h>

Inheritance diagram for BetaGrpFt:
[legend]
Collaboration diagram for BetaGrpFt:
[legend]

Public Member Functions

 BetaGrpFt ()
 Default constructor.
 
 BetaGrpFt (const Grp &rsp, const string &predFlNam, const size_t &Npred, const int &nThr)
 Simple constructor. More...
 
 BetaGrpFt (const Grp &rsp, const string &predFlNam, const size_t &Npred, RanIndex &up, const int &nThr)
 Simple constructor with a prior index. More...
 
 BetaGrpFt (const Grp &rsp, const string &predFlNam, const size_t &Npred, RanIndex &low, RanIndex &up, const int &nThr)
 Simple constructor with a prior index and replication. More...
 
 BetaGrpFt (const Grp &rsp, const string &predFlNam, const size_t &Npred, const string &outFlNam, const int &nThr)
 Simple constructor with output file name. More...
 
 BetaGrpFt (const Grp &rsp, const string &predFlNam, const size_t &Npred, RanIndex &up, const string &outFlNam, const int &nThr)
 Simple constructor with a prior index and output file name. More...
 
 BetaGrpFt (const Grp &rsp, const string &predFlNam, const size_t &Npred, RanIndex &low, RanIndex &up, const string &outFlNam, const int &nThr)
 Simple constructor with a prior index, replication and output file name. More...
 
 BetaGrpFt (const Grp &rsp, const string &predFlNam, const size_t &Npred, const double &absLab, const int &nThr)
 Missing data constructor. More...
 
 BetaGrpFt (const Grp &rsp, const string &predFlNam, const size_t &Npred, const double &absLab, RanIndex &up, const int &nThr)
 Missing data constructor with a prior index. More...
 
 BetaGrpFt (const Grp &rsp, const string &predFlNam, const size_t &Npred, const double &absLab, RanIndex &low, RanIndex &up, const int &nThr)
 Missing data constructor with a prior index and replication. More...
 
 BetaGrpFt (const Grp &rsp, const string &predFlNam, const size_t &Npred, const double &absLab, const string &outFlNam, const int &nThr)
 Missing data constructor with output file name. More...
 
 BetaGrpFt (const Grp &rsp, const string &predFlNam, const size_t &Npred, const double &absLab, RanIndex &up, const string &outFlNam, const int &nThr)
 Missing data constructor with a prior index and output file name. More...
 
 BetaGrpFt (const Grp &rsp, const string &predFlNam, const size_t &Npred, const double &absLab, RanIndex &low, RanIndex &up, const string &outFlNam, const int &nThr)
 Missing data constructor with a prior index, replication and output file name. More...
 
 BetaGrpFt (const Grp &rsp, const SigmaI &SigI, const string &predFlNam, const size_t &Npred, const double &Nmul, const double &rSqMax, RanIndex &up, const string &outFlNam, const int &nThr)
 Selection constructor. More...
 
 BetaGrpFt (const Grp &rsp, const SigmaI &SigI, const string &predFlNam, const size_t &Npred, const double &Nmul, const double &rSqMax, RanIndex &low, RanIndex &up, const string &outFlNam, const int &nThr)
 Selection constructor with replication. More...
 
 BetaGrpFt (const Grp &rsp, const SigmaI &SigI, const string &predFlNam, const size_t &Npred, const double &Nmul, const double &rSqMax, const double &absLab, RanIndex &up, const string &outFlNam, const int &nThr)
 Selection constructor with missing predictor data. More...
 
 BetaGrpFt (const Grp &rsp, const SigmaI &SigI, const string &predFlNam, const size_t &Npred, const double &Nmul, const double &rSqMax, const double &absLab, RanIndex &low, RanIndex &up, const string &outFlNam, const int &nThr)
 Selection constructor with missing predictor data and replication. More...
 
virtual ~BetaGrpFt ()
 Destructor.
 
 BetaGrpFt (const BetaGrpFt &mG)
 Copy constructor. More...
 
BetaGrpFtoperator= (const BetaGrpFt &mG)
 Assignment operator. More...
 
virtual const gsl_matrix * fMat () const
 Access to the fitted value matrix. More...
 
void save (const SigmaI &SigI)
 Store samples. More...
 
void dump ()
 Dump to a file. More...
 
double lnOddsRat (const Grp &y, const SigmaI &SigI, const size_t i) const
 Log-odds ratio. More...
 
void update (const Grp &dat, const SigmaI &SigIm)
 Gaussian likelihood, improper prior. More...
 
void update (const Grp &dat, const Qgrp &q, const SigmaI &SigIm)
 Student- \(t\) likelihood, improper prior. More...
 
virtual void update (const Grp &dat, const SigmaI &SigIm, const SigmaI &SigIp)
 Gaussian likelihood, 0-mean Gaussian prior. More...
 
virtual void update (const Grp &dat, const Qgrp &q, const SigmaI &SigIm, const SigmaI &SigIp)
 Student- \(t\) likelihood, 0-mean Gaussian prior. More...
 
virtual void update (const Grp &dat, const SigmaI &SigIm, const Qgrp &qPr, const SigmaI &SigIp)
 Gaussian likelihood, 0-mean Student- \(t\) prior. More...
 
virtual void update (const Grp &dat, const Qgrp &q, const SigmaI &SigIm, const Qgrp &qPr, const SigmaI &SigIp)
 Student- \(t\) likelihood, 0-mean Student- \(t\) prior. More...
 
virtual void update (const Grp &dat, const SigmaI &SigIm, const Grp &muPr, const SigmaI &SigIp)
 Gaussian likelihood, non-zero mean Gaussian prior. More...
 
virtual void update (const Grp &dat, const Qgrp &q, const SigmaI &SigIm, const Grp &muPr, const SigmaI &SigIp)
 Student- \(t\) likelihood, non-zero mean Gaussian prior. More...
 
virtual void update (const Grp &dat, const SigmaI &SigIm, const Grp &muPr, const Qgrp &qPr, const SigmaI &SigIp)
 Gaussian likelihood, non-zero mean Student- \(t\) prior. More...
 
virtual void update (const Grp &dat, const Qgrp &q, const SigmaI &SigIm, const Grp &muPr, const Qgrp &qPr, const SigmaI &SigIp)
 Student- \(t\) likelihood, non-zero mean Student- \(t\) prior. More...
 
- Public Member Functions inherited from Grp
virtual ~Grp ()
 Destructor.
 
virtual void save ()
 Save to pre-specified file. More...
 
virtual void save (const string &outFlNam)
 Save to file. More...
 
virtual void save (const string &outMuFlNam, const string &outSigFlNam, const SigmaI &SigI)
 Joint save. More...
 
virtual void save (const Grp &y, const SigmaI &SigI)
 Save with data and inverse-covariance. More...
 
void mhlSave (const string &outFlNam, const SigmaI SigI)
 Save Mahalanobis distance. More...
 
const vector< MVnorm * > & dataVec () const
 Get vector of row pointers. More...
 
virtual const gsl_matrix * dMat () const
 Access the value matrix. More...
 
const size_t Ndata () const
 Get number of rows. More...
 
const size_t phenD () const
 Get number of traits. More...
 
const MVnormoperator[] (const size_t i) const
 Subscript operator. More...
 
MVnormoperator[] (const size_t i)
 Subscript operator. More...
 
virtual MuGrp mean (RanIndex &grp)
 Group mean. More...
 
virtual const MuGrp mean (RanIndex &grp) const
 Group mean. More...
 
virtual MuGrp mean (RanIndex &grp, const Qgrp &q)
 Group weighted mean. More...
 
virtual const MuGrp mean (RanIndex &grp, const Qgrp &q) const
 Group weighted mean. More...
 
void center ()
 Center the value matrix. More...
 

Protected Member Functions

virtual void _updateFitted ()
 Update fitted values.
 
void _rankPred (const gsl_matrix *y, const SigmaI &SigI, gsl_vector *XtX, gsl_permutation *prm)
 Rank predictors. More...
 
void _rankPred (const gsl_matrix *y, const SigmaI &SigI, const double &absLab, gsl_vector *XtX, gsl_permutation *prm)
 Rank predictors with missing data. More...
 
void _ldToss (const gsl_vector *var, const gsl_permutation *prm, const double &rSqMax, const size_t &Npck, vector< vector< size_t > > &idx, vector< vector< size_t > > &rLd, gsl_matrix *Xpck)
 Testing candidates for correlation. More...
 
virtual double _MGkernel (const Grp &dat, const SigmaI &SigI) const
 Gaussian kernel. More...
 
virtual double _MGkernel (const Grp &dat, const SigmaI &SigI, const size_t &prInd) const
 Gaussian kernel dropping one predictor. More...
 
- Protected Member Functions inherited from Grp
 Grp ()
 

Protected Attributes

vector< vector< double > > _fittedEach
 Partial fitted value matrices. More...
 
gsl_matrix * _fittedAll
 Matrix of fitted values. More...
 
gsl_matrix * _valueSum
 Sample storage matrix. More...
 
gsl_matrix * _Xmat
 Predictor matrix. More...
 
int _nThr
 Number of threads.
 
double _numSaves
 Number of saves. More...
 
- Protected Attributes inherited from Grp
vector< MVnorm * > _theta
 Vector of pointers to value rows. More...
 
gsl_matrix * _valueMat
 Value matrix. More...
 
RanIndex_lowLevel
 Lower level index. More...
 
RanIndex_upLevel
 Upper level index. More...
 
vector< gsl_rng * > _rV
 Vector of PNG pointers. More...
 
string _outFlNam
 Name of the output file.
 

Detailed Description

Multivariate multiple regression.

Implements multivariate (multitrait) regression with multiple predictors. A single predictor is treated as a special case internally, the user does not have to do anything different. A variety for penalized regression methods is available, implemented through priors and pre-selection of variables, although the latter is still experimental. As the number of predictors grows, the computational burden increases and updates involving these objects become bottlenecks in the Markov chain computation. Therefore, great care has been taken to optimize computation for this class, sometimes at the expense of error checking.

Constructor & Destructor Documentation

◆ BetaGrpFt() [1/17]

BetaGrpFt::BetaGrpFt ( const Grp rsp,
const string &  predFlNam,
const size_t &  Npred,
const int &  nThr 
)

Simple constructor.

Reads the predictor from a file and initiates regression coefficients using the provided response data. Number of rows of the predictor is equal to the number of rows in the response (no replication). No upper index is specified, so this object will implement a regression with an improper flat prior. Caution is advised if the number of predictors approaches the number of rows in the response, since inference will not be well-conditioned.

Parameters
[in]Grp&response
[in]srting&predictor file name
[in]size_t&number of predictors
[in]int&number of threads

◆ BetaGrpFt() [2/17]

BetaGrpFt::BetaGrpFt ( const Grp rsp,
const string &  predFlNam,
const size_t &  Npred,
RanIndex up,
const int &  nThr 
)

Simple constructor with a prior index.

Reads the predictor from a file and initiates regression coefficients using the provided response data. Number of rows of the predictor is equal to the number of rows in the response (no replication).

Parameters
[in]Grp&response
[in]srting&predictor file name
[in]size_t&number of predictors
[in]RanIndex&index to the prior
[in]int&number of threads

◆ BetaGrpFt() [3/17]

BetaGrpFt::BetaGrpFt ( const Grp rsp,
const string &  predFlNam,
const size_t &  Npred,
RanIndex low,
RanIndex up,
const int &  nThr 
)

Simple constructor with a prior index and replication.

Reads the predictor from a file and initiates regression coefficients using the provided response data. Number of rows of the predictor is equal to the number of groups in the lower (data) index. The number of rows in the response is equal to the number of elements in the low index.

Parameters
[in]Grp&response
[in]srting&predictor file name
[in]size_t&number of predictors
[in]RanIndex&replication index
[in]RanIndex&index to the prior
[in]int&number of threads

◆ BetaGrpFt() [4/17]

BetaGrpFt::BetaGrpFt ( const Grp rsp,
const string &  predFlNam,
const size_t &  Npred,
const string &  outFlNam,
const int &  nThr 
)

Simple constructor with output file name.

Reads the predictor from a file and initiates regression coefficients using the provided response data. Number of rows of the predictor is equal to the number of rows in the response (no replication). No upper index is specified, so this object will implement a regression with an improper flat prior. Caution is advised if the number of predictors approaches the number of rows in the response, since inference will not be well-conditioned.

Parameters
[in]Grp&response
[in]srting&predictor file name
[in]size_t&number of predictors
[in]string&output file name
[in]int&number of threads

◆ BetaGrpFt() [5/17]

BetaGrpFt::BetaGrpFt ( const Grp rsp,
const string &  predFlNam,
const size_t &  Npred,
RanIndex up,
const string &  outFlNam,
const int &  nThr 
)

Simple constructor with a prior index and output file name.

Reads the predictor from a file and initiates regression coefficients using the provided response data. Number of rows of the predictor is equal to the number of rows in the response (no replication).

Parameters
[in]Grp&response
[in]srting&predictor file name
[in]size_t&number of predictors
[in]RanIndex&index to the prior
[in]string&output file name
[in]int&number of threads

◆ BetaGrpFt() [6/17]

BetaGrpFt::BetaGrpFt ( const Grp rsp,
const string &  predFlNam,
const size_t &  Npred,
RanIndex low,
RanIndex up,
const string &  outFlNam,
const int &  nThr 
)

Simple constructor with a prior index, replication and output file name.

Reads the predictor from a file and initiates regression coefficients using the provided response data. Number of rows of the predictor is equal to the number of groups in the lower (data) index. The number of rows in the response is equal to the number of elements in the low index

Parameters
[in]Grp&response
[in]srting&predictor file name
[in]size_t&number of predictors
[in]RanIndex&replication index
[in]RanIndex&index to the prior
[in]string&output file name
[in]int&number of threads

◆ BetaGrpFt() [7/17]

BetaGrpFt::BetaGrpFt ( const Grp rsp,
const string &  predFlNam,
const size_t &  Npred,
const double &  absLab,
const int &  nThr 
)

Missing data constructor.

Reads the predictor from a file and initiates regression coefficients using the provided response data. Predictor has missing data labeled by the provided value. Number of rows of the predictor is equal to the number of rows in the response (no replication). No upper index is specified, so this object will implement a regression with an improper flat prior. Caution is advised if the number of predictors approaches the number of rows in the response, since inference will not be well-conditioned.

Parameters
[in]Grp&response
[in]srting&predictor file name
[in]size_t&number of predictors
[in]double&missing data label
[in]int&number of threads

◆ BetaGrpFt() [8/17]

BetaGrpFt::BetaGrpFt ( const Grp rsp,
const string &  predFlNam,
const size_t &  Npred,
const double &  absLab,
RanIndex up,
const int &  nThr 
)

Missing data constructor with a prior index.

Reads the predictor from a file and initiates regression coefficients using the provided response data. Predictor has missing data labeled by the provided value. Number of rows of the predictor is equal to the number of rows in the response (no replication).

Parameters
[in]Grp&response
[in]srting&predictor file name
[in]size_t&number of predictors
[in]double&missing data label
[in]RanIndex&index to the prior
[in]int&number of threads

◆ BetaGrpFt() [9/17]

BetaGrpFt::BetaGrpFt ( const Grp rsp,
const string &  predFlNam,
const size_t &  Npred,
const double &  absLab,
RanIndex low,
RanIndex up,
const int &  nThr 
)

Missing data constructor with a prior index and replication.

Reads the predictor from a file and initiates regression coefficients using the provided response data. Predictor has missing data labeled by the provided value. Number of rows of the predictor is equal to the number of groups in the lower (data) index. The number of rows in the response is equal to the number of elements in the low index

Parameters
[in]Grp&response
[in]srting&predictor file name
[in]size_t&number of predictors
[in]double&missing data label
[in]RanIndex&replication index
[in]RanIndex&index to the prior
[in]int&number of threads

◆ BetaGrpFt() [10/17]

BetaGrpFt::BetaGrpFt ( const Grp rsp,
const string &  predFlNam,
const size_t &  Npred,
const double &  absLab,
const string &  outFlNam,
const int &  nThr 
)

Missing data constructor with output file name.

Reads the predictor from a file and initiates regression coefficients using the provided response data. Predictor has missing data labeled by the provided value. Number of rows of the predictor is equal to the number of rows in the response (no replication). No upper index is specified, so this object will implement a regression with an improper flat prior. Caution is advised if the number of predictors approaches the number of rows in the response, since inference will not be well-conditioned.

Parameters
[in]Grp&response
[in]srting&predictor file name
[in]size_t&number of predictors
[in]double&missing data label
[in]string&output file name
[in]int&number of threads

◆ BetaGrpFt() [11/17]

BetaGrpFt::BetaGrpFt ( const Grp rsp,
const string &  predFlNam,
const size_t &  Npred,
const double &  absLab,
RanIndex up,
const string &  outFlNam,
const int &  nThr 
)

Missing data constructor with a prior index and output file name.

Reads the predictor from a file and initiates regression coefficients using the provided response data. Predictor has missing data labeled by the provided value. Number of rows of the predictor is equal to the number of rows in the response (no replication).

Parameters
[in]Grp&response
[in]srting&predictor file name
[in]size_t&number of predictors
[in]double&missing data label
[in]RanIndex&index to the prior
[in]string&output file name
[in]int&number of threads

◆ BetaGrpFt() [12/17]

BetaGrpFt::BetaGrpFt ( const Grp rsp,
const string &  predFlNam,
const size_t &  Npred,
const double &  absLab,
RanIndex low,
RanIndex up,
const string &  outFlNam,
const int &  nThr 
)

Missing data constructor with a prior index, replication and output file name.

Reads the predictor from a file and initiates regression coefficients using the provided response data. Predictor has missing data labeled by the provided value. Number of rows of the predictor is equal to the number of groups in the lower (data) index. The number of rows in the response is equal to the number of elements in the low index

Parameters
[in]Grp&response
[in]srting&predictor file name
[in]size_t&number of predictors
[in]double&missing data label
[in]RanIndex&replication index
[in]RanIndex&index to the prior
[in]string&output file name
[in]int&number of threads

◆ BetaGrpFt() [13/17]

BetaGrpFt::BetaGrpFt ( const Grp rsp,
const SigmaI SigI,
const string &  predFlNam,
const size_t &  Npred,
const double &  Nmul,
const double &  rSqMax,
RanIndex up,
const string &  outFlNam,
const int &  nThr 
)

Selection constructor.

Unlike the previous constructors, selection-type constructors pre-screen predictors for association with any of the traits (using Hoteling-like multi-trait statistics), and keeps only the specified proportion in the model.
The candidate predictors are further screened for between-predictor correlation and only ones with \( r^2 \) below the provided threshold are kept in the model. This among-predictor correlation often arises in SNP data, where there is likage disequilbrium (LD) among markers. Once the predictors are picked, the updating proceeds like for other BetaGrpFt objects, i.e. the set remains the same (unlike variable selection).

Warning
This set of models is still experimental and has not been extenisively tested. For example, it seems clear that the rest of the model has to be pre-run to convergence before initializing this kind of object. Furthermore, the initializeing predictor probably has to be a mean of several ( \( \sim 50 \)) MCMC samples.
Parameters
[in]Grp&response
[in]SigmaI&data inverse-covariance
[in]srting&predictor file name
[in]size_t&number of predictors
[in]double&fraction of predictors to retain, as a fraction of the number of data points
[in]double&\( r^2 \) cut-off for among-predictor correlation
[in]RanIndex&index to the prior
[in]string&output file name
[in]int&number of threads

◆ BetaGrpFt() [14/17]

BetaGrpFt::BetaGrpFt ( const Grp rsp,
const SigmaI SigI,
const string &  predFlNam,
const size_t &  Npred,
const double &  Nmul,
const double &  rSqMax,
RanIndex low,
RanIndex up,
const string &  outFlNam,
const int &  nThr 
)

Selection constructor with replication.

Unlike the previous constructors, selection-type constructors pre-screen predictors for association with any of the traits (using Hoteling-like multi-trait statistics), and keeps only the specified proportion in the model. The candidate predictors are further screened for between-predictor correlation and only ones with \( r^2 \) below the provided threshold are kept in the model. This among-predictor correlation often arises in SNP data, where there is likage disequilbrium (LD) among markers. Once the predictors are picked, the updating proceeds like for other BetaGrpFt objects, i.e. the set remains the same (unlike variable selection).

Warning
This set of models is still experimental and has not been extenisively tested. For example, it seems clear that the rest of the model has to be pre-run to convergence before initializing this kind of object. Furthermore, the initializeing predictor probably has to be a mean of several ( \( \sim 50 \)) MCMC samples.
Parameters
[in]Grp&response
[in]SigmaI&data inverse-covariance
[in]srting&predictor file name
[in]size_t&number of predictors
[in]double&fraction of predictors to retain, as a fraction of the number of data points
[in]double&\( r^2 \) cut-off for among-predictor correlation
[in]RanIndex&replication index
[in]RanIndex&index to the prior
[in]string&output file name
[in]int&number of threads

◆ BetaGrpFt() [15/17]

BetaGrpFt::BetaGrpFt ( const Grp rsp,
const SigmaI SigI,
const string &  predFlNam,
const size_t &  Npred,
const double &  Nmul,
const double &  rSqMax,
const double &  absLab,
RanIndex up,
const string &  outFlNam,
const int &  nThr 
)

Selection constructor with missing predictor data.

Unlike the previous constructors, selection-type constructors pre-screen predictors for association with any of the traits (using Hoteling-like multi-trait statistics), and keeps only the specified proportion in the model. The candidate predictors are further screened for between-predictor correlation and only ones with \( r^2 \) below the provided threshold are kept in the model. This among-predictor correlation often arises in SNP data, where there is likage disequilbrium (LD) among markers. Once the predictors are picked, the updating proceeds like for other BetaGrpFt objects, i.e. the set remains the same (unlike variable selection). Missing predictor data are filled in by mean imputation.

Warning
This set of models is still experimental and has not been extenisively tested. For example, it seems clear that the rest of the model has to be pre-run to convergence before initializing this kind of object. Furthermore, the initializeing predictor probably has to be a mean of several ( \( \sim 50 \)) MCMC samples.
Parameters
[in]Grp&response
[in]SigmaI&data inverse-covariance
[in]srting&predictor file name
[in]size_t&number of predictors
[in]double&fraction of predictors to retain, as a fraction of the number of data points
[in]double&\( r^2 \) cut-off for among-predictor correlation
[in]double&missing data label
[in]RanIndex&index to the prior
[in]string&output file name
[in]int&number of threads

◆ BetaGrpFt() [16/17]

BetaGrpFt::BetaGrpFt ( const Grp rsp,
const SigmaI SigI,
const string &  predFlNam,
const size_t &  Npred,
const double &  Nmul,
const double &  rSqMax,
const double &  absLab,
RanIndex low,
RanIndex up,
const string &  outFlNam,
const int &  nThr 
)

Selection constructor with missing predictor data and replication.

Unlike the previous constructors, selection-type constructors pre-screen predictors for association with any of the traits (using Hoteling-like multi-trait statistics), and keeps only the specified proportion in the model. The candidate predictors are further screened for between-predictor correlation and only ones with \( r^2 \) below the provided threshold are kept in the model. This among-predictor correlation often arises in SNP data, where there is likage disequilbrium (LD) among markers. Once the predictors are picked, the updating proceeds like for other BetaGrpFt objects, i.e. the set remains the same (unlike variable selection). Missing predictor data are filled in by mean imputation.

Warning
This set of models is still experimental and has not been extenisively tested. For example, it seems clear that the rest of the model has to be pre-run to convergence before initializing this kind of object. Furthermore, the initializeing predictor probably has to be a mean of several ( \( \sim 50 \)) MCMC samples.
Parameters
[in]Grp&response
[in]SigmaI&data inverse-covariance
[in]srting&predictor file name
[in]size_t&number of predictors
[in]double&fraction of predictors to retain, as a fraction of the number of data points
[in]double&\( r^2 \) cut-off for among-predictor correlation
[in]double&missing data label
[in]RanIndex&replication index
[in]RanIndex&index to the prior
[in]string&output file name
[in]int&number of threads

◆ BetaGrpFt() [17/17]

BetaGrpFt::BetaGrpFt ( const BetaGrpFt mG)

Copy constructor.

Parameters
[in]BetaGrpFt&object to be copied
Returns
BetaGrpFt object

Member Function Documentation

◆ _ldToss()

void BetaGrpFt::_ldToss ( const gsl_vector *  var,
const gsl_permutation *  prm,
const double &  rSqMax,
const size_t &  Npck,
vector< vector< size_t > > &  idx,
vector< vector< size_t > > &  rLd,
gsl_matrix *  Xpck 
)
protected

Testing candidates for correlation.

Goes through the list of "top" predictors and eliminates lower-ranked candidates correlated with them. If any candidates are eliminated, the list of top predictors is augmented with predictors previously discarded. The identity of the predictors eliminated for correlation is saved. The correlation among predictors arises, for example, when estimating SNP effect in genetics (GWAS).

Warning
Tested only superficially
Parameters
[in]gsl_vector*\( \left( \boldsymbol{x}^T\boldsymbol{x} \right)^{-1} \)
[in]gsl_permutation*predictor ranks
[in]double&\( r^2 \) cut-off
[in]size_t&number of predictors to pick
[out]vector<vector<size_t> >& index of picked predictors
[out]vector<vector<size_t> >& index relating dropped correlated predictors to their group-defining predictor
[out]gsl_matrix*matrix of picked predictor values

◆ _MGkernel() [1/2]

double BetaGrpFt::_MGkernel ( const Grp dat,
const SigmaI SigI 
) const
protectedvirtual

Gaussian kernel.

Calculates the multivariate Gaussian kernel value for all regression coefficients in the model.

Parameters
[in]Grp&data
[in]SigmaI&inverse-covariance
Returns
double kernel value

Reimplemented in BetaGrpBVSR.

◆ _MGkernel() [2/2]

double BetaGrpFt::_MGkernel ( const Grp dat,
const SigmaI SigI,
const size_t &  prInd 
) const
protectedvirtual

Gaussian kernel dropping one predictor.

Calculates the multivariate Gaussian kernel value for all regression coefficients in the model, except for the one indicated.

Parameters
[in]Grp&data
[in]SigmaI&inverse-covariance
[in]size_t&index of the dropped predictor
Returns
double kernel value

Reimplemented in BetaGrpBVSR.

◆ _rankPred() [1/2]

void BetaGrpFt::_rankPred ( const gsl_matrix *  y,
const SigmaI SigI,
const double &  absLab,
gsl_vector *  XtX,
gsl_permutation *  prm 
)
protected

Rank predictors with missing data.

Ranking the predictors by the size of their effects in preparation for eliminating the ones below a certain rank. Missing predictor values are labeled by a given value.

Parameters
[in]gsl_matrix*data (response)
[in]SigmaI&data inverse-covariance
[in]double&missing data label
[in]gsl_vector*vector of regression scales \( \left( \boldsymbol{x}^T\boldsymbol{x} \right)^{-1} \)
[out]gsl_permutation*predictor ranks

◆ _rankPred() [2/2]

void BetaGrpFt::_rankPred ( const gsl_matrix *  y,
const SigmaI SigI,
gsl_vector *  XtX,
gsl_permutation *  prm 
)
protected

Rank predictors.

Ranking the predictors by the size of their effects in preparation for eliminating the ones below a certain rank.

Parameters
[in]gsl_matrix*data (response)
[in]SigmaI&data inverse-covariance
[in]gsl_vector*vector of regression scales \( \left( \boldsymbol{x}^T\boldsymbol{x} \right)^{-1} \)
[out]gsl_permutation*predictor ranks

◆ dump()

void BetaGrpFt::dump ( )
virtual

Dump to a file.

Dumps paramter values averaged over the MCMC run to a file in the end of the run. Has an effect only in derived classes where it is implemented. In these classes, the name of the file is pre-specified at initialization.

Reimplemented from Grp.

◆ fMat()

virtual const gsl_matrix* BetaGrpFt::fMat ( ) const
inlinevirtual

Access to the fitted value matrix.

Pointer to the \( \boldsymbol{XB} \) matrix, while dMat() accesses the regression coefficient matrix.

Returns
gsl_matrix* pointer to the matrix of fitted values

Reimplemented from Grp.

Reimplemented in BetaGrpPCpex, and BetaGrpPEX.

◆ lnOddsRat()

double BetaGrpFt::lnOddsRat ( const Grp y,
const SigmaI SigI,
const size_t  i 
) const
virtual

Log-odds ratio.

Log-odds ration between models with and without the i-th regression coefficient (row). Makes sense only in regression classes, everywhere else returns zero.

Parameters
[in]Grp&data
[in]SigmaI&data inverse-covariance
[in]size_tindex of the element (row)
Returns
double log-odds ratio

Reimplemented from Grp.

◆ operator=()

BetaGrpFt & BetaGrpFt::operator= ( const BetaGrpFt mG)

Assignment operator.

Parameters
[in]BetaGrpFt&object to be copied
Returns
BetaGrpFt& target object

◆ save()

void BetaGrpFt::save ( const SigmaI SigI)
virtual

Store samples.

Stores samples of predictor effect scores in a matrix to be dumped at the end of the MCMC run.

Parameters
[in]SigmaI&data inverse-covariance

Reimplemented from Grp.

Reimplemented in BetaGrpBVSR, BetaGrpPCpex, and BetaGrpPEX.

◆ update() [1/10]

void BetaGrpFt::update ( const Grp ,
const Qgrp ,
const SigmaI  
)
virtual

Student- \(t\) likelihood, improper prior.

Parameters
[in]Grp&data
[in]Qgrp&Student- \(t\) weight parameter for data
[in]SigmaI&data inverse-covariance

Implements Grp.

◆ update() [2/10]

void BetaGrpFt::update ( const Grp ,
const Qgrp ,
const SigmaI ,
const Grp ,
const Qgrp ,
const SigmaI  
)
virtual

Student- \(t\) likelihood, non-zero mean Student- \(t\) prior.

For the relationship to work properly, the _upLevel index of the focal object has to point to the rows of the prior mean matrix. This is the matrix addressed by dMat(). The relationship to the data is dependent on the derived class.

Parameters
[in]Grp&data
[in]Qgrp&Student- \(t\) weight parameter for the data
[in]SigmaI&data inverse-covariance
[in]Grp&prior mean
[in]Qgrp&Student- \(t\) weight parameter for the prior
[in]SigmaI&prior inverse-covariance

Implements Grp.

Reimplemented in BetaGrpPCpex, and BetaGrpPEX.

◆ update() [3/10]

void BetaGrpFt::update ( const Grp ,
const Qgrp ,
const SigmaI ,
const Grp ,
const SigmaI  
)
virtual

Student- \(t\) likelihood, non-zero mean Gaussian prior.

For the relationship to work properly, the _upLevel index of the focal object has to point to the rows of the prior mean matrix. This is the matrix addressed by dMat(). The relationship to the data is dependent on the derived class.

Parameters
[in]Grp&data
[in]Qgrp&Student- \(t\) weight parameter for the data
[in]SigmaI&data inverse-covariance
[in]Grp&prior mean
[in]SigmaI&prior inverse-covariance

Implements Grp.

Reimplemented in BetaGrpPCpex, and BetaGrpPEX.

◆ update() [4/10]

void BetaGrpFt::update ( const Grp ,
const Qgrp ,
const SigmaI ,
const Qgrp ,
const SigmaI  
)
virtual

Student- \(t\) likelihood, 0-mean Student- \(t\) prior.

Parameters
[in]Grp&data
[in]Qgrp&Student- \(t\) weight parameter for the data
[in]SigmaI&data inverse-covariance
[in]Qgrp&Student- \(t\) weight parameter for the prior
[in]SigmaI&prior inverse-covariance

Implements Grp.

Reimplemented in BetaGrpPCpex, and BetaGrpPEX.

◆ update() [5/10]

void BetaGrpFt::update ( const Grp ,
const Qgrp ,
const SigmaI ,
const SigmaI  
)
virtual

Student- \(t\) likelihood, 0-mean Gaussian prior.

Parameters
[in]Grp&data
[in]Qgrp&Student- \(t\) weight parameter for data
[in]SigmaI&data inverse-covariance
[in]SigmaI&prior inverse-covariance

Implements Grp.

Reimplemented in BetaGrpPCpex, and BetaGrpPEX.

◆ update() [6/10]

void BetaGrpFt::update ( const Grp ,
const SigmaI  
)
virtual

Gaussian likelihood, improper prior.

Parameters
[in]Grp&data
[in]SigmaI&data inverse-covariance

Implements Grp.

◆ update() [7/10]

void BetaGrpFt::update ( const Grp ,
const SigmaI ,
const Grp ,
const Qgrp ,
const SigmaI  
)
virtual

Gaussian likelihood, non-zero mean Student- \(t\) prior.

For the relationship to work properly, the _upLevel index of the focal object has to point to the rows of the prior mean matrix. This is the matrix addressed by dMat(). The relationship to the data is dependent on the derived class.

Parameters
[in]Grp&data
[in]SigmaI&data inverse-covariance
[in]Grp&prior mean
[in]Qgrp&Student- \(t\) weight parameter for the prior
[in]SigmaI&prior inverse-covariance

Implements Grp.

Reimplemented in BetaGrpPCpex, and BetaGrpPEX.

◆ update() [8/10]

void BetaGrpFt::update ( const Grp ,
const SigmaI ,
const Grp ,
const SigmaI  
)
virtual

Gaussian likelihood, non-zero mean Gaussian prior.

For the relationship to work properly, the _upLevel index of the focal object has to point to the rows of the prior mean matrix. This is the matrix addressed by dMat(). The relationship to the data is dependent on the derived class.

Parameters
[in]Grp&data
[in]SigmaI&data inverse-covariance
[in]Grp&prior mean
[in]SigmaI&prior inverse-covariance

Implements Grp.

Reimplemented in BetaGrpPCpex, and BetaGrpPEX.

◆ update() [9/10]

void BetaGrpFt::update ( const Grp ,
const SigmaI ,
const Qgrp ,
const SigmaI  
)
virtual

Gaussian likelihood, 0-mean Student- \(t\) prior.

Parameters
[in]Grp&data
[in]SigmaI&data inverse-covariance
[in]Qgrp&Student- \(t\) weight parameter for the prior
[in]SigmaI&prior inverse-covariance

Implements Grp.

Reimplemented in BetaGrpPCpex, and BetaGrpPEX.

◆ update() [10/10]

void BetaGrpFt::update ( const Grp ,
const SigmaI ,
const SigmaI  
)
virtual

Gaussian likelihood, 0-mean Gaussian prior.

Parameters
[in]Grp&data
[in]SigmaI&data inverse-covariance
[in]SigmaI&prior inverse-covariance

Implements Grp.

Reimplemented in BetaGrpPCpex, and BetaGrpPEX.

Member Data Documentation

◆ _fittedAll

gsl_matrix* BetaGrpFt::_fittedAll
protected

Matrix of fitted values.

The \( \boldsymbol{XB} matrix \). In cases where the index to the lower level is initialized, i.e. there is replication in the response, this matrix has the same number of rows as the number of unique values of the predictor.

◆ _fittedEach

vector< vector<double> > BetaGrpFt::_fittedEach
protected

Partial fitted value matrices.

Each member of the vector stores the element-specific fitted matrix ( \( \boldsymbol{X}_{\cdot -k}\boldsymbol{B}_{-k \cdot} \)) as a vector in the row-major format, to be accessed as a matrix_view of an array. If there is only one predictor, this is empty. If there is replication (i.e. the index to the lower level is initialized), these matrices have the same number of rows as the response (equivalent to \( \boldsymbol{Z}\boldsymbol{X}_{\cdot -k}\boldsymbol{B}_{-k \cdot} \), where \( \boldsymbol{Z} \) is the design matrix).

◆ _numSaves

double BetaGrpFt::_numSaves
protected

Number of saves.

Number of saves made, to calculate the mean at the end.

◆ _valueSum

gsl_matrix* BetaGrpFt::_valueSum
protected

Sample storage matrix.

Stores Markov chain samples of the value matrix if we want only the point estimates in the end. Stores the sum of all the estimates saved up to now; allocated only if needed (under the condition that _numSaves != 0.0)

◆ _Xmat

gsl_matrix* BetaGrpFt::_Xmat
protected

Predictor matrix.

Individual predictors are in columns. If there is replication, the number of rows is expanded to fit the number of rows in the response matrix ( \( \boldsymbol{Z}\boldsymbol{X}\boldsymbol{B} \)).


The documentation for this class was generated from the following files: