MuGen
Multitrait genetics
|
Base location parameter group class. More...
#include <MuGen.h>
Public Member Functions | |
virtual | ~Grp () |
Destructor. | |
virtual void | update (const Grp &, const SigmaI &)=0 |
Gaussian likelihood, improper prior. More... | |
virtual void | update (const Grp &, const Qgrp &, const SigmaI &)=0 |
Student- \(t\) likelihood, improper prior. More... | |
virtual void | update (const Grp &, const SigmaI &, const SigmaI &)=0 |
Gaussian likelihood, 0-mean Gaussian prior. More... | |
virtual void | update (const Grp &, const Qgrp &, const SigmaI &, const SigmaI &)=0 |
Student- \(t\) likelihood, 0-mean Gaussian prior. More... | |
virtual void | update (const Grp &, const SigmaI &, const Qgrp &, const SigmaI &)=0 |
Gaussian likelihood, 0-mean Student- \(t\) prior. More... | |
virtual void | update (const Grp &, const Qgrp &, const SigmaI &, const Qgrp &, const SigmaI &)=0 |
Student- \(t\) likelihood, 0-mean Student- \(t\) prior. More... | |
virtual void | update (const Grp &, const SigmaI &, const Grp &, const SigmaI &)=0 |
Gaussian likelihood, non-zero mean Gaussian prior. More... | |
virtual void | update (const Grp &, const Qgrp &, const SigmaI &, const Grp &, const SigmaI &)=0 |
Student- \(t\) likelihood, non-zero mean Gaussian prior. More... | |
virtual void | update (const Grp &, const SigmaI &, const Grp &, const Qgrp &, const SigmaI &)=0 |
Gaussian likelihood, non-zero mean Student- \(t\) prior. More... | |
virtual void | update (const Grp &, const Qgrp &, const SigmaI &, const Grp &, const Qgrp &, const SigmaI &)=0 |
Student- \(t\) likelihood, non-zero mean Student- \(t\) prior. More... | |
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 SigmaI &SigI) |
Save with inverse-covariance. 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... | |
virtual void | dump () |
Dump to a file. More... | |
const vector< MVnorm * > & | dataVec () const |
Get vector of row pointers. More... | |
virtual const gsl_matrix * | dMat () const |
Access the value matrix. More... | |
virtual const gsl_matrix * | fMat () 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... | |
virtual double | lnOddsRat (const Grp &y, const SigmaI &SigI, const size_t i) const |
Log-odds ratio. More... | |
const MVnorm * | operator[] (const size_t i) const |
Subscript operator. More... | |
MVnorm * | operator[] (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 | |
Grp () | |
Protected Attributes | |
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. | |
Friends | |
class | MuGrp |
MuGrp | operator+ (const Grp &m1, const Grp &m2) |
Addition operator. More... | |
MuGrp | operator+ (const MuGrp &m1, const Grp &m2) |
Addition operator. More... | |
MuGrp | operator+ (const Grp &m1, const MuGrp &m2) |
Addition operator. More... | |
MuGrp | operator- (const Grp &m1, const Grp &m2) |
Subtraction operator. More... | |
MuGrp | operator- (const MuGrp &m1, const Grp &m2) |
Subtraction operator. More... | |
MuGrp | operator- (const Grp &m1, const MuGrp &m2) |
Subtraction operator. More... | |
Base location parameter group class.
The abstract base location parameter group class. Cannot be initialized directly.
|
protected |
Default constructor
|
inline |
Center the value matrix.
Centering is performed by subtracting the mean for each column from each column in place.
|
inline |
Get vector of row pointers.
|
inlinevirtual |
Access the value matrix.
Gives access to the value matrix. The internal structure this points to depends on the derived class.
|
inlinevirtual |
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 in BetaGrpPSRmiss, BetaGrpSnpMissCV, BetaGrpSnpMiss, BetaGrpPSR, BetaGrpSnpCV, BetaGrpSnp, and BetaGrpFt.
|
inlinevirtual |
Access the value matrix.
Gives access to the value matrix. The internal structure this points to depends on the derived class, and may be different from dMat().
Reimplemented in MuBlk, BetaGrpSnpMiss, BetaGrpSnp, BetaGrpPCpex, BetaGrpPEX, BetaGrpFt, and MuGrpPEX.
|
inlinevirtual |
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.
[in] | Grp& | data |
[in] | SigmaI& | data inverse-covariance |
[in] | size_t | index of the element (row) |
Reimplemented in BetaGrpFt.
Group mean.
Calculates within-group mean values of the value matrix (by row). The groups are defined by the upper-level of the given RanIndex variable. The lower-level number of elements of the index has to be the same as the number of rows in the current object's value matrix.
[in] | RanIndex& | grouping index |
Reimplemented in MuGrpPEX.
Group mean.
Calculates within-group mean values of the value matrix (by row). The groups are defined by the upper-level of the given RanIndex variable. The lower-level number of elements of the index has to be the same as the number of rows in the current object's value matrix.
[in] | RanIndex& | grouping index |
Reimplemented in MuGrpPEX.
Group weighted mean.
Calculates within-group weighted mean values of the value matrix (by row). The groups are defined by the upper-level of the given RanIndex variable. The lower-level number of elements of the index has to be the same as the number of rows in the current object's value matrix. The weights are in the provided Qgrp object. Typically, they are from a Student- \(t\) model.
[in] | RanIndex& | grouping index |
[in] | Qgrp& | weights |
Reimplemented in MuGrpPEX.
Group weighted mean.
Calculates within-group weighted mean values of the value matrix (by row). The groups are defined by the upper-level of the given RanIndex variable. The lower-level number of elements of the index has to be the same as the number of rows in the current object's value matrix. The weights are in the provided Qgrp object. Typically, they are from a Student- \(t\) model.
[in] | RanIndex& | grouping index |
[in] | Qgrp& | weights |
Reimplemented in MuGrpPEX.
void Grp::mhlSave | ( | const string & | outFlNam, |
const SigmaI | SigI | ||
) |
Save Mahalanobis distance.
Saves Mahalanobis distances of each row to a vector of zeros, given the provided inverse-covariance.
[in] | string& | file name |
[in] | SigmaI& | inverse-covariance |
|
inline |
Get number of rows.
|
inline |
Subscript operator.
Get a MVnorm object pointer to a row of the value matrix.
[in] | size_t | row index |
|
inline |
Subscript operator.
Get a MVnorm object pointer to a row of the value matrix.
[in] | size_t | row index |
|
inline |
Get number of traits.
|
virtual |
Save to pre-specified file.
Saves a sample from the Markov chain for the object by appending to a file. Unless re-implemented, the current contents of _valueMat are saved. File name is either generic or pre-specified at construction.
Reimplemented in BetaGrpPCpex, BetaGrpPEX, and MuGrpPEX.
Save with data and inverse-covariance.
Reserved for saving to a variable rather than a file. Has an effect only in classes where it is re-implemented.
[in] | Grp& | data |
[in] | SigmaI& | inverse-covariance |
|
inlinevirtual |
Save with inverse-covariance.
Reserved for saving to a variable rather than a file. Has an effect only in classes where it is re-implemented.
[in] | SigmaI& | inverse-covariance |
Reimplemented in BetaGrpBVSR, BetaGrpPCpex, BetaGrpPEX, BetaGrpFt, and MuGrpPEX.
|
virtual |
Save to file.
Saves a sample from the Markov chain for the object by appending to the named file. Unless re-implemented, the current contents of _valueMat are saved.
[in] | string& | file name |
Reimplemented in BetaGrpPCpex, BetaGrpPEX, and MuGrpPEX.
|
virtual |
Joint save.
Saves the current value of _valueMat to one file and the covariance matrix corresponding to the given inverse-covariance to the other. Both files are appended. Has more practical importance in some derived classes.
[in] | string& | mean file name |
[in] | string& | covariance file name |
[in] | SigmaI& | inverse-covariance |
Addition operator.
[in] | Grp& | first summand |
[in] | Grp& | second summand |
Addition operator.
[in] | Grp& | first summand |
[in] | MuGrp& | second summand |
Addition operator.
[in] | MuGrp& | first summand |
[in] | Grp& | second summand |
Subtraction operator.
[in] | Grp& | minuend |
[in] | Grp& | subtrahend |
Subtraction operator.
[in] | Grp& | minuend |
[in] | MuGrp& | subtrahend |
Subtraction operator.
[in] | MuGrp& | minuend |
[in] | Grp& | subtrahend |
|
protected |
Lower level index.
If initialized, points to the lower (i.e., data) level in the hierarchy. Otherwise, set to 0. For regressions, plays the role of the design matrix \( \boldsymbol{Z} \).
|
protected |
Vector of PNG pointers.
Typically is of unit length. However, for derived classes that use multi-threading its length is equal to the number of threads, each thread having its own PNG. PNGS are seeded on construction with the sum of time(NULL) and RTDSC.
|
protected |
|
protected |
Upper level index.
If initialized, points to the upper (i.e., prior) level in the hierarchy. Otherwise, set to 0.
|
protected |
Value matrix.
Matrix of location parameter values. The columns are traits, and rows are individual replicates or regression coefficients corresponding to a given predictor. Each row is addressed by an individual element of _theta for most classes. Exceptions are noted in descriptions of those derived classes.