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
--- | |
title: 'Beamer Overlay Test' | |
output: | |
beamer_presentation: | |
incremental: true | |
theme: CambridgeUS | |
--- | |
```{r, echo = FALSE} |
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
group.mean <- function(x, group) { | |
out <- tapply(x, group, mean, na.rm = TRUE) | |
out[group] | |
} | |
data(state.fips, package = "maps") | |
state.fips <- unique(state.fips[,c("fips","abb")]) | |
state.fips$abb <- as.character(state.fips$abb) | |
state.fips <- rbind(state.fips, c(2, "AK")) | |
state.fips <- rbind(state.fips, c(15, "HI")) |
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
fips | county_name.x | trump.share | blkprop2010 | blkprop40 | w.med.income2014 | |
---|---|---|---|---|---|---|
45001 | Abbeville | 0.369 | 0.282763504740921 | 0.424796127512974 | 39287 | |
45003 | Aiken | 0.316 | 0.245810404812023 | 0.41912412853594 | 52247 | |
45007 | Anderson | 0.3195 | 0.160426664386563 | 0.26353819100009 | 45788 | |
45009 | Bamberg | 0.401 | 0.615312441358604 | 0.606340181301293 | 44127 | |
45011 | Barnwell | 0.427 | 0.442730206445338 | 0.626576621312941 | 44781 | |
45013 | Beaufort | 0.301 | 0.192870747628411 | 0.670735581068204 | 65475 | |
45015 | Berkeley | 0.3398 | 0.250299421399774 | 0.64711736950752 | 58645 | |
45019 | Charleston | 0.264 | 0.297647975922949 | 0.491911977209859 | 64441 | |
45021 | Cherokee | 0.42 | 0.203787358606483 | 0.234154400720937 | 38562 |
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
#! /bin/sh | |
if [ -r "$1" ]; then | |
mdfile="$1" | |
Rscript -e "rmarkdown::render('${mdfile}', 'all')" | |
else | |
exit 0 | |
fi |
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(Amelia) | |
data(africa) | |
a.out <- amelia(africa, ts = "year", cs = "country") | |
overimpute(a.out, "gdp_pc") | |
overimpute(a.out, "gdp_pc", subset = country == "Burkina Faso") | |
overimpute(a.out, "gdp_pc", subset = gdp_pc >=500) |
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
## Function to implment the MCMC sampler | |
polling.gibbs.kal.fixedS <- function(y, size, dates, states, big, ## data | |
F, X=NULL, XL = NULL, Z=NULL, ## covariates | |
m.0, C.0, b = NULL, B = NULL, ## hyper-parameters | |
starts, phi, sigma.a, nu, beta, k, ## starting values | |
tune, A, | |
iters = 10000, thin = 1, burnin = 0) { ## mcmc stuff | |
aa <- proc.time() | |
## pre-gibbs cleaning (calculate variances, setup times, etc) |
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
### Create plots for MO talk | |
library(tikzDevice) | |
x <- rnorm(200,0,.4) | |
y <- x + rnorm(200, 0, .4) | |
night <- rgb(26,31,30, max=255) | |
beach <- rgb(227,223,186, max=255) |
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
## Function to implment the MCMC sampler | |
polling.gibbs.kal <- function(y, size, dates, states, big, ## data | |
F, X=NULL, XL = NULL, Z=NULL, ## covariates | |
m.0, C.0, b = NULL, B = NULL, ## hyper-parameters | |
c.0, d.0, e.0, f.0, g.0, h.0, | |
starts, phi, sigma.a, nu, beta, ## starting values | |
tune, A, tune.phi, | |
iters = 10000, thin = 1, burnin = 0) { ## mcmc stuff | |
aa <- proc.time() |