This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Chris Giles: | |
# | |
# "Robustness of IMF data scrutinised", Oct 12 2012: | |
# http://www.ft.com/intl/cms/s/0/85a0c6c2-1476-11e2-8cf2-00144feabdc0.html#axzz2LKQkV3SH | |
# | |
# "Has the IMF proved multipliers are really large? (wonkish)" Oct 12 2012: | |
# http://blogs.ft.com/money-supply/2012/10/12/has-the-imf-proved-multipliers-are-really-large-wonkish/ | |
# | |
# "The IMF and multipliers, again", Jan 7 2013: | |
# http://blogs.ft.com/money-supply/2013/01/07/the-imf-and-multipliers-again/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
##programmer: JEY | |
##2/28/2013 | |
##District-month forecasts | |
##note: this takes about 5 minutes to run. It throws lots of errors due to many all zero time series, but it will eventually complete and build predictions | |
rm(list=ls()) | |
library(foreign) | |
library(forecast) | |
library(sos) | |
data<-read.dta("raw_AFG.dta") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Takes as input a Google Docs spreadsheet | |
### Outputs national and regional level estimates of support | |
### over time | |
### Load libraries | |
library(R2WinBUGS) | |
library(rjags) | |
library(RCurl) | |
library(reshape) | |
library(foreach) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Please note, this script is entirely derivative of work done | |
## by Simon Jackman for his article `Pooling the Polls...' | |
## Aust. J. Pol. Science, 40(4): 499-517 | |
## Libraries | |
library(reshape) | |
library(rjags) | |
library(R2WinBUGS) | |
library(ggplot2) | |
library(scales) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(boot) | |
r2 = function(f, d, i) { | |
d = d[i, ] | |
f = lm(f, data = d) | |
return(summary(f)$r.square) | |
} | |
br <- boot(COI, r2, 10000, formula = nb.publis ~ nb.liens) | |
br | |
plot(br) | |
boot.ci(br, .95, "bca") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(sp) | |
library(raster) | |
library(rgeos) | |
## import des données | |
download.file(url = "http://biogeo.ucdavis.edu/data/gadm2.8/rds/GBR_adm2.rds", | |
destfile = file.path(tempdir(), "GBR_adm2.rds")) | |
download.file(url = "http://biogeo.ucdavis.edu/data/gadm2.8/rds/IRL_adm0.rds", | |
file.path(tempdir(),"IRL_adm0.rds")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(foreign) ## for data import | |
library(dplyr) ## for chaining ops together | |
library(ggplot2) ## for plotting | |
library(reshape2) ## for reshaping | |
library(hrbrthemes) ## for pretty pictures | |
library(survey) ## for... uh, survey data | |
party.colours <- c("#0087DC","#D50000","#FDBB30","#FFFF00","#008142","#99CC33","#70147A","#DDDDDD") | |
bes <- read.spss("~/Dropbox/2017-forecasting/data/individual/BES2015_W10_Panel_v0.3.sav") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(httr) | |
adresse <- "8 bd du port" | |
resultraw <- httr::GET(utils::URLencode(paste0('https://api-adresse.data.gouv.fr/search/?q=', adresse))) | |
result <-jsonlite::fromJSON(httr::content(resultraw, "text")) | |
result$features |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(tidyverse) | |
### Make sure to download files from www.parlgov.org! | |
elec <- read.csv("view_election.csv") | |
cab <- read.csv("view_cabinet.csv") | |
party <- read.csv("view_party.csv") | |
### Date | |
cab$start_date <- as.Date(cab$start_date) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
################################################################################ | |
# | |
# ikashnitsky.github.io 2017-06-30 | |
# Produce an RGB coded map of pop structures at NUTS-3 level | |
# Ilya Kashnitsky, [email protected] | |
# | |
################################################################################ | |
# Erase all objects in memory | |
rm(list = ls(all = TRUE)) |
OlderNewer