MuGen
Multitrait genetics
|
The abstract base class for location parameter rows. More...
#include <MuGen.h>
Public Member Functions | |
MVnorm (const MVnorm &) | |
Copy constructor. More... | |
MVnorm & | operator= (const MVnorm &) |
Assignement operator. More... | |
virtual | ~MVnorm () |
Virtual destructor. More... | |
virtual void | update (const Grp &, const SigmaI &, const gsl_rng *)=0 |
Gaussian likelihood. More... | |
virtual void | update (const Grp &, const Qgrp &, const SigmaI &, const gsl_rng *)=0 |
Sudent- \(t\) likelihood. More... | |
virtual void | update (const Grp &, const SigmaI &, const SigmaI &, const gsl_rng *)=0 |
Gaussian likelihood, Gaussian prior. More... | |
virtual void | update (const Grp &, const SigmaI &, const double &, const SigmaI &, const gsl_rng *)=0 |
Gaussian likelihood, Student- \(t\) prior. More... | |
virtual void | update (const Grp &, const Qgrp &, const SigmaI &, const SigmaI &, const gsl_rng *)=0 |
Student- \(t\) likelihood, Gaussian prior. More... | |
virtual void | update (const Grp &, const Qgrp &, const SigmaI &, const double &, const SigmaI &, const gsl_rng *)=0 |
Student- \(t\) likelihood, Student- \(t\) prior. More... | |
virtual void | update (const Grp &, const SigmaI &, const Grp &, const SigmaI &, const gsl_rng *)=0 |
Gaussian likelihood, Gaussian prior. More... | |
virtual void | update (const Grp &, const SigmaI &, const Grp &, const double &, const SigmaI &, const gsl_rng *)=0 |
Gaussian likelihood, Student- \(t\) prior. More... | |
virtual void | update (const Grp &, const Qgrp &, const SigmaI &, const Grp &, const SigmaI &, const gsl_rng *)=0 |
Student- \(t\) likelihood, Gaussian prior. More... | |
virtual void | update (const Grp &, const Qgrp &, const SigmaI &, const Grp &, const double &, const SigmaI &, const gsl_rng *)=0 |
Student- \(t\) likelihood, Student- \(t\) prior. 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 const size_t * | up () const |
Points to the prior. More... | |
virtual double | scalePar () const |
Scale parameter. More... | |
Protected Member Functions | |
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... | |
Protected Attributes | |
gsl_vector_view | _vec |
Data vector. More... | |
size_t | _d |
Length of the data vector. | |
The abstract base class for location parameter rows.
This is the generic location parameter class and cannot be envoked directly. All the constructors are protected.
|
inlineprotected |
Default constructor.
This is a deterministic constructor that results in a pointer to nowhere and the dimension member set to zero.
|
inlineprotected |
Dimension-only constructor.
Sets the dimension to a value, but the vector_view is not assigned a target.
[in] | size_t& | dimension value |
|
protected |
Dimension and vector value constructor.
A deterministic constructor that sets the _vec member to point to the provided gsl_vector and the dimension member to the size of the provided gsl_vector.
[in] | gsl_vector* | target vector |
|
protected |
Univariate Gaussian constructor.
Sets the _vec member to point to the provided gsl_vector and ads univariate Gaussian noise independtly to each element, modifying the target.
[in,out] | gsl_vector* | vector of means |
[in] | gsl_vector* | vector of standard deviations for the univariate Gaussian, has to be no shorter than the mean vector. If it is longer, the extra values are ignored. |
[in] | gsl_rng* | pointer to a PNG |
|
protected |
Multivariate Gaussian constructor.
Sets the _vec member to point to the provided gsl_vector and ads multivariate Gaussian noise, modifying the target.
[in,out] | gsl_vector* | vector of means |
[in] | gsl_matrix* | covariance matrix for the multivariate Gaussian, has to match the mean vector in dimensions and has to be symmetric positive-definite |
[in] | gsl_rng* | pointer to a PNG |
|
protected |
Dimension and vector value constructor.
A deterministic constructor that sets the _vec member to point to a row (indicated by the row index) of the provided gsl_matrix and the dimension member to the number of columns in the provided gsl_matrix.
[in] | gsl_matrix* | target matrix |
[in] | size_t& | row index of the matrix |
|
protected |
Univariate Gaussian constructor with a matrix.
Sets the _vec member to point to a row (indicated by the row index) of the provided gsl_matrix and ads univariate Gaussian noise independtly to each element, modifying the target.
[in,out] | gsl_matrix* | target matrix |
[in] | size_t& | row index of the target matrix |
[in] | gsl_vector* | vector of standard deviations for the univariate Gaussian, has to be no shorter than a row of the mean matrix. If it is longer, the extra values are ignored. |
[in] | gsl_rng* | pointer to a PNG |
|
protected |
Multivariate Gaussian constructor with a matrix.
Sets the _vec member to point to a row (indicated by the row index) of the provided gsl_matrix and ads multivariate Gaussian noise, modifying the target.
[in,out] | gsl_matrix* | target matrix |
[in] | size_t& | row index of the target matrix |
[in] | gsl_matrix* | covariance matrix for the multivariate Gaussian, has to be symmetric positive-definite, with diemsions equal to the number of columns in the target matrix |
[in] | gsl_rng* | pointer to a PNG |
MVnorm::MVnorm | ( | const MVnorm & | mu | ) |
Copy constructor.
Provided for completeness and has not been extensively tested. The constructor is deterministic, i.e. the values are copied exactly, with no stochastic perturbation.
[in] | MVnorm& | object to be copied |
|
inlinevirtual |
Virtual destructor.
The destructor has nothing to do since members of this class cannot be de-allocated.
|
inlinevirtual |
Points to the corresponding data.
Access to the pointer to a vector that indexes the data used to update an instance of the class. Is non-zero only for classes which can be part of a hierarchical model.
Reimplemented in MVnormMu.
|
inlinevirtual |
Indexes of missing values.
Accesses a vector with indexes of missing phenotypes.
Reimplemented in MVnormMuMiss, and MVnormMu.
|
inline |
Access the location vector.
Provides access to the internal parameter vector.
|
inline |
Length of the location vector.
|
inlinevirtual |
Number of missing values.
Accesses the number of missing phenotype values. Non-zero only for classes that implement treatment of missing values.
Reimplemented in MVnormMuMiss, and MVnormMu.
Assignement operator.
Provided for completeness and has not been extensively tested. The operator is deterministic, i.e. the values are copied exactly, with no stochastic perturbation.
[in] | MVnorm& | object to be assigned |
|
inline |
Subscript operator.
Overloaded subscript operator for the vector of location parameter values.
[in] | size_t | index value |
void MVnorm::save | ( | const string & | fileNam, |
const char * | how = "a" |
||
) |
Save function.
Saves the current value of the location parameter to a file, appending by default.
[in] | string& | file name |
[in] | char* | save mode, "a" for append by default. The allowable values are as for a standard C file stream |
void MVnorm::save | ( | FILE * | fileStr | ) |
Save function.
Saves the current value of the location parameter to a file.
[in] | FILE* | C file stream |
|
inlinevirtual |
Scale parameter.
Access to a scale parameter member, defined only for some derived regression-type classes. If not defined, returns 1.0.
Reimplemented in MVnormBeta.
|
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 in MVnormBetaBlk, MVnormMuBlk, MVnormBeta, and MVnormMu.
|
inline |
Setting an element to a value.
Sets the i-th element of the location vector to a value deterministically
[in] | size_t | index |
[in] | double | new value of the element |
|
protected |
Data vector.
This is actually a pointer (implemented as a GSL vector_view) to a row in the corresponding matrix of location parameters.