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

Regression with independent blocks of traits. More...

#include <MuGen.h>

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

Public Member Functions

 BetaBlk ()
 Default constructor.
 
 BetaBlk (const Grp &dat, const string &predFlName, const size_t &Npred, const string &blkIndFileNam, const int &nThr)
 Basic constructor. More...
 
 BetaBlk (const Grp &dat, const string &predFlName, const size_t &Npred, const string &outFlNam, const string &blkIndFileNam, const int &nThr)
 Constructor with output file name. More...
 
 BetaBlk (const Grp &dat, const string &predFlName, const size_t &Npred, RanIndex &up, const string &blkIndFileNam, const int &nThr)
 Constructor with a prior index. More...
 
 BetaBlk (const Grp &dat, const string &predFlName, const size_t &Npred, RanIndex &up, const string &outFlNam, const string &blkIndFileNam, const int &nThr)
 Constructor with a prior index and output file. More...
 
 BetaBlk (const Grp &dat, const string &predFlName, const size_t &Npred, const double &absLab, const string &blkIndFileNam, const int &nThr)
 Constructor with missing predictor data. More...
 
 BetaBlk (const Grp &dat, const string &predFlName, const size_t &Npred, const double &absLab, const string &outFlNam, const string &blkIndFileNam, const int &nThr)
 Constructor with missing predictor values and output file name. More...
 
 BetaBlk (const Grp &dat, const string &predFlName, const size_t &Npred, const double &absLab, RanIndex &up, const string &blkIndFileNam, const int &nThr)
 Constructor with a prior index and missing predictor data. More...
 
 BetaBlk (const Grp &dat, const string &predFlName, const size_t &Npred, const double &absLab, RanIndex &up, const string &outFlNam, const string &blkIndFileNam, const int &nThr)
 Constructor with a prior index, missing predictor data, and output file. More...
 
 ~BetaBlk ()
 Destructor.
 
- Public Member Functions inherited from BetaGrpFt
 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

void _updateFitted ()
 Update fitted values.
 
- Protected Member Functions inherited from BetaGrpFt
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< size_t > _blkStart
 Block start indexes. More...
 
vector< gsl_matrix_view > _eachX
 Predictor submatrices. More...
 
vector< gsl_matrix_view > _eachB
 Regression coefficient submatrices. More...
 
- Protected Attributes inherited from BetaGrpFt
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

Regression with independent blocks of traits.

Blocks of inter-correlated traits with correlations among blocks set to exactly zero. These models arise, for example, when traits measured in different environments are modeled together as different traits. The traits belonging to the same block have to be in adjacent columns. The number of predictors per block must be the same (future devolpment will drop this requirement), and the predictor columns corresponding to the same trait block have to be adjacent in the _Xmat matrix.

Constructor & Destructor Documentation

◆ BetaBlk() [1/8]

BetaBlk::BetaBlk ( const Grp dat,
const string &  predFlName,
const size_t &  Npred,
const string &  blkIndFileNam,
const int &  nThr 
)

Basic constructor.

The total number of predictors (columns in Xmat) is the provided number of predictors times the number of blocks. The file that has the block start indexes should be a white-space delimited text file. The file that has the lower level index information should have a matrix of _int with the number of rows the same as the number of rows in the data, and the number of columns equal to the number of blocks.

Parameters
[in]Grp&data for initialization
[in]string&name of the predictor file
[in]size_t&number of predictors per block
[in]string&name of the file with the block indexes
[in]int&number of threads

◆ BetaBlk() [2/8]

BetaBlk::BetaBlk ( const Grp dat,
const string &  predFlName,
const size_t &  Npred,
const string &  outFlNam,
const string &  blkIndFileNam,
const int &  nThr 
)

Constructor with output file name.

The total number of predictors (columns in Xmat) is the provided number of predictors times the number of blocks. The file that has the block start indexes should be a white-space delimited text file. The file that has the lower level index information should have a matrix of _int with the number of rows the same as the number of rows in the data, and the number of columns equal to the number of blocks.

Parameters
[in]Grp&data for initialization
[in]string&name of the predictor file
[in]size_t&number of predictors per block
[in]string&output file name
[in]string&name of the file with the block indexes
[in]int&number of threads

◆ BetaBlk() [3/8]

BetaBlk::BetaBlk ( const Grp dat,
const string &  predFlName,
const size_t &  Npred,
RanIndex up,
const string &  blkIndFileNam,
const int &  nThr 
)

Constructor with a prior index.

The total number of predictors (columns in Xmat) is the provided number of predictors times the number of blocks. The file that has the block start indexes should be a white-space delimited text file. The file that has the lower level index information should have a matrix of _int with the number of rows the same as the number of rows in the data, and the number of columns equal to the number of blocks.

