Skip to content

Instantly share code, notes, and snippets.

View pattoM's full-sized avatar

Patrick Mutuku pattoM

View GitHub Profile
#using dictionaries
class TrieDict:
def __init__(self):
self.hub = {"*":{}}
def add_new(self,word):
#set head to hub
cur_node = self.hub["*"]
#loop through word
#QUESTION 1
#read data
control <- read.table("nswre74_control.txt", header=FALSE)
treated <- read.table("nswre74_treated.txt", header=FALSE)
#simple difference in means for 1978 earnings
diff_means <- mean(treated$V10) - mean(control$V10)
#output diff in means
diff_means
@pattoM
pattoM / Lalonde3ways.R
Last active February 20, 2018 13:27
Code for assignment - Lalonde 3 ways
#Load library and data
library("Matching")
data("lalonde")
#Separate data into subsets based on the degree status
nodegree <- subset(lalonde, nodegr == 1)
degree <- subset(lalonde, nodegr == 0)
#Make scatterplot of the data
plot(re78 ~ treat+educ+age+re74+re75,data=nodegree, xlab="Variables", ylab="Real earnings 1978", main="Linear regression for without degree")