"The Online Laboratory: Conducting Experiments in a Real Labor Market" (with David Rand and Richard Zeckhauser) Experimental Economics, 14:3 (2011), 399-425.
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
def hashfree(input_dir): | |
"""Makes sure---before we start doing lots of intense computations---that | |
there are not any files w/ hash in front of them (which the shutil utility | |
cannot copy for some reason) """ | |
no_bad_files = True | |
bad_files = [] | |
for root, subFolders, files in os.walk(input_dir): | |
for f in files: | |
if re.search('\.#.*', f): | |
no_bad_files = False |
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
n <- 100 | |
x <- runif(n) | |
y <- 5*x | |
missing <- runif(n) > .80 | |
df <- data.frame(y = y, x = x, missing = missing) | |
df$x[missing] <- mean(df$x[!missing]) | |
df$y[!df$missing] <- df$y[!df$missing] + .80 | |
m <- lm(y ~ x + missing, data = df) | |
summary(m) |
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
Coefficients: | |
Estimate Std. Error t value | |
(Intercept) -0.070957 0.022836 -3.107 | |
log(job_desc_length) 0.032188 0.003320 9.695 | |
grouptreatment 0.042197 0.008536 4.943 | |
factor(level1)Business Services 0.023747 0.027189 0.873 | |
factor(level1)Customer Service -0.010701 0.030912 -0.346 | |
factor(level1)Design & Multimedia 0.077688 0.017592 4.416 | |
factor(level1)Networking & Information Systems 0.048057 0.030840 1.558 | |
factor(level1)Sales & Marketing 0.119671 0.017374 6.888 |
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) | |
library(RPostgreSQL) | |
library(plyr) | |
library(scales) # now needed for ggplot2 | |
drv <- dbDriver("PostgreSQL") | |
con <- dbConnect(drv, dbname='db', | |
host = 'localhost', | |
user = 'db', | |
password ='pwd', |
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
## ---------------------------------------------------------------------------- | |
## Author: Jason Morgan (borrowing heavily from code contained in Martin Elff's | |
## memisc package). | |
## | |
## Notes: Additional methods for mtable formatting of lme4 model | |
## objects. Requires that the memisc package be loaded prior to | |
## sourcing these functions. | |
## ---------------------------------------------------------------------------- | |
setSummaryTemplate(mer = c("Log-likelihood" = "($logLik:f#)", |
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
(add-to-list 'load-path "~/.emacs.d/") | |
(add-to-list 'load-path "/usr/share/emacs/site-lisp/ess") | |
;; LaTeX stuff | |
(load "auctex.el" nil t t) | |
(load "preview-latex.el" nil t t) | |
;; browse the kill ring | |
(load "browse-kill-ring.el" nil t t) |
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
df.odw <- data.frame(application = df$application, p = df$p) | |
if(dbExistsTable(con, "predicted_response_probabilities")){ | |
dbRemoveTable(con, "predicted_response_probabilities") | |
} | |
dbWriteTable(con, "predicted_response_probabilities", df.odw) |
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
############################################################################ | |
# AUTHOR: John Horton | |
# PURPOSE: Extract by-country minimum hourly wages from the Wikipedia page | |
# LAST MODIFIED: May 22, 2013 | |
############################################################################ | |
library(XML) | |
library(ggplot2) | |
library(scales) |
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
tableContinuous <- function (vars, weights = NA, subset = NA, group = NA, stats = c("n", | |
"min", "q1", "median", "mean", "q3", "max", "s", "iqr", "na"), | |
prec = 1, col.tit = NA, col.tit.font = c("bf", "", "sf", | |
"it", "rm"), print.pval = c("none", "anova", "kruskal"), | |
pval.bound = 10^-4, declare.zero = 10^-10, cap = "", lab = "", | |
font.size = "footnotesize", longtable = TRUE, disp.cols = NA, | |
nams = NA, caption.placement = "bottom") | |
{ | |
print.pval <- match.arg(print.pval) | |
if (identical(disp.cols, NA) == FALSE) { |