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

Generic regression. More...

#include <MuGen.h>

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

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...
 
MVnormBetaoperator= (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...
 
MVnormoperator= (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...
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ MVnormBeta() [1/12]

MVnormBeta::MVnormBeta ( const size_t  d)

Dimension-only constructor.

Sets the dimension to a value, but the _vec is not assigned a target.

◆ MVnormBeta() [2/12]

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.

Parameters
[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() [3/12]

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.

Parameters
[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() [4/12]

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.

Parameters
[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() [5/12]

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.

Parameters
[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() [6/12]

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.

Parameters
[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() [7/12]

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.

Parameters
[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() [8/12]

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.

Parameters
[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() [9/12]

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.

Parameters
[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() [10/12]

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.

Parameters
[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() [11/12]

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

Parameters
[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() [12/12]

MVnormBeta::MVnormBeta ( const MVnormBeta b)

Deterministic copy constructor.

Parameters
[in]MVnormBeta&object to be copied

Member Function Documentation

◆ operator=()

MVnormBeta & MVnormBeta::operator= ( const MVnormBeta b)

Deterministic assignement operator.

Parameters
[in]MVnormBeta&object to be assigned
Returns
A reference to a MVnormBeta object

◆ scalePar()

double MVnormBeta::scalePar ( ) const
inlinevirtual

Scale parameter.

Access to a scale parameter member, defined only for some derived regression-type classes. If not defined, returns 1.0.

Returns
Scale paramter value of type double.

Reimplemented from MVnorm.

◆ up()

const size_t* MVnormBeta::up ( ) const
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.

Returns
Pointer to size_t.

Reimplemented from MVnorm.

◆ update() [1/10]

void MVnormBeta::update ( const Grp ,
const Qgrp ,
const SigmaI ,
const double &  ,
const SigmaI ,
const gsl_rng *   
)
virtual

Student- \(t\) likelihood, Student- \(t\) prior.

Parameters
[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.

◆ update() [2/10]

void MVnormBeta::update ( const Grp ,
const Qgrp ,
const SigmaI ,
const Grp ,
const double &  ,
const SigmaI ,
const gsl_rng *   
)
virtual

Student- \(t\) likelihood, Student- \(t\) prior.

Parameters
[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.

◆ update() [3/10]

void MVnormBeta::update ( const Grp ,
const Qgrp ,
const SigmaI ,
const Grp ,
const SigmaI ,
const gsl_rng *   
)
virtual

Student- \(t\) likelihood, Gaussian prior.

Parameters
[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.

◆ update() [4/10]

void MVnormBeta::update ( const Grp ,
const Qgrp ,
const SigmaI ,
const gsl_rng *   
)
virtual

Sudent- \(t\) likelihood.

Parameters
[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.

◆ update() [5/10]

void MVnormBeta::update ( const Grp ,
const Qgrp ,
const SigmaI ,
const SigmaI ,
const gsl_rng *   
)
virtual

Student- \(t\) likelihood, Gaussian prior.

Parameters
[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.

◆ update() [6/10]

void MVnormBeta::update ( const Grp ,
const SigmaI ,
const double &  ,
const SigmaI ,
const gsl_rng *   
)
virtual

Gaussian likelihood, Student- \(t\) prior.

Parameters
[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.

◆ update() [7/10]

void MVnormBeta::update ( const Grp ,
const SigmaI ,
const Grp ,
const double &  ,
const SigmaI ,
const gsl_rng *   
)
virtual

Gaussian likelihood, Student- \(t\) prior.

Parameters
[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.

◆ update() [8/10]

void MVnormBeta::update ( const Grp ,
const SigmaI ,
const Grp ,
const SigmaI ,
const gsl_rng *   
)
virtual

Gaussian likelihood, Gaussian prior.

Parameters
[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.

◆ update() [9/10]

void MVnormBeta::update ( const Grp ,
const SigmaI ,
const gsl_rng *   
)
virtual

Gaussian likelihood.

Parameters
[in]Grp&data
[in]SigmaI&inverse-covariance matrix for the likelihood
[in]gsl_rng*pointer to a PNG

Implements MVnorm.

Reimplemented in MVnormBetaFt.

◆ update() [10/10]

void MVnormBeta::update ( const Grp ,
const SigmaI ,
const SigmaI ,
const gsl_rng *   
)
virtual

Gaussian likelihood, Gaussian prior.

Parameters
[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.

Member Data Documentation

◆ _scale

double MVnormBeta::_scale
protected

Scale parameter.

Typically \( x^{\textsc{t}}x \), but some exceptions exist in special cases.

◆ _upLevel

const size_t* MVnormBeta::_upLevel
protected

Row index of the prior.

Points to the index of a row in the prior matrix

◆ _X

gsl_vector_view MVnormBeta::_X
protected

Predictor.

Points to a vector of predictor values, typically a column of the predictor matrix that is in the encapsulating Grp class.


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