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
(eval-when-compile | |
(require 'color-theme)) | |
(defun color-theme-solarized (mode) | |
"Color theme by Ethan Schoonover, created 2011-03-24. | |
Ported to Emacs by Greg Pfeil, http://ethanschoonover.com/solarized." | |
(interactive "Slight or dark? ") | |
(let ((base03 "#002b36") | |
(base02 "#073642") | |
(base01 "#586e75") |
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
## First do the unix account setup http://wiki.dreamhost.com/Unix_account_setup | |
cd ${HOME} | |
# create the first level directories (and log/setup) | |
mkdir -pv soft run www log log/setup backup data | |
# create the second level directories within run (our own FHS) | |
for subdir in bin etc include lib man share | |
do | |
mkdir -pv run/${subdir} | |
done | |
# symlink so that man pages stay all in the same place |
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
## This file contains functions that I've found useful when working | |
## with the nbpMatching package. Context for the examples can be seen | |
## in Appendix E in | |
## http://jakebowers.org/PAPERS/WongRacialContext2012.pdf | |
## (forthcoming in the Journal of Politics). | |
## Make matrices of absolute distances | |
scalar.dist<-function(var){ | |
## Utility function to make n x n abs dist matrices | |
## Cribbed from older versions of optmatch |
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
## Eenie meenie miney mo, | |
## Catch a tiger by its toe | |
## If it hollers let it go, | |
## eenie meenie miney mo. | |
## My mom says that | |
## you are not it. | |
## The poem is 24 beats long (4 counts per line, 6 lines). | |
## The aim of the poem is to eliminate people from consideration as "it". |
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(car) | |
# | |
# | |
# | |
gss$dem<-recode(gss$partyid, "c('strong democrat','not str democrat','ind,near dem')=1 ; c('independent','other party')=NA ; NA=NA ; else=0") | |
# | |
# | |
# |
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
## ##Load a small version of Dr. Page Fortna's data. I've stripped it of the missing values to make our lives easier. | |
## load(url("http://jakebowers.org/PS230/pk.df.rda")) ##The name of the dataframe or dataset is pk.df. | |
## library(mosaic) ## the mosaic library might be useful | |
## Run these next lines | |
## First get rid of missing data to make life easier in class | |
pk.good<-na.omit(subset(pk.df,select=c('ridp','wardur','id'))) | |
lm1<-lm(ridp~wardur,data=pk.good) ## fit the model | |
coef(lm1) ## print coeficients |
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
##Load a small version of Fortna's data. | |
load(url("http://jakebowers.org/PS230/pk2.df.rda")) | |
## Make a new dataframe with no missing values and adding UNpk (UN | |
## peacekeeping) and year the civil war started | |
pk.good<-na.omit(subset(pk.df,select=c('ridp','wardur','warstart.yr','warstart.hist.yr','UNpk','id'))) | |
## Load the mosaic library for plotting etc | |
library(mosaic) | |
lm1<-lm(ridp~warstart.hist.yr,data=pk.good) ## fit the model |
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
##Load a small version of Fortna's data. | |
load(url("http://jakebowers.org/PS230Data/pk2.df.rda")) | |
## Make a new dataframe with no missing values and adding UNpk (UN | |
## peacekeeping) and year the civil war started | |
pk.good<-na.omit(subset(pk.df,select=c('ridp','wardur','warstart.yr','warstart.hist.yr','UNpk','id'))) | |
## Load the mosaic library for plotting etc | |
library(mosaic) | |
##Recall that | |
lm3<-lm(ridp~UNpk,data=pk.good) |
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
##Load a small version of Fortna's data. | |
load(url("http://jakebowers.org/PS230/pk2.df.rda")) | |
## Make a new dataframe with no missing values at all | |
pk.good<-na.omit(pk.df) | |
## Load the mosaic library for plotting etc | |
library(mosaic) | |
ssr <- function(intercept,slope,thedata=pk.good){ | |
the.model.values <- with(thedata, intercept + (slope * wardur)) ## calc model values from model function |
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
##Load a small version of Fortna's data. | |
load(url("http://jakebowers.org/PS230/pk2.df.rda")) | |
## Make a new dataframe with no missing values at all | |
pk.good<-na.omit(pk.df) | |
## Load the mosaic library for plotting etc | |
library(mosaic) | |
with(pk.good,table(UNpk,pkopF)) | |
## First just recode whether any peacekeeping happened |
OlderNewer