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

Data with measurement error. More...

#include <MuGen.h>

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

Public Member Functions

 MuGrpEE ()
 Default constructor.
 
 MuGrpEE (const string &datFlNam, const string &varFlNam, const string &indFlNam, RanIndex &up, const size_t &d)
 Constructor with index read from a file. More...
 
 MuGrpEE (const string &datFlNam, const string &varFlNam, const vector< size_t > &varInd, RanIndex &up, const size_t &d)
 Constructor with index vector. More...
 
 ~MuGrpEE ()
 Destructor.
 
 MuGrpEE (const MuGrpEE &mG)
 Copy constructor. More...
 
MuGrpEEoperator= (const MuGrpEE &mG)
 Assignment operator. More...
 
virtual void update (const Grp &muPr, const SigmaI &SigIm)
 Gaussian prior. More...
 
virtual void update (const Grp &muPr, const Qgrp &q, const SigmaI &SigIm)
 Student- \(t\) prior. More...
 
- Public Member Functions inherited from MuGrp
 MuGrp ()
 Default constructor.
 
 MuGrp (RanIndex &low, const size_t &d)
 Deterministic zero-value constructor. More...
 
 MuGrp (const string &datFlNam, RanIndex &low, RanIndex &up, const size_t &d)
 Constructor with data from file. More...
 
 MuGrp (const string &datFlNam, RanIndex &up, const size_t &d)
 Constructor with data from file and no lower level. More...
 
 MuGrp (const vector< MVnorm * > &dat, RanIndex &low, RanIndex &up)
 Constructor with a vector of MVnorm pointers. More...
 
 MuGrp (const Grp &dat, RanIndex &low, RanIndex &up)
 Constructor with a Grp object. More...
 
 MuGrp (const vector< MVnorm * > &dat, RanIndex &low, RanIndex &up, const string &outFlNam)
 Constructor with a vector of MVnorm pointers and output file name. More...
 
 MuGrp (const Grp &dat, RanIndex &low, RanIndex &up, const string &outFlNam)
 Constructor with a Grp object and output file name. More...
 
 MuGrp (const Grp &dat, RanIndex &low)
 Deterministic mean constructor. More...
 
 MuGrp (const Grp &dat, const Qgrp &q, RanIndex &low)
 Deterministic weighted mean constructor. More...
 
 MuGrp (const gsl_matrix *dat)
 Deterministic constructor with a GSL matrix. More...
 
 MuGrp (const gsl_matrix *dat, RanIndex &low)
 Deterministic GSL matrix mean constructor. More...
 
 MuGrp (const gsl_matrix *dat, const Qgrp &q, RanIndex &low)
 Deterministic GSL matrix weighted mean constructor. More...
 
virtual ~MuGrp ()
 Destructor.
 
 MuGrp (const MuGrp &mG)
 Copy constructor. More...
 
 MuGrp (const Grp &g)
 Copy constructor. More...
 
MuGrpoperator= (const MuGrp &mG)
 Assignemnt operator. 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 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 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 Attributes

gsl_matrix * _errorInvVar
 Matrix of error inverse-variances. More...
 
gsl_matrix * _meanVal
 Matrix of means. More...
 
vector< size_t > _errInd
 Trait index. 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.
 

Additional Inherited Members

- Protected Member Functions inherited from Grp
 Grp ()
 

Detailed Description

Data with measurement error.

If some phenotypes are measured with known error (e.g., technical replicates that are not idividually available), these can be sampled rather than used as point estimates. A mix of traits with and without measurement error is allowed. This class has to be on the bottom of the model hierarchy.

Constructor & Destructor Documentation

◆ MuGrpEE() [1/3]

MuGrpEE::MuGrpEE ( const string &  datFlNam,
const string &  varFlNam,
const string &  indFlNam,
RanIndex up,
const size_t &  d 
)

Constructor with index read from a file.

The data, error variances and the index identifying traits with errors are read from files. The index file must be a white-space separated text file. Variances are inverted after reading and are checked for sanity (i.e. not smaller than machine epsilon).

Parameters
[in]string&data file name
[in]string&variance file name
[in]string&index values file name
[in]RainIndex&upper level (prior) index
[in]size_t&number of traits

◆ MuGrpEE() [2/3]

MuGrpEE::MuGrpEE ( const string &  datFlNam,
const string &  varFlNam,
const vector< size_t > &  varInd,
RanIndex up,
const size_t &  d 
)

Constructor with index vector.

The data and error variances are read from files, but the index identifying traits with errors is provided in a vector. Variances are inverted after reading and are checked for sanity (i.e. not smaller than machine epsilon).

Parameters
[in]string&data file name
[in]string&variance file name
[in]vector<size_t>&index values file name
[in]RainIndex&upper level (prior) index
[in]size_t&number of traits

◆ MuGrpEE() [3/3]

MuGrpEE::MuGrpEE ( const MuGrpEE mG)

Copy constructor.

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

Member Function Documentation

◆ operator=()

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

Assignment operator.

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

Member Data Documentation

◆ _errInd

vector<size_t> MuGrpEE::_errInd
protected

Trait index.

Contains indexes of the traits that have measurment errors. Only one index for all rows, i.e. once a trait has measurment error all samples must have a non-zero error variance.

◆ _errorInvVar

gsl_matrix* MuGrpEE::_errorInvVar
protected

Matrix of error inverse-variances.

The matrix has the same number of rows as the value matrix, and the number of columns no larger than the value matrix. Variances are read from a file and inverted on initialization.

◆ _meanVal

gsl_matrix* MuGrpEE::_meanVal
protected

Matrix of means.

Has the same dimensions as the _errorVar matrix, and stores mean values for the variables that will be sampled.


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