Parameters
[in]Grp&data for initialization
[in]string&name of the predictor file
[in]size_t&number of predictors per block
[in]RanIndex&prior (upper-level) index
[in]string&name of the file with the block indexes
[in]int&number of threads

◆ BetaBlk() [4/8]

BetaBlk::BetaBlk ( const Grp dat,
const string &  predFlName,
const size_t &  Npred,
RanIndex up,
const string &  outFlNam,
const string &  blkIndFileNam,
const int &  nThr 
)

Constructor with a prior index and output file.

The total number of predictors (columns in Xmat) is the provided number of predictors times the number of blocks. The file that has the block start indexes should be a white-space delimited text file. The file that has the lower level index information should have a matrix of _int with the number of rows the same as the number of rows in the data, and the number of columns equal to the number of blocks.

Parameters
[in]Grp&data for initialization
[in]string&name of the predictor file
[in]size_t&number of predictors per block
[in]RanIndex&prior (upper-level) index
[in]string&output file name
[in]string&name of the file with the block indexes
[in]int&number of threads

◆ BetaBlk() [5/8]

BetaBlk::BetaBlk ( const Grp dat,
const string &  predFlName,
const size_t &  Npred,
const double &  absLab,
const string &  blkIndFileNam,
const int &  nThr 
)

Constructor with missing predictor data.

The total number of predictors (columns in Xmat) is the provided number of predictors times the number of blocks. The file that has the block start indexes should be a white-space delimited text file. The file that has the lower level index information should have a matrix of _int with the number of rows the same as the number of rows in the data, and the number of columns equal to the number of blocks.

Parameters
[in]Grp&data for initialization
[in]string&name of the predictor file
[in]size_t&number of predictors per block
[in]double&missing value label
[in]string&name of the file with the block indexes
[in]int&number of threads

◆ BetaBlk() [6/8]

BetaBlk::BetaBlk ( const Grp dat,
const string &  predFlName,
const size_t &  Npred,
const double &  absLab,
const string &  outFlNam,
const string &  blkIndFileNam,
const int &  nThr 
)

Constructor with missing predictor values and output file name.

The total number of predictors (columns in Xmat) is the provided number of predictors times the number of blocks. The file that has the block start indexes should be a white-space delimited text file. The file that has the lower level index information should have a matrix of _int with the number of rows the same as the number of rows in the data, and the number of columns equal to the number of blocks.

Parameters
[in]Grp&data for initialization
[in]string&name of the predictor file
[in]size_t&number of predictors per block
[in]double&missing value label
[in]string&output file name
[in]string&name of the file with the block indexes
[in]int&number of threads

◆ BetaBlk() [7/8]

BetaBlk::BetaBlk ( const Grp dat,
const string &  predFlName,
const size_t &  Npred,
const double &  absLab,
RanIndex up,
const string &  blkIndFileNam,
const int &  nThr 
)

Constructor with a prior index and missing predictor data.

The total number of predictors (columns in Xmat) is the provided number of predictors times the number of blocks. The file that has the block start indexes should be a white-space delimited text file. The file that has the lower level index information should have a matrix of _int with the number of rows the same as the number of rows in the data, and the number of columns equal to the number of blocks.

Parameters
[in]Grp&data for initialization
[in]string&name of the predictor file
[in]size_t&number of predictors per block
[in]double&missing data label
[in]RanIndex&prior (upper-level) index
[in]string&name of the file with the block indexes
[in]int&number of threads

◆ BetaBlk() [8/8]

BetaBlk::BetaBlk ( const Grp dat,
const string &  predFlName,
const size_t &  Npred,
const double &  absLab,
RanIndex up,
const string &  outFlNam,
const string &  blkIndFileNam,
const int &  nThr 
)

Constructor with a prior index, missing predictor data, and output file.

The total number of predictors (columns in Xmat) is the provided number of predictors times the number of blocks. The file that has the block start indexes should be a white-space delimited text file. The file that has the lower level index information should have a matrix of _int with the number of rows the same as the number of rows in the data, and the number of columns equal to the number of blocks.

Parameters
[in]Grp&data for initialization
[in]string&name of the predictor file
[in]size_t&number of predictors per block
[in]double&missing data label
[in]RanIndex&prior (upper-level) index
[in]string&output file name
[in]string&name of the file with the block indexes
[in]int&number of threads

Member Data Documentation

◆ _blkStart

vector< size_t > BetaBlk::_blkStart
protected

Block start indexes.

Vector of indexes that indicate the column that starts each block.

◆ _eachB

vector< gsl_matrix_view > BetaBlk::_eachB
protected

Regression coefficient submatrices.

A vector of GSL matrix views of the overall value matrix.

◆ _eachX

vector< gsl_matrix_view > BetaBlk::_eachX
protected

Predictor submatrices.

A vector of GSL matrix views of the submatrices of the overall predictor matrix that correspond to each trait block.


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