forked from andrewcparnell/ecots
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Prerequisites.Rmd
63 lines (46 loc) · 1.64 KB
/
Prerequisites.Rmd
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
59
60
61
62
---
title: 'Time series models for ecologists: course pre-requisites'
author: "Andrew Parnell"
output:
html_document: default
pdf_document: default
urlcolor: blue
---
In preparation for the course please install the following, preferably in the below suggested order.
Remember you will need to bring your own personal computer for the duration of the course.
### Step 1
Install the following using the corresponding links
- R: [http://www.r-project.org](http://www.r-project.org)
- Rstudio (optional but recommended): [https://www.rstudio.com](https://www.rstudio.com)
- JAGS: [http://mcmc-jags.sourceforge.net](http://sourceforge.net/projects/mcmc-jags/files/)
### Step 2
Now install the following packages by going into Rstudio (or R) and typing:
```{r,eval=FALSE}
install.packages(c('R2jags',
'rjags',
'lubridate',
'tidyverse',
'forecast'))
```
### Step 3
Install `rstan` by going to this [link](https://github.com/stan-dev/rstan/wiki/RStan-Getting-Started) and following the instructions for your operating system.
### Step 4
Check that JAGS works by going to a command line terminal and typing `jags`. If it opens successfully type `exit`.
Now go into R and copy and paste the following text:
```{r,eval=FALSE}
library(R2jags)
model_code="
model {
y ~ dnorm(mu,1)
mu ~ dnorm(0,1)
}
"
model=jags(data=list(y=1),
model.file=textConnection(model_code),
parameters.to.save = 'mu',
n.chains=1)
plot(model)
```
This should produce a plot.
### Troubleshooting
If you run into any problems please drop us a line at <[email protected]>.