Skip to content

Instantly share code, notes, and snippets.

Avatar

Sean Norton stnorton

View GitHub Profile
View shock_cal_example.txt
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")
@stnorton
stnorton / gensim_enviro.yml
Created Jul 6, 2020
Gensim Conda Environment
View gensim_enviro.yml
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
@stnorton
stnorton / R2MALLET.r
Created Nov 14, 2019 — 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.
View R2MALLET.r
# 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 / model.stan
Last active Apr 11, 2019
Stan 'i' error reproduction
View model.stan
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