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

Standard Student- \(t\) weights. More...

#include <MuGen.h>

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

Public Member Functions

 Qgrp ()
 Default constructor. More...
 
 Qgrp (const size_t &N)
 Deterministic size-only constructor. More...
 
 Qgrp (const size_t &N, const double &nu)
 Deterministic constructor with degrees of freedom. More...
 
 Qgrp (const size_t &N, const double &nu, const string &misVecFlNam)
 Deterministic constructor with degrees of freedom and missing values. More...
 
 Qgrp (const size_t &N, const string &outFileNam)
 Deterministic size-only constructor with output file name. More...
 
 Qgrp (const size_t &N, const string &outFileNam, const double &nu)
 Deterministic constructor with degrees of freedom and output file name. More...
 
 Qgrp (const size_t &N, const string &outFileNam, const double &nu, const string &misVecFlNam)
 Deterministic constructor with degrees of freedom, missing values and output file name. More...
 
virtual ~Qgrp ()
 Destructor.
 
double operator[] (const size_t i) const
 Const subscript operator. More...
 
double operator[] (const size_t i)
 Subscript operator. More...
 
virtual double alpha () const
 Const access to \(\alpha\). More...
 
virtual double alpha ()
 Access to \(\alpha\). More...
 
size_t size () const
 Const length of the weight vector. More...
 
size_t size ()
 Length of the weight vector. More...
 
void save (const char *how="a")
 Save to a stored file name. More...
 
void save (const string &fileNam, const char *how="a")
 Save to a given file name. More...
 
virtual void update (const Grp &dat, const Grp &mu, const SigmaI &SigI)
 Update with a mean. More...
 
virtual void update (const Grp &dat, const SigmaI &SigI)
 Basic update. More...
 

Protected Attributes

vector< double > _qVec
 Vector of weights.
 
vector< size_t > _presInd
 Vector of indexes of present data. More...
 
double _nu
 Student- \(t\) degrees of freedom.
 
string _outFile
 Output file name.
 
gsl_rng * _r
 Pseudo-random number generator. More...
 

Detailed Description

Standard Student- \(t\) weights.

Mostly a standard implementation of the weight parameter sampling for Student- \(t\) modeling. The only deviation of the standard approach concerns the situation where some values in the data are missing. If we impute values for these elements, the weights become confounded with means. So the weights are kept strictly equal to 1.0 and not updated.

Note
The weights are relatively small for values far from the mean, i.e. outliers have small \(q\).

Constructor & Destructor Documentation

◆ Qgrp() [1/7]

Qgrp::Qgrp ( )
inline

Default constructor.

Results in an empty vector of weights.

◆ Qgrp() [2/7]

Qgrp::Qgrp ( const size_t &  N)

Deterministic size-only constructor.

Creates a vector of weights that all equal to 1.0, and three degrees of freedom (the smallest possible that still gives a destribution with defined mean and variance).

Parameters
[in]size_t&number of weights

◆ Qgrp() [3/7]

Qgrp::Qgrp ( const size_t &  N,
const double &  nu 
)

Deterministic constructor with degrees of freedom.

Creates a vector of weights that all equal to 1.0, and degrees of freedom set to the given value.

Parameters
[in]size_t&number of weights
[in]double&degrees of freedom

◆ Qgrp() [4/7]

Qgrp::Qgrp ( const size_t &  N,
const double &  nu,
const string &  misVecFlNam 
)

Deterministic constructor with degrees of freedom and missing values.

Creates a vector of weights that all equal to 1.0, and degrees of freedom set to the given value. The given file is read to determine which rows of data have missing values.

Parameters
[in]size_t&number of weights
[in]double&degrees of freedom
[in]string&missing value file name

◆ Qgrp() [5/7]

Qgrp::Qgrp ( const size_t &  N,
const string &  outFileNam 
)

Deterministic size-only constructor with output file name.

Creates a vector of weights that all equal to 1.0, and three degrees of freedom (the smallest possible that still gives a destribution with defined mean and variance).

Parameters
[in]size_t&number of weights
[in]string&output file name

◆ Qgrp() [6/7]

Qgrp::Qgrp ( const size_t &  N,
const string &  outFileNam,
const double &  nu 
)

Deterministic constructor with degrees of freedom and output file name.

Creates a vector of weights that all equal to 1.0, and degrees of freedom set to the given value.

Parameters
[in]size_t&number of weights
[in]string&output file name
[in]double&degrees of freedom

◆ Qgrp() [7/7]

Qgrp::Qgrp ( const size_t &  N,
const string &  outFileNam,
const double &  nu,
const string &  misVecFlNam 
)

Deterministic constructor with degrees of freedom, missing values and output file name.

Creates a vector of weights that all equal to 1.0, and degrees of freedom set to the given value. The given file is read to determine which rows of data have missing values.

Parameters
[in]size_t&number of weights
[in]string&output file name
[in]double&degrees of freedom
[in]string&missing value file name

Member Function Documentation

◆ alpha() [1/2]

virtual double Qgrp::alpha ( )
inlinevirtual

Access to \(\alpha\).

Access to the van Dyk and Meng \(\alpha\) multiplicative redundant parameter. Is equal to 1.0 in this class.

Returns
double 1.0

Reimplemented in QgrpPEX.

◆ alpha() [2/2]

virtual double Qgrp::alpha ( ) const
inlinevirtual

Const access to \(\alpha\).

Access to the van Dyk and Meng \(\alpha\) multiplicative redundant parameter. Is equal to 1.0 in this class.

Returns
double 1.0

Reimplemented in QgrpPEX.

◆ operator[]() [1/2]

double Qgrp::operator[] ( const size_t  i)
inline

Subscript operator.

Parameters
[in]size_t&index
Returns
double weight value

◆ operator[]() [2/2]

double Qgrp::operator[] ( const size_t  i) const
inline

Const subscript operator.

Parameters
[in]size_t&index
Returns
double weight value

◆ save() [1/2]

void Qgrp::save ( const char *  how = "a")

Save to a stored file name.

Parameters
[in]char*saving mode, appending by default

◆ save() [2/2]

void Qgrp::save ( const string &  fileNam,
const char *  how = "a" 
)

Save to a given file name.

Parameters
[in]string&output file name
[in]char*saving mode, appending by default

◆ size() [1/2]

size_t Qgrp::size ( )
inline

Length of the weight vector.

Returns
size_t& vector length

◆ size() [2/2]

size_t Qgrp::size ( ) const
inline

Const length of the weight vector.

Returns
size_t& vector length

Member Data Documentation

◆ _presInd

vector<size_t> Qgrp::_presInd
protected

Vector of indexes of present data.

Only _qVec elements corresponding to rows of data with no missing values are updated.

◆ _r

gsl_rng* Qgrp::_r
protected

Pseudo-random number generator.

Initialized the same way as Grp type PNGs, with a sum of time and RTDSC.


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