You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Overview_IntroductionNIMBLE.Rmd
+6-6Lines changed: 6 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,6 @@
1
1
---
2
2
title: "Introduction to NIMBLE"
3
+
subtitle: "Material from the book <br> [Bayesian Analysis of Capture-Recapture Data with Hidden Markov Models: Theory and Case Studies in R](https://oliviergimenez.github.io/banana-book/)"
```{r nimblelogo, message = FALSE, echo = FALSE, fig.align="center", out.width="50%", fig.cap = "Logo of the NIMBLE R package designed by Luke Larson."}
NIMBLE stands for **N**umerical **I**nference for statistical **M**odels using **B**ayesian and **L**ikelihood **E**stimation. Briefly speaking, NIMBLE is an R package that implements for you MCMC algorithms to generate samples from the posterior distribution of model parameters. Freed from the burden of coding your own MCMC algorithms, you only have to specify a likelihood and priors to apply the Bayes theorem. To do so, NIMBLE uses a syntax very similar to the R syntax, which should make your life easier. This so-called BUGS language is also used by other programs like WinBUGS, OpenBUGS, and JAGS.
@@ -28,7 +28,6 @@ To run NIMBLE, you will need to:
28
28
4. Pick initial values for parameters to be estimated (for each chain).
29
29
5. Provide MCMC details namely the number of chains, the length of the burn-in period and the number of iterations following burn-in.
30
30
31
-
32
31
First things first, let's not forget to load the `nimble` package ad the other packages useful for this workshop:
33
32
```{r, message = FALSE}
34
33
library(nimble)
@@ -567,15 +566,15 @@ survival$calculate()
567
566
# this is dbinom(x = 19, size = 57, prob = 0.5, log = TRUE)
568
567
```
569
568
570
-
The ability in NIMBLE to access the nodes of your model and to evaluate the model likelihood can help you in identifying bugs in your code. For example, if we provide a negative initial value to`theta`, `survival$calculate()` returns `NA`.
569
+
The ability in NIMBLE to access the nodes of your model and to evaluate the model likelihood can help you in identifying bugs in your code. For example, if we provide a negative initial value for`theta`, `survival$calculate()` returns `NA`:
571
570
```{r, warning = FALSE}
572
571
survival <- nimbleModel(code = model,
573
572
data = my.data,
574
573
inits = list(theta = -0.5))
575
574
survival$calculate()
576
575
```
577
576
578
-
Other example : if there are more survived than released:
577
+
As another example, if we convey in the data the information that more animals survived than were released, we'll get an infinity value for the log-likelood:
Then, to check the model is correctly initialized and without bug in the code, we can check that `model$calculate()` returns a number and not `NA` or `-Inf`.
587
+
588
+
As a check that the model is correctly initialized and that your code is without bugs, the call to `model$calculate()` should return a number and not `NA` or `-Inf`.
Copy file name to clipboardExpand all lines: index.Rmd
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -84,7 +84,7 @@ background-color: white
84
84
85
85
+ Choosing and coding MCMC samplers
86
86
87
-
+ Material from [a book in progress](https://oliviergimenez.github.io/banana-book/)
87
+
+ Material from [a book in progress](https://oliviergimenez.github.io/banana-book/), NIMBLE chapter is [here](https://github.com/oliviergimenez/nimble-workshop/blob/master/Overview_IntroductionNIMBLE.pdf)
88
88
89
89
+[R codes on GitHub](https://github.com/oliviergimenez/nimble-workshop/blob/master/Rcodes_NimbleGDR.R) for easier manipulation
+ Material from [a book in progress](https://oliviergimenez.github.io/banana-book/)
82
+
+ Material from [a book in progress](https://oliviergimenez.github.io/banana-book/), NIMBLE chapter is [here](https://github.com/oliviergimenez/nimble-workshop/blob/master/Overview_IntroductionNIMBLE.pdf)
83
83
84
84
+ [R codes on GitHub](https://github.com/oliviergimenez/nimble-workshop/blob/master/Rcodes_NimbleGDR.R) for easier manipulation
0 commit comments