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

BVSR index class. More...

#include <MuGen.h>

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

Public Member Functions

 RanIndexVS ()
 Default constructor.
 
 RanIndexVS (const size_t &Ntot, const string &outFlNam, MixP &pr)
 Constructor with a prior. More...
 
 RanIndexVS (const size_t &Ntot, const string &outFlNam)
 Constructor without a prior. More...
 
 ~RanIndexVS ()
 Destructor.
 
void props (vector< double > &prp) const
 
void save (const Grp &y, const BetaGrpBVSR *theta, const SigmaI &SigIe)
 Save PEP. More...
 
void save (const Grp &y, const Grp &theta, const SigmaI &SigIe)
 Save PEP. More...
 
void dump ()
 Save PEP to a file. More...
 
void init (const vector< vector< size_t > > &idx, const vector< vector< size_t > > &rLD)
 Complete initialization. More...
 
void update (const Grp &y, const SigmaI &SigIe, BetaGrpBVSR *theta, const SigmaI &SigIp)
 Variable selection update. More...
 
- Public Member Functions inherited from RanIndex
 RanIndex ()
 Default constructor. More...
 
 RanIndex (const gsl_vector_int *lInd, const size_t &Ntot, const size_t &Nup)
 Vector-based constructor. More...
 
 RanIndex (const size_t &Ntot)
 Constructor with one upper level. More...
 
 RanIndex (const size_t &Ntot, const size_t &Nup)
 Constructor for single-element lower levels. More...
 
 RanIndex (const size_t &Ntot, const size_t &Nup, const string &fileNam)
 Constructor with file input. More...
 
 RanIndex (const size_t &Ntot, const size_t &Nup, FILE *fileStr)
 Constructor with file-stream input. More...
 
virtual ~RanIndex ()
 Destructor.
 
const vector< size_t > & operator[] (const size_t i) const
 Subscript operator. More...
 
vector< size_t > & operator[] (const size_t i)
 Subscript operator. More...
 
const vector< size_t > & getIndVec () const
 Retrieve the index vector. More...
 
vector< size_t > & getIndVec ()
 Retrieve the index vector. More...
 
const size_t & priorInd (const size_t i) const
 Upper-level index. More...
 
size_t & priorInd (const size_t i)
 Upper-level index. More...
 
size_t getNtot () const
 Number of lower-level elements. More...
 
size_t getNtot ()
 Number of lower-level elements. More...
 
size_t getNgrp () const
 Number of upper-level elements. More...
 
size_t getNgrp ()
 Number of upper-level elements. More...
 
virtual const vector< double > props () const
 Proportions of each group. More...
 
void update (const Grp &theta, const Grp &mu, const vector< SigmaI > &SigI, const MixP &p)
 Update mixture model with multiple covariances. More...
 
void update (const Grp &theta, const Grp &mu, const SigmaI &SigI, const MixP &p)
 Update mixture model with a single covariance. More...
 

Protected Member Functions

size_t _proposal (const size_t &Ntot, const int &Nmn, const gsl_rng *r)
 Rank proposal-generating function. More...
 

Protected Attributes

vector< double > _pep
 Posterior exclusion probabilities. More...
 
vector< bool > _mcmcTrack
 Transition tracking variable. More...
 
vector< vector< size_t > > _relLD
 Mapping selected to original predictors. More...
 
size_t _Ntp
 Original number of predictors.
 
MixP_prior
 Prior proportions. More...
 
vector< bool > _acceptDrop
 Accept a drop. More...
 
vector< bool > _rejectDrop
 Reject a drop. More...
 
vector< bool > _acceptAdd
 Accept an addition. More...
 
vector< bool > _rejectAdd
 Rject an addition. More...
 
vector< bool > _acceptSwap
 Accept a swap. More...
 
vector< bool > _rejectSwap
 Reject a swap. More...
 
double _numSaves
 Number of calls to save() More...
 
string _pepOutFlnam
 PEP output file name.
 
string _mcmcPutFlNam
 Accept/reject file name. More...
 
- Protected Attributes inherited from RanIndex
vector< vector< size_t > > _idx
 Indexes of lower levels. More...
 
vector< size_t > _vecInd
 Indexes of upper levels. More...
 
gsl_rng * _r
 Pointer to a PNG. More...
 

Detailed Description

BVSR index class.

Keeps track of the variable selection process for a multivariate version of the Bayesian Variable Selection Regression (BVSR) multi-marker regression method of Guan and Stephens [guan11] (Greenberg, unpublished). This clas is a friend of BetaGrpBVSR.

Warning
This class is experimental and has not been extensively tested.

Constructor & Destructor Documentation

◆ RanIndexVS() [1/2]

RanIndexVS::RanIndexVS ( const size_t &  Ntot,
const string &  outFlNam,
MixP pr 
)

Constructor with a prior.

This is a preliminary set-up. The initiation is finished with the init() member function, after pre-screening of predictors is performed.

◆ RanIndexVS() [2/2]

RanIndexVS::RanIndexVS ( const size_t &  Ntot,
const string &  outFlNam 
)

Constructor without a prior.

This is a preliminary set-up. The initiation is finished with the init() member function, after pre-screening of predictors is performed.

Member Function Documentation

◆ _proposal()

size_t RanIndexVS::_proposal ( const size_t &  Ntot,
const int &  Nmn,
const gsl_rng *  r 
)
protected

Rank proposal-generating function.

The rank-based Metropolis proposal-generating function proposed in Guan and Stephens [guan11] .

