Skip to content

Commit 37a91f8

Browse files
authored
Update README.md
1 parent 296a6a4 commit 37a91f8

File tree

1 file changed

+15
-14
lines changed

1 file changed

+15
-14
lines changed

README.md

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,15 @@ AdvancedMH works by accepting some log density function which is used to constru
1111
```julia
1212
# Import the package.
1313
using AdvancedMH
14+
using Distributions
15+
16+
# Generate a set of data from the posterior we want to estimate.
17+
data = rand(Normal(0, 1), 30)
1418

1519
# Define the components of a basic model.
1620
insupport(θ) = θ[2] >= 0
1721
dist(θ) = Normal(θ[1], θ[2])
18-
density(data, θ) = insupport(θ) ? sum(logpdf.(dist(θ), data)) : -Inf
19-
20-
# Generate a set of data from the posterior we want to estimate.
21-
data = rand(Normal(0, 1), 30)
22+
density(θ) = insupport(θ) ? sum(logpdf.(dist(θ), data)) : -Inf
2223

2324
# Construct a DensityModel.
2425
model = DensityModel(density)
@@ -46,19 +47,19 @@ parameters = μ, σ
4647

4748
Summary Statistics
4849

49-
│ Row │ parameters │ mean │ std │ naive_se │ mcse │ ess │ r_hat │
50-
│ │ Symbol │ Float64 │ Float64 │ Float64 │ Float64 │ Any │ Any │
51-
├─────┼────────────┼──────────┼──────────┼────────────┼────────────┼─────────┼─────────┤
52-
1 │ μ │ -0.239080.1876080.00059327 0.003100813225.021.00003
53-
2 │ σ │ 0.98903 0.1384370.0004377770.002427482830.8 1.0003
50+
│ Row │ parameters │ mean │ std │ naive_se │ mcse │ ess │ r_hat │
51+
│ │ Symbol │ Float64 │ Float64 │ Float64 │ Float64 │ Any │ Any │
52+
├─────┼────────────┼──────────┼──────────┼────────────┼────────────┼─────────┼─────────┤
53+
1 │ μ │ 0.08341880.2414180.00076343 0.003410674693.041.00008
54+
2 │ σ │ 1.33116 0.1841110.000582210.002587784965.83 1.00001
5455

5556
Quantiles
5657

57-
│ Row │ parameters │ 2.5%25.0%50.0%75.0% 97.5%
58-
│ │ Symbol │ Float64 │ Float64 │ Float64 │ Float64 │ Float64 │
59-
├─────┼────────────┼──────────┼───────────┼───────────┼──────────┼──────────┤
60-
1 │ μ │ -0.61185-0.360519-0.236016-0.1196660.134902
61-
2 │ σ │ 0.7584770.8878940.973777 1.07983 1.29455
58+
│ Row │ parameters │ 2.5% 25.0% 50.0%75.0%97.5%
59+
│ │ Symbol │ Float64 │ Float64 │ Float64 │ Float64 │ Float64 │
60+
├─────┼────────────┼──────────┼───────────┼───────────┼──────────┼──────────┤
61+
1 │ μ │ -0.393769-0.07711340.08016880.2411620.564331
62+
2 │ σ │ 1.036851.20441.30992 1.43609 1.75745
6263
```
6364

6465
## Custom proposals

0 commit comments

Comments
 (0)