Newer
Older
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
# Proposal generators
## List of built-in proposals
```@docs
StaticProposal
```
```@docs
RandomWalk
```
```@docs
TransformedProposal
```
```@docs
StackedProposal
```
```@docs
ComponentwiseProposal
```
## Custom Proposal generator
To define a custom proposal inherit from the abstract type
```julia
struct MyProposal <: AbstractProposal{issymmetric::Bool}
# ...
end
```
```@docs
propose
```
Implement the sampling methods
- initialization x₀ ~ p₀(⋅) by `x₀ = propose(p)`
- and transition y ~ q(⋅|x) by `y = propose(p, x)`
```julia
propose(rng::AbstractRNG, p::MyProposal) = ...
propose(rng::AbstractRNG, p::MyProposal, x) = ...
```
For symmetric proposals `q(x|y) = q(y|x)` and the likelihood ratio can be neglected.
For asymmetric proposals also implement method for calculating q(y|x)
```julia
logpdf(p::AbstractProposal{false},x,y) = ...
```