MuGen
Multitrait genetics
|
Individual vector of means with blocks of traits. More...
#include <MuGen.h>
Public Member Functions | |
MVnormMuBlk () | |
Default constructor. | |
MVnormMuBlk (gsl_matrix *mn, const size_t &iRw, const vector< size_t > &blkStart, const size_t &up) | |
Deterministic constructor. More... | |
MVnormMuBlk (gsl_matrix *mn, const size_t &iRw, const gsl_vector *sd, const gsl_rng *r, const vector< size_t > &blkStart, const vector< vector< size_t > > &eachLL, const size_t &up) | |
Univariate stochastic constructor. More... | |
virtual | ~MVnormMuBlk () |
Destructor. | |
const size_t * | up () const |
Points to the prior. More... | |
void | update (const Grp &dat, const SigmaI &SigIm, const gsl_rng *r) |
Gaussian likelihood. More... | |
void | update (const Grp &dat, const Qgrp &q, const SigmaI &SigIm, const gsl_rng *r) |
Sudent- \(t\) likelihood. More... | |
void | update (const Grp &dat, const SigmaI &SigIm, const SigmaI &SigIp, const gsl_rng *r) |
Gaussian likelihood, Gaussian prior. More... | |
void | update (const Grp &dat, const SigmaI &SigIm, const double &qPr, const SigmaI &SigIp, const gsl_rng *r) |
Gaussian likelihood, Student- \(t\) prior. More... | |
void | update (const Grp &dat, const Qgrp &q, const SigmaI &SigIm, const SigmaI &SigIp, const gsl_rng *r) |
Student- \(t\) likelihood, Gaussian prior. More... | |
void | update (const Grp &dat, const Qgrp &q, const SigmaI &SigIm, const double &qPr, const SigmaI &SigIp, const gsl_rng *r) |
Student- \(t\) likelihood, Student- \(t\) prior. More... | |
void | update (const Grp &dat, const SigmaI &SigIm, const Grp &muPr, const SigmaI &SigIp, const gsl_rng *r) |
Gaussian likelihood, Gaussian prior. More... | |
void | update (const Grp &dat, const SigmaI &SigIm, const Grp &muPr, const double &qPr, const SigmaI &SigIp, const gsl_rng *r) |
Gaussian likelihood, Student- \(t\) prior. More... | |
void | update (const Grp &dat, const Qgrp &q, const SigmaI &SigIm, const Grp &muPr, const SigmaI &SigIp, const gsl_rng *r) |
Student- \(t\) likelihood, Gaussian prior. More... | |
void | update (const Grp &dat, const Qgrp &q, const SigmaI &SigIm, const Grp &muPr, const double &qPr, const SigmaI &SigIp, const gsl_rng *r) |
Student- \(t\) likelihood, Student- \(t\) prior. More... | |
Public Member Functions inherited from MVnorm | |
MVnorm (const MVnorm &) | |
Copy constructor. More... | |
MVnorm & | operator= (const MVnorm &) |
Assignement operator. More... | |
virtual | ~MVnorm () |
Virtual destructor. More... | |
virtual double | mhl (const MVnorm *x, const SigmaI &SigI) |
Mahalanobis distance to a vector. More... | |
virtual double | mhl (const MVnorm *x, const SigmaI &SigI) const |
Mahalanobis distance to a vector. More... | |
virtual double | mhl (const gsl_vector *x, const SigmaI &SigI) |
Mahalanobis distance to a vector. More... | |
virtual double | mhl (const gsl_vector *x, const SigmaI &SigI) const |
Mahalanobis distance to a vector. More... | |
virtual double | mhl (const SigmaI &SigI) |
Mahalanobis distance to zero. More... | |
virtual double | mhl (const SigmaI &SigI) const |
Mahalanobis distance to zero. More... | |
double | density (const gsl_vector *theta, const SigmaI &SigI) |
Multivariate Gaussian density. More... | |
double | density (const gsl_vector *theta, const SigmaI &SigI) const |
Multivariate Gaussian density. More... | |
double | density (const MVnorm *theta, const SigmaI &SigI) |
Multivariate Gaussian density. More... | |
double | density (const MVnorm *theta, const SigmaI &SigI) const |
Multivariate Gaussian density. More... | |
void | save (const string &fileNam, const char *how="a") |
Save function. More... | |
void | save (FILE *fileStr) |
Save function. More... | |
double | operator[] (const size_t i) const |
Subscript operator. More... | |
void | valSet (const size_t i, const double x) |
Setting an element to a value. More... | |
const gsl_vector * | getVec () const |
Access the location vector. More... | |
size_t | len () const |
Length of the location vector. More... | |
virtual size_t | nMissP () const |
Number of missing values. More... | |
virtual const vector< size_t > | getMisPhen () const |
Indexes of missing values. More... | |
virtual const vector< size_t > * | down () const |
Points to the corresponding data. More... | |
virtual double | scalePar () const |
Scale parameter. More... | |
Protected Attributes | |
const size_t * | _upLevel |
Pointer to a row index of the prior. More... | |
const vector< size_t > * | _blkStart |
Start positions of blocks. More... | |
vector< gsl_vector_view > | _eachVec |
Trait blocks. More... | |
const vector< vector< size_t > > * | _eachLL |
Data matrix row indexes. More... | |
Protected Attributes inherited from MVnorm | |
gsl_vector_view | _vec |
Data vector. More... | |
size_t | _d |
Length of the data vector. | |
Additional Inherited Members | |
Protected Member Functions inherited from MVnorm | |
MVnorm () | |
Default constructor. More... | |
MVnorm (const size_t &d) | |
Dimension-only constructor. More... | |
MVnorm (gsl_vector *mn) | |
Dimension and vector value constructor. More... | |
MVnorm (gsl_vector *mn, const gsl_vector *sd, const gsl_rng *r) | |
Univariate Gaussian constructor. More... | |
MVnorm (gsl_vector *mn, const gsl_matrix *Sig, const gsl_rng *r) | |
Multivariate Gaussian constructor. More... | |
MVnorm (gsl_matrix *mn, const size_t &iRw) | |
Dimension and vector value constructor. More... | |
MVnorm (gsl_matrix *mn, const size_t &iRw, const gsl_vector *sd, const gsl_rng *r) | |
Univariate Gaussian constructor with a matrix. More... | |
MVnorm (gsl_matrix *mn, const size_t &iRw, const gsl_matrix *Sig, const gsl_rng *r) | |
Multivariate Gaussian constructor with a matrix. More... | |
Individual vector of means with blocks of traits.
Implements separate models for blocks of traits. The likelihood covariance matrix is block-diagonal. Traits of the same block have to be contiguous within the vector.
MVnormMuBlk::MVnormMuBlk | ( | gsl_matrix * | mn, |
const size_t & | iRw, | ||
const vector< size_t > & | blkStart, | ||
const size_t & | up | ||
) |
Deterministic constructor.
Sets up the member variables to point to blocks of traits in the matrix mn, but does not perform stochastic intitialization.
[in] | gsl_matrix* | mean values matrix |
[in] | size_t& | row index of the mean values matrix |
[in] | vector<size_t>& | vector of start indexes for each block |
[in] | size_t& | row index of the prior matrix |
MVnormMuBlk::MVnormMuBlk | ( | gsl_matrix * | mn, |
const size_t & | iRw, | ||
const gsl_vector * | sd, | ||
const gsl_rng * | r, | ||
const vector< size_t > & | blkStart, | ||
const vector< vector< size_t > > & | eachLL, | ||
const size_t & | up | ||
) |
Univariate stochastic constructor.
Sets initial values independently for each trait, modifying the matrix row that corresponds to this vector.
[in] | gsl_matrix* | mean values matrix |
[in] | size_t& | row index of the mean values matrix |
[in] | gsl_vector* | vector of standard deviations |
[in] | gsl_rng* | pointer to a PNG |
[in] | vector<size_t>& | vector of start indexes for each block |
[in] | vector< | vector<size_t> >& vector of lower-level index vectors |
[in] | size_t& | row index of the prior matrix |
|
inlinevirtual |
Points to the prior.
Access to the pointer to the correspoding vector of priors. Is non-zero only for classes where a prior is implemented.
Reimplemented from MVnorm.
|
virtual |
Student- \(t\) likelihood, Student- \(t\) prior.
[in] | Grp& | data for the likelihood |
[in] | Qgrp& | vector Student- \(t\) covariance scale parameter for the likelihood covariance |
[in] | SigmaI& | inverse-covariance matrix for the likelihood |
[in] | double& | Student- \(t\) scale parameter for the prior covariance |
[in] | SigmaI& | prior inverse-covariance matrix |
[in] | gsl_rng* | pointer to a PNG |
Implements MVnorm.
|
virtual |
Student- \(t\) likelihood, Student- \(t\) prior.
[in] | Grp& | data for the likelihood |
[in] | Qgrp& | vector Student- \(t\) covariance scale parameter for the likelihood covariance |
[in] | SigmaI& | inverse-covariance matrix for the likelihood |
[in] | Grp& | prior mean |
[in] | double& | Student- \(t\) scale parameter for the prior covariance |
[in] | SigmaI& | prior inverse-covariance matrix |
[in] | gsl_rng* | pointer to a PNG |
Implements MVnorm.
|
virtual |
Student- \(t\) likelihood, Gaussian prior.
[in] | Grp& | data for the likelihood |
[in] | Qgrp& | vector Student- \(t\) covariance scale parameter for the likelihood covariance |
[in] | SigmaI& | inverse-covariance matrix for the likelihood |
[in] | Grp& | prior mean |
[in] | SigmaI& | prior inverse-covariance matrix |
[in] | gsl_rng* | pointer to a PNG |
Implements MVnorm.
Sudent- \(t\) likelihood.
[in] | Grp& | data |
[in] | Qgrp& | vector of Student- \(t\) covariance scale parameters for the likelihood covariance |
[in] | SigmaI& | inverse-covariance matrix for the likelihood |
[in] | gsl_rng* | pointer to a PNG |
Implements MVnorm.
|
virtual |
Student- \(t\) likelihood, Gaussian prior.
[in] | Grp& | data for the likelihood |
[in] | Qgrp& | vector of Student- \(t\) covariance scale parameters for the likelihood covariance |
[in] | SigmaI& | inverse-covariance matrix for the likelihood |
[in] | SigmaI& | prior inverse-covariance matrix |
[in] | gsl_rng* | pointer to a PNG |
Implements MVnorm.
|
virtual |
Gaussian likelihood, Student- \(t\) prior.
[in] | Grp& | data for the likelihood |
[in] | SigmaI& | inverse-covariance matrix for the likelihood |
[in] | double& | Student- \(t\) scale parameter for the prior covariance |
[in] | SigmaI& | prior inverse-covariance matrix |
[in] | gsl_rng* | pointer to a PNG |
Implements MVnorm.
|
virtual |
Gaussian likelihood, Student- \(t\) prior.
[in] | Grp& | data for the likelihood |
[in] | SigmaI& | inverse-covariance matrix for the likelihood |
[in] | Grp& | prior mean |
[in] | double& | Student- \(t\) scale parameter for the prior covariance |
[in] | SigmaI& | prior inverse-covariance matrix |
[in] | gsl_rng* | pointer to a PNG |
Implements MVnorm.
|
virtual |
Gaussian likelihood, Gaussian prior.
[in] | Grp& | data for the likelihood |
[in] | SigmaI& | inverse-covariance matrix for the likelihood |
[in] | Grp& | prior mean |
[in] | SigmaI& | prior inverse-covariance matrix |
[in] | gsl_rng* | pointer to a PNG |
Implements MVnorm.
Gaussian likelihood.
[in] | Grp& | data |
[in] | SigmaI& | inverse-covariance matrix for the likelihood |
[in] | gsl_rng* | pointer to a PNG |
Implements MVnorm.
|
virtual |
Gaussian likelihood, Gaussian prior.
[in] | Grp& | data for the likelihood |
[in] | SigmaI& | inverse-covariance matrix for the likelihood |
[in] | SigmaI& | prior inverse-covariance matrix |
[in] | gsl_rng* | pointer to a PNG |
Implements MVnorm.
|
protected |
Start positions of blocks.
Pointer to the vector that's in the corresponding Grp class.
|
protected |
Data matrix row indexes.
Each block of traits can have a different number and identity of rows in the data matrix it refers to. Each vector of size_t in this vector corresponds to a block, so the size of this should be the same as the size of *_eachVec*. This member is a pointer to the vector that's in the corresponding Grp class.
|
protected |
Trait blocks.
Vector views of vector pieces, each corresponding to a block of variables. Pointer to the vector that's in the corresponding Grp class.
|
protected |
Pointer to a row index of the prior.
This has to be the same for all the blocks.