Warning
This function is not presently used in my implementation of BVSR because I am not sure it is a symmetric proposal. If it is not, then we would need to come up with a Metropolis-Hastings updating scheme.

◆ dump()

void RanIndexVS::dump ( )
virtual

Save PEP to a file.

Saves posterior exclusion probabilities (PEP) to a file. Name of the file is stored in the _pepOutFlnam variable.

Reimplemented from RanIndex.

◆ init()

void RanIndexVS::init ( const vector< vector< size_t > > &  idx,
const vector< vector< size_t > > &  rLD 
)
virtual

Complete initialization.

Initializes the index instance after preliminary screening of predictors in performed by the corresponding BetaGrpBVSR variable.

Parameters
[in]vector<vector<size_t> >& vector to replace the current _idx
[in]vector<vector<size_t> >& a relationship vector; ignored in this class

Reimplemented from RanIndex.

◆ save() [1/2]

void RanIndexVS::save ( const Grp y,
const BetaGrpBVSR theta,
const SigmaI SigIe 
)
virtual

Save PEP.

Stores current PEP values and saves Metropolis proposal statistics to a file.

Parameters
[in]Grp&data
[in]BetaGrpBVSR*location parameters
[in]SigmaI&inverse-covariance matrix

Reimplemented from RanIndex.

◆ save() [2/2]

void RanIndexVS::save ( const Grp y,
const Grp theta,
const SigmaI SigIe 
)
virtual

Save PEP.

Stores current PEP values and saves Metropolis proposal statistics to a file.

Parameters
[in]Grp&data
[in]Grp&location parameters
[in]SigmaI&inverse-covariance matrix

Reimplemented from RanIndex.

◆ update()

void RanIndexVS::update ( const Grp y,
const SigmaI SigIe,
BetaGrpBVSR theta,
const SigmaI SigIp 
)
virtual

Variable selection update.

Update for a mixture that includes point-mass at 0. Only implemented in the derived class.

Parameters
[in]Grp&data
[in]SigmaI&likelihood inverse-covariance
[in]BetaGrpBVSR*location parameter values
[in]SigmaI&prior inverse-covariance

Reimplemented from RanIndex.

Member Data Documentation

◆ _acceptAdd

vector<bool> RanIndexVS::_acceptAdd
protected

Accept an addition.

The state of _mcmcTrack that corresponds to accepting an addition of a predictor. Pre-set so that it is easy to modify _mcmcTrack.

◆ _acceptDrop

vector<bool> RanIndexVS::_acceptDrop
protected

Accept a drop.

The state of _mcmcTrack that corresponds to accepting a drop of a predictor. Pre-set so that it is easy to modify _mcmcTrack.

◆ _acceptSwap

vector<bool> RanIndexVS::_acceptSwap
protected

Accept a swap.

The state of _mcmcTrack that corresponds to accepting a swap of predictors. Pre-set so that it is easy to modify _mcmcTrack.

◆ _mcmcPutFlNam

string RanIndexVS::_mcmcPutFlNam
protected

Accept/reject file name.

Name of the file where the accept/reject and proposal kind statistics are stored. This file is appended at each save. These statistics are useful for checking and trouble-shooting Metropolis chain behavior.

◆ _mcmcTrack

vector<bool> RanIndexVS::_mcmcTrack
protected

Transition tracking variable.

Used to track the Metropolis moves made after the current MCMC step. There are four elements, three last ones being mutually exclusive: [0]: accepted? [1]: proposed adding a predictor? [2]: proposed dropping a predictor? [3]: proposed swapping predictors?

◆ _numSaves

double RanIndexVS::_numSaves
protected

Number of calls to save()

Tracks the number of times a save function is called. Before dumping the PEP results, divide each element of _pep by this number.

◆ _pep

vector<double> RanIndexVS::_pep
protected

Posterior exclusion probabilities.

Posterior exclusion probabilities. This is the opposite if the implementation in Guan and Stephens, where the inclusion probabilities are exported. My implementation results in output that is analogous to \( -\log_{10}p \), making it more intuitive to people used to frequentist approaches. The probabilities stored in this variable are in the order of the SNPs picked for initial inclusion in the BetaGrpBVSR class. We keep adding PEP values to this at each save, then dump the mean into a file in the end, giving a Rao-Blackwellized point estimate of PEP.

◆ _prior

MixP* RanIndexVS::_prior
protected

Prior proportions.

Prior proportion of predictors in selected to be in the model.

◆ _rejectAdd

vector<bool> RanIndexVS::_rejectAdd
protected

Rject an addition.

The state of _mcmcTrack that corresponds to rejecting an addition of a predictor. Pre-set so that it is easy to modify _mcmcTrack.

◆ _rejectDrop

vector<bool> RanIndexVS::_rejectDrop
protected

Reject a drop.

The state of _mcmcTrack that corresponds to rejecting a drop of a predictor. Pre-set so that it is easy to modify _mcmcTrack.

◆ _rejectSwap

vector<bool> RanIndexVS::_rejectSwap
protected

Reject a swap.

The state of _mcmcTrack that corresponds to rejecting a swap of predictors. Pre-set so that it is easy to modify _mcmcTrack.

◆ _relLD

vector< vector<size_t> > RanIndexVS::_relLD
protected

Mapping selected to original predictors.

Relates the new positions of selected predictors to the original positions. Its length is the same as the selected number of predictors. relLD[i][0] is the original position of the selected predictor _i; the rest of _relLD[i] (if any) are positions of linked SNPs (or, in general, correlated predictors)


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