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 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") |
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
#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 |
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
# [INSERT CODE HERE] Initial state | |
state = 1 | |
# [INSERT CODE HERE] Define the goal here | |
goal = 1024 | |
# Frontier | |
from collections import deque | |
frontier = deque([state]) |
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
#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 |