[e23e50]: src / modules / glm / samplers / AlbertChib.cc Maximize Restore History

Download this file

AlbertChib.cc    58 lines (46 with data), 1.2 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
#include <config.h>
#include "AlbertChib.h"
#include "KS.h"
#include "Outcome.h"
#include <graph/StochasticNode.h>
#include <graph/LinkNode.h>
#include <sampler/GraphView.h>
#include <sampler/SingletonGraphView.h>
#include <rng/TruncatedNormal.h>
#include <rng/RNG.h>
#include <cmath>
#include <module/ModuleError.h>
using std::vector;
using std::string;
using std::log;
using std::exp;
using std::fabs;
namespace jags {
namespace glm {
AlbertChib::AlbertChib(GraphView const *view,
vector<SingletonGraphView const *> const &sub_views,
vector<Outcome *> const &outcomes,
unsigned int chain, bool gibbs)
: GLMMethod(view, sub_views, outcomes, chain, true), _gibbs(gibbs)
{
}
void AlbertChib::update(RNG *rng)
{
/*
Note that we must update the auxiliary variables *before*
calling updateLM. This ordering is important for models with
a variable design matrix (e.g. measurement error models).
*/
for (vector<Outcome*>::const_iterator p = _outcomes.begin();
p != _outcomes.end(); ++p)
{
(*p)->update(rng);
}
if (_gibbs) {
updateLMGibbs(rng);
}
else {
updateLM(rng);
}
}
}}