Skip to content

Instantly share code, notes, and snippets.

View stnorton's full-sized avatar

Sean Norton stnorton

View GitHub Profile
@stnorton
stnorton / model.stan
Last active April 11, 2019 19:51
Stan 'i' error reproduction
data {
int N; //number of obs
int i; //number of legislators THIS CREATES THE ERROR
int J; //number of bills
int K; //legislator covariates
matrix[i,K] Z; //predictors
int<lower = 0, upper = 1> vote[N]; //observations
int bills[N]; //bil indicator
@stnorton
stnorton / R2MALLET.r
Created November 14, 2019 20:16 — forked from benmarwick/R2MALLET.r
R code to operate MALLET entirely from within R. Set variables, send commands to Windows' command console and get MALLET's result back into R for further analysis.
# Set working directory
dir <- "C:\\" # adjust to suit
setwd(dir)
# configure variables and filenames for MALLET
## here using MALLET's built-in example data and
## variables from http://programminghistorian.org/lessons/topic-modeling-and-mallet
# folder containing txt files for MALLET to work on
importdir <- "C:\\mallet-2.0.7\\sample-data\\web\\en"
@stnorton
stnorton / gensim_enviro.yml
Created July 6, 2020 15:08
Gensim Conda Environment
name: gensimenv
channels:
- defaults
dependencies:
- _libgcc_mutex=0.1=main
- asn1crypto=1.2.0=py37_0
- backcall=0.1.0=py37_0
- blas=1.0=mkl
- boto=2.49.0=py37_0
- boto3=1.10.19=py_0
structure(list(rcode = c("DE1", "DE1", "DE1", "DE1", "DE1", "DE1",
"DE1", "DE1", "DE1", "DE1", "DE1", "DE2", "DE2", "DE2", "DE2",
"DE2", "DE2", "DE2", "DE2", "DE2", "DE2", "DE2"), n_RAI = c(34.47871,
34.91596, 34.91596, 34.88745, 34.79049, 34.79049, 34.79049, 35.48414,
35.98985, 35.98985, 36.98985, 34.47871, 34.91596, 34.91596, 34.88745,
34.79049, 34.79049, 34.79049, 35.48414, 35.98985, 35.98985, 36.98985
), year = c(2000L, 2001L, 2002L, 2003L, 2004L, 2005L, 2006L,
2007L, 2008L, 2009L, 2010L, 2000L, 2001L, 2002L, 2003L, 2004L,
2005L, 2006L, 2007L, 2008L, 2009L, 2010L)), row.names = 375:396, class = "data.frame")