This file contains hidden or 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(XML) | |
library(ggplot2) | |
df <- readHTMLTable("http://projects.dailycal.org/paychecker/departments/")[[1]] | |
DeMoney <- function(x) as.numeric(gsub(",", "", gsub("\\$", "", as.character(x)))) | |
money.columns <- c("All", "Professor", "Associate professor", "Assistant professor", | |
"Lecturer") |
This file contains hidden or 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(geofacet) # my forked version | |
library(ggplot2) | |
library(jsonlite) | |
library(ggrepel) | |
# grab top cities | |
cities <- fromJSON("https://gist.githubusercontent.com/Miserlou/c5cd8364bf9b2420bb29/raw/2bf258763cdddd704f8ffd3ea9a3e81d25e2c6f6/cities.json") | |
n <- 50 | |
x <- cities$longitude[1:n] |
This file contains hidden or 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(lfe) | |
library(stargazer) | |
set.seed(6152011) | |
# Number of cities | |
L <- 1000 | |
# Number of industries | |
K <- 3 |
This file contains hidden or 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
SimExperiment <- function(num.groups, sample.size, beta, randomize.by.group = FALSE){ | |
"Simulate running an analysis of the experiment with linear regression" | |
df <- CreateClusteredData(num.groups, sample.size, beta, randomize.by.group = randomize.by.group) | |
m <- lm(y ~ trt, data = df) | |
c(as.numeric(coef(m)[2]), as.numeric(sqrt(diag(vcov(m))[2]))) | |
} |
This file contains hidden or 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
CreateClusteredData <- function(num.groups, sample.size, beta, randomize.by.group = FALSE){ | |
individual <- 1:sample.size # index for individuals | |
group <- sample(1:num.groups, size = sample.size, replace = TRUE) # randomly assign everyone to a group | |
group.effect <- rnorm(num.groups) # create a group-specific effect | |
eta <- group.effect[group] # give each individual their group-specific effect | |
epsilon <- rnorm(sample.size) # given each individual an individual-specific effect | |
if (randomize.by.group){ | |
group.trt.assignment <- rbinom(num.groups, 1, 0.5) | |
trt <- group.trt.assignment[group] | |
} else { |
This file contains hidden or 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
ts := $(shell /bin/date "+%Y-%m-%d---%H-%M-%S") | |
project.pdf: project.bib project.tex | |
pdflatex -interaction=nonstopmode project | |
bibtex project | |
pdflatex -interaction=nonstopmode project | |
pdflatex -interaction=nonstopmode project | |
backup: | |
tar --exclude='../backups' -zcvf ../backups/project_$(ts).tar.gz ../ |
This file contains hidden or 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(ggplot2) | |
# simulate experiments using stratification and randomization and report | |
# absolute difference in estimates from true treatment effect, tau. | |
simExp <- function(n, tau, beta = 3){ | |
x <- sort(runif(n)) | |
W.rand <- rbinom(n,1,0.5) | |
W.strat <- rep(c(0,1), n/2) | |
epsilon <- rnorm(n, 0, 0.5) |
This file contains hidden or 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
<html lang="en"> | |
<title>Obot</title> | |
<head> | |
<meta charset="utf-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<meta name="description" content=""> | |
<meta name="author" content=""> |
This file contains hidden or 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(JJHmisc) | |
library(oDeskTools) #internal package for working with oDesk data | |
library(ggplot2) | |
library(reshape2) | |
library(scales) | |
connectDB(get_credentials()) | |
df.wide <- dbGetQuery(con, "select * from active_window_trends") |
We can make this file beautiful and searchable if this error is corrected: Illegal quoting in line 5.
This file contains hidden or 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
response knew_count learned_formal learned_social learned_inferred | |
Yes, because it was through school and I knew the particular amount of interview spots that were open. 1 0 0 1 | |
Yes the last time I applied for a job they were considering two people. My friend that work there told me. 1 0 1 0 | |
The last time I tried to apply for a job, I did not know how many people the firm was considering since it was a blind interview. 0 0 0 0 | |
No, I had no idea. The only indication was I was not told anything other than they had "several" other people to interview. "Several" could mean anything, although I doubt they would interview more than 10-15. 0 0 0 0 | |
I had no idea how many candidates were being considered for the position. I was only aware that the position was available. 0 0 0 0 | |
no, I had no idea. 0 0 0 0 | |
Yes, I knew how many because associate conducting the interview mentioned that there were two other applicants coming in for interviews in the coming days so the final decision would not come for a few day afterwar |