-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.Rmd
93 lines (61 loc) · 4.04 KB
/
README.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
---
title: "Replication materials for IJF ILC 2014 paper"
output: github_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
**[Irregular Leadership Changes in 2014: Forecasts using ensemble, split-population duration models](http://www.sciencedirect.com/science/article/pii/S0169207015000485)**
For questions contact the corresponding author [Michael Ward](mailto:michael.don.ward@gmail.com) or [Andreas Beger](mailto:adbeger@gmail.com).
This article is a summary of a longer technical report for the [PITF](http://en.wikipedia.org/wiki/Political_Instability_Task_Force). The complete [original report](http://arxiv.org/abs/1409.7105) is available on arXiv.org, and contains a large amount of additional information on the method we used for forecasting, accuracy assessments, etc.
**Citation:**
```bibtex
@article{beger2016irregular,
title={Irregular Leadership Changes in 2014: Forecasts using ensemble, split-population duration models},
author={Beger, Andreas and Dorff, Cassy L. and Ward, Michael D.},
journal={International Journal of Forecasting},
year={2016},
volume={32},
issue={1},
pages={98--111}
}
```
Getting the code and data
-----
The easiest way to get the replication code is to [download a zip](https://github.com/andybega/ijf-ilc2014/archive/master.zip). Alternatively, you can clone the repository through the Github GUI client ([OS X](https://mac.github.com/), [Windows](https://windows.github.com/)).
The data are available on dataverse: [http://dx.doi.org/10.7910/DVN/28942](http://dx.doi.org/10.7910/DVN/28942). Several smaller intermediate results are included in the git data folder, but replicating the full analysis will require the larger raw data from dataverse.
Running the replication
-----
1. [Download](https://github.com/andybega/ijf-ilc2014/archive/master.zip) or [clone](github-mac://openRepo/https://github.com/andybega/ijf-ilc2014) this repository.
2. Download the data sets on [Dataverse](http://dx.doi.org/10.7910/DVN/28942), at least the 2 beginning with `irc-data` and place them in `replication/data`.
3. In `runme.R`, change the working directory path on line 33.
4. Source or run the code in `runme.R`. We recommend running through the code block by block rather than sourcing. The original analysis was run on OS X using R 3.0.2 and 3.1.1.
The script relies on two packages, `EBMAforecastbeta` and `spduration` that are not available on CRAN. They are included in `replication/R/packages` with both OS X and Windows versions. The replication script will attempt to install them if they are not already present, but you may have to do so manually if this fails.
Files and scripts
------
`data`:
* `all_preds.rda` - contains all theme/ensemble predictions from 2001 to 2014-09; used throughout `runme.r` to replicate figures in the same order as in the article, even though the models needed to create it are estimated in the same script
* `ensemble_data.rda` - calibration/test data to estimate ensemble
* `irc_data_mod.rda` - imputed data
* `ensemble.rda` - saved ensemble model object
* `irc-data-v3.rda` - raw, unimputed source data
* `model_estimates.rda` - saved estimates for the 7 theme models
`graphics`:
* Contains the graphics used in the article.
`R/packages`:
* `EBMAforecastbeta_0.44.tar.gz` – OS X source package
* `EBMAforecastbeta_0.44.zip` – Windows source package
* `spduration_0.12.tar.gz` – OS X source package
* `spduration_0.12.zip` – Windows source package
`R/utilities`:
* `ensemble_forecast.r` - helper functions to calculate ensemble forecast
* `gather_preds.r` - gathers all theme/ensemble predictions from 2001 to 2014-09 in one data frame, `all_preds.rda`
* `theme_models.r` - helper functions for theme model fit
* `varDecomp.r` - helpfer functions for variable variance decomposition
* `worldMap.r` - function for choropleth worldmap
## 2019-04-05 Update
Checked replication and updated several issues. See `runme.R` for more details in the notes at the top.
To replicate the exact results, use the saved fitted models and predictions.
```{r}
sessionInfo()
```