MuGen
Multitrait genetics
|
Generic regression. More...
#include <MuGen.h>
Public Member Functions | |
MVnormBeta () | |
Default constructor. | |
MVnormBeta (const size_t d) | |
Dimension-only constructor. More... | |
MVnormBeta (gsl_vector *b, const gsl_vector *sd, gsl_matrix *pred, const size_t &iCl, const gsl_rng *r) | |
Univariate random constructor with vector. More... | |
MVnormBeta (gsl_vector *b, const gsl_vector *sd, gsl_matrix *pred, const size_t &iCl, const gsl_rng *r, const size_t &up) | |
Univariate random constructor with vector and pointer to prior. More... | |
MVnormBeta (gsl_vector *b, const gsl_matrix *Sig, gsl_matrix *pred, const size_t &iCl, const gsl_rng *r) | |
Multivariate random constructor with vector. More... | |
MVnormBeta (gsl_vector *b, const gsl_matrix *Sig, gsl_matrix *pred, const size_t &iCl, const gsl_rng *r, const size_t &up) | |
Multivariate random constructor with vector and pointer to prior. More... | |
MVnormBeta (const gsl_matrix *resp, gsl_matrix *pred, const size_t &iCl, const gsl_matrix *Sig, const gsl_rng *r, gsl_matrix *bet, const size_t &iRw) | |
Multivariate constructor with response matrix. More... | |
MVnormBeta (const gsl_matrix *resp, gsl_matrix *pred, const size_t &iCl, const gsl_matrix *Sig, const gsl_rng *r, const size_t &up, gsl_matrix *bet, const size_t &iRw) | |
Multivariate constructor with response matrix and index for a prior. More... | |
MVnormBeta (const Grp &resp, gsl_matrix *pred, const size_t &iCl, const gsl_matrix *Sig, const gsl_rng *r, gsl_matrix *bet, const size_t &iRw) | |
Multivariate constructor with a Grp type response. More... | |
MVnormBeta (const Grp &resp, gsl_matrix *pred, const size_t &iCl, const gsl_matrix *Sig, const gsl_rng *r, const size_t &up, gsl_matrix *bet, const size_t &iRw) | |
Multivariate constructor with a Grp type response and index for a prior. More... | |
MVnormBeta (gsl_matrix *pred, const size_t &iCl, gsl_matrix *bet, const size_t &iRw) | |
Deterministic constructor. More... | |
MVnormBeta (gsl_matrix *pred, const size_t &iCl, const size_t &up, gsl_matrix *bet, const size_t &iRw) | |
Deterministic constructor with prior index. More... | |
MVnormBeta (const MVnormBeta &) | |
Deterministic copy constructor. More... | |
MVnormBeta & | operator= (const MVnormBeta &) |
Deterministic assignement operator. More... | |
virtual | ~MVnormBeta () |
Destructor. | |
virtual void | update (const Grp &dat, const SigmaI &SigIb, const gsl_rng *r) |
Gaussian likelihood. More... | |
virtual void | update (const Grp &dat, const Qgrp &q, const SigmaI &SigIb, const gsl_rng *r) |
Sudent- \(t\) likelihood. More... | |
virtual void | update (const Grp &dat, const SigmaI &SigIb, const SigmaI &SigIp, const gsl_rng *r) |
Gaussian likelihood, Gaussian prior. More... | |
virtual void | update (const Grp &dat, const SigmaI &SigIb, const double &qPr, const SigmaI &SigIp, const gsl_rng *r) |
Gaussian likelihood, Student- \(t\) prior. More... | |
virtual void | update (const Grp &dat, const Qgrp &q, const SigmaI &SigIb, const SigmaI &SigIp, const gsl_rng *r) |
Student- \(t\) likelihood, Gaussian prior. More... | |
virtual void | update (const Grp &dat, const Qgrp &q, const SigmaI &SigIb, const double &qPr, const SigmaI &SigIp, const gsl_rng *r) |
Student- \(t\) likelihood, Student- \(t\) prior. More... | |
virtual void | update (const Grp &dat, const SigmaI &SigIb, const Grp &muPr, const SigmaI &SigIp, const gsl_rng *r) |
Gaussian likelihood, Gaussian prior. More... | |
virtual void | update (const Grp &dat, const SigmaI &SigIb, const Grp &muPr, const double &qPr, const SigmaI &SigIp, const gsl_rng *r) |
Gaussian likelihood, Student- \(t\) prior. More... | |
virtual void | update (const Grp &dat, const Qgrp &q, const SigmaI &SigIb, const Grp &muPr, const SigmaI &SigIp, const gsl_rng *r) |
Student- \(t\) likelihood, Gaussian prior. More... | |
virtual void | update (const Grp &dat, const Qgrp &q, const SigmaI &SigIb, const Grp &muPr, const double &qPr, const SigmaI &SigIp, const gsl_rng *r) |
Student- \(t\) likelihood, Student- \(t\) prior. More... | |
const size_t * | up () const |
Points to the prior. More... | |
double | scalePar () const |
Scale parameter. 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... | |
Protected Attributes | |
gsl_vector_view | _X |
Predictor. More... | |
double | _scale |
Scale parameter. More... | |
size_t | _N |
Length of the predictor. | |
const size_t * | _upLevel |
Row index of the prior. 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... | |
Generic regression.
Generic implementation of a regression. By itself to be used strictly for regressions with a single predictor because it ignores the effects of other predictors.
MVnormBeta::MVnormBeta | ( | const size_t | d | ) |
Dimension-only constructor.
Sets the dimension to a value, but the _vec is not assigned a target.
MVnormBeta::MVnormBeta | ( | gsl_vector * | b, |
const gsl_vector * | sd, | ||
gsl_matrix * | pred, | ||
const size_t & | iCl, | ||
const gsl_rng * | r | ||
) |
Univariate random constructor with vector.
Sets up _vec to point to the provided vector of values, and the predictor to a column in the provided matrix of predictors.
[in] | gsl_vector* | vector of values |
[in] | gsl_vector* | vector of standard deviations |
[in] | gsl_matrix* | matrix of predictors |
[in] | size_t& | column index for the predictor matrix |
[in] | gsl_rng* | pointer to a PNG |
MVnormBeta::MVnormBeta | ( | gsl_vector * | b, |
const gsl_vector * | sd, | ||
gsl_matrix * | pred, | ||
const size_t & | iCl, | ||
const gsl_rng * | r, | ||
const size_t & | up | ||
) |
Univariate random constructor with vector and pointer to prior.
Sets up _vec to point to the provided vector of values, the predictor to a column in the provided matrix of predictors, and the pointer to the corresponding row in the prior matrix.
[in] | gsl_vector* | vector of values |
[in] | gsl_vector* | vector of standard deviations |
[in] | gsl_matrix* | matrix of predictors |
[in] | size_t& | column index for the predictor matrix |
[in] | gsl_rng* | pointer to a PNG |
[in] | size_t& | index of the appropriate row in the prior matrix |
MVnormBeta::MVnormBeta | ( | gsl_vector * | b, |
const gsl_matrix * | Sig, | ||
gsl_matrix * | pred, | ||
const size_t & | iCl, | ||
const gsl_rng * | r | ||
) |
Multivariate random constructor with vector.
Sets up _vec to point to the provided vector of values, and the predictor to a column in the provided matrix of predictors.
[in] | gsl_vector* | vector of values |
[in] | gsl_matrix* | covariance matrix |
[in] | gsl_matrix* | matrix of predictors |
[in] | size_t& | column index for the predictor matrix |
[in] | gsl_rng* | pointer to a PNG |
MVnormBeta::MVnormBeta | ( | gsl_vector * | b, |
const gsl_matrix * | Sig, | ||
gsl_matrix * | pred, | ||
const size_t & | iCl, | ||
const gsl_rng * | r, | ||
const size_t & | up | ||
) |
Multivariate random constructor with vector and pointer to prior.
Sets up _vec to point to the provided vector of values, the predictor to a column in the provided matrix of predictors, and the pointer to the corresponding row in the prior matrix.
[in] | gsl_vector* | vector of values |
[in] | gsl_matrix* | covariance matrix |
[in] | gsl_matrix* | matrix of predictors |
[in] | size_t& | column index for the predictor matrix |
[in] | gsl_rng* | pointer to a PNG |
[in] | size_t& | index of the appropriate row in the prior matrix |
MVnormBeta::MVnormBeta | ( | const gsl_matrix * | resp, |
gsl_matrix * | pred, | ||
const size_t & | iCl, | ||
const gsl_matrix * | Sig, | ||
const gsl_rng * | r, | ||
gsl_matrix * | bet, | ||
const size_t & | iRw | ||
) |
Multivariate constructor with response matrix.
Sets up _vec to point to a row in the provided matrix of regression coefficients, and the predictor to a column of the matrix of predictors. Initializes regression coefficients using the provided response matrix.
[in] | gsl_matrix* | response matrix |
[in] | gsl_matrix* | predictor martix |
[in] | size_t& | column index of the predictor matrix |
[in] | gsl_matrix* | covariance matrix |
[in] | gsl_rng* | pointer to a PNG |
[in] | gsl_matrix* | matrix of regression coefficients |
[in] | size_t& | row index of the regression coefficient matrix |
MVnormBeta::MVnormBeta | ( | const gsl_matrix * | resp, |
gsl_matrix * | pred, | ||
const size_t & | iCl, | ||
const gsl_matrix * | Sig, | ||
const gsl_rng * | r, | ||
const size_t & | up, | ||
gsl_matrix * | bet, | ||
const size_t & | iRw | ||
) |
Multivariate constructor with response matrix and index for a prior.
Sets up _vec to point to a row in the provided matrix of regression coefficients, and the predictor to a column of the matrix of predictors. Initializes regression coefficients using the provided response matrix.
Initializes _upLevel to point to the appropriate row in the matrix of priors.
[in] | gsl_matrix* | response matrix |
[in] | gsl_matrix* | predictor martix |
[in] | size_t& | column index of the predictor matrix |
[in] | gsl_matrix* | covariance matrix |
[in] | gsl_rng* | pointer to a PNG |
[in] | size_t& | row index of the prior matrix |
[in] | gsl_matrix* | matrix of regression coefficients |
[in] | size_t& | row index of the regression coefficient matrix |
MVnormBeta::MVnormBeta | ( | const Grp & | resp, |
gsl_matrix * | pred, | ||
const size_t & | iCl, | ||
const gsl_matrix * | Sig, | ||
const gsl_rng * | r, | ||
gsl_matrix * | bet, | ||
const size_t & | iRw | ||
) |
Multivariate constructor with a Grp type response.
Sets up _vec to point to a row in the provided matrix of regression coefficients, and the predictor to a column of the matrix of predictors. Initializes regression coefficients using the provided response matrix.
[in] | Grp& | response |
[in] | gsl_matrix* | predictor martix |
[in] | size_t& | column index of the predictor matrix |
[in] | gsl_matrix* | covariance matrix |
[in] | gsl_rng* | pointer to a PNG |
[in] | gsl_matrix* | matrix of regression coefficients |
[in] | size_t& | row index of the regression coefficient matrix |
MVnormBeta::MVnormBeta | ( | const Grp & | resp, |
gsl_matrix * | pred, | ||
const size_t & | iCl, | ||
const gsl_matrix * | Sig, | ||
const gsl_rng * | r, | ||
const size_t & | up, | ||
gsl_matrix * | bet, | ||
const size_t & | iRw | ||
) |
Multivariate constructor with a Grp type response and index for a prior.
Sets up _vec to point to a row in the provided matrix of regression coefficients, and the predictor to a column of the matrix of predictors. Initializes regression coefficients using the provided response matrix. Initializes _upLevel to point to the appropriate row in the matrix of priors.
[in] | Grp& | response |
[in] | gsl_matrix* | predictor martix |
[in] | size_t& | column index of the predictor matrix |
[in] | gsl_matrix* | covariance matrix |
[in] | gsl_rng* | pointer to a PNG |
[in] | size_t& | row index of the prior matrix |
[in] | gsl_matrix* | matrix of regression coefficients |
[in] | size_t& | row index of the regression coefficient matrix |
MVnormBeta::MVnormBeta | ( | gsl_matrix * | pred, |
const size_t & | iCl, | ||
gsl_matrix * | bet, | ||
const size_t & | iRw | ||
) |
Deterministic constructor.
Does not initialize the regression coefficients, but simply points to the already-initialized matrix of values.
[in] | gsl_matrix* | predictor matrix |
[in] | size_t& | column index of the predictor matrix |
[in] | gsl_matrix* | regression coefficient matrix |
[in] | size_t& | row index of the regression coefficient matrix |
MVnormBeta::MVnormBeta | ( | gsl_matrix * | pred, |
const size_t & | iCl, | ||
const size_t & | up, | ||
gsl_matrix * | bet, | ||
const size_t & | iRw | ||
) |
Deterministic constructor with prior index.
Does not initialize the regression coefficients, but simply points to the already-initialized matrix of values. Sets the _upLevel to point to the corresponding row of the prior matrix
[in] | gsl_matrix* | predictor matrix |
[in] | size_t& | column index of the predictor matrix |
[in] | size_t& | row index of the prior matrix |
[in] | gsl_matrix* | regression coefficient matrix |
[in] | size_t& | row index of the regression coefficient matrix |
MVnormBeta::MVnormBeta | ( | const MVnormBeta & | b | ) |
Deterministic copy constructor.
[in] | MVnormBeta& | object to be copied |
MVnormBeta & MVnormBeta::operator= | ( | const MVnormBeta & | b | ) |
Deterministic assignement operator.
[in] | MVnormBeta& | object to be assigned |
|
inlinevirtual |
Scale parameter.
Access to a scale parameter member, defined only for some derived regression-type classes. If not defined, returns 1.0.
Reimplemented from MVnorm.
|
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.
Reimplemented in MVnormBetaFt.
|
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.
Reimplemented in MVnormBetaFt.
|
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.
Reimplemented in MVnormBetaFt.
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.
Reimplemented in MVnormBetaFt.
|
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.
Reimplemented in MVnormBetaFt.
|
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.
Reimplemented in MVnormBetaFt.
|
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.
Reimplemented in MVnormBetaFt.
|
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.
Reimplemented in MVnormBetaFt.
Gaussian likelihood.
[in] | Grp& | data |
[in] | SigmaI& | inverse-covariance matrix for the likelihood |
[in] | gsl_rng* | pointer to a PNG |
Implements MVnorm.
Reimplemented in MVnormBetaFt.
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.
Reimplemented in MVnormBetaFt.
|
protected |
Scale parameter.
Typically \( x^{\textsc{t}}x \), but some exceptions exist in special cases.
|
protected |
Row index of the prior.
Points to the index of a row in the prior matrix
|
protected |
Predictor.
Points to a vector of predictor values, typically a column of the predictor matrix that is in the encapsulating Grp class.