[081fbe]: src / modules / glm / samplers / AuxMixBinomial.h  Maximize  Restore  History

Download this file

59 lines (52 with data), 1.6 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#ifndef AUX_MIX_BINOM_H_
#define AUX_MIX_BINOM_H_
#include "AuxMix.h"
namespace glm {
class LGMix;
/**
* @short Finite normal mixture approximation for Binomial variables
*
* Represents a binomial outcome with logit link in terms of an
* underlying continuous auxiliary variable. The distribution of
* the auxiliary variable is approximated by a finite mixture of
* normals.
*/
class AuxMixBinomial : public AuxMix
{
double const &_eta;
double const &_nb;
double const &_y;
double _y_star; // the aggregated utility
LGMix *_mix; // the normal mixture
int _r; // the component indicator
public:
/**
* Constructor. The constructor uses constant references to
* the three parameters that define the model. The member
* functions update uses the current value of these parameters
*
* @param eta Linear predictor for the probability of success
* (assuming logit link)
* @param nb Sample size of binomial distribution
* @param y Value of binomial random variable
*/
AuxMixBinomial(double const &eta, double const &nb, double const &y);
~AuxMixBinomial();
/**
* Samples the auxiliary variable from its posterior distribution
* given y and calculates a new normal mixture approximation
*/
void update(RNG *rng);
/**
* Returns the residual of the auxiliary variable according to
* the current normal approximation
*/
double value() const;
/**
* Returns the precision of the auxiliary variable according to
* the current normal approximation
*/
double precision() const;
};
}
#endif /* AUX_MIX_BINOM_H_ */

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks