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
# If you are copy/pasting this to an R Notebook, select "Raw" from the GitHub page before you copy. | |
# Replication file of Section 5 in | |
# Iacus, King, Porro (2011), Multivariate Matching Methods | |
# That Are Monotonic Imbalance Bounding, JASA, V 106, N. 493, | |
# p. 345-361 | |
foo <- read.csv(url("https://course-resources.minerva.kgi.edu/uploaded_files/mke/00089202-1711/daughters.csv")) | |
# Table 1 in Ebonya |
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
# Logistic Regression and lalonde data set | |
library(Matching) | |
data(lalonde) | |
head(lalonde) | |
summary(lalonde) | |
View(lalonde) | |
??lalonde | |
# Note: For simplicity, all operations will be performed over the training 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
# Produce model from training set | |
LinearRegression.1 <- lm(clickperview ~ timeofday + Post_type + promotion + target_audience, data=Lironne_DataSet_Training) | |
summary(LinearRegression.1) | |
predict(LinearRegression.1,Lironne_DataSet_Training) == Lironne_DataSet_Training | |
# Calculate RMSE for training set | |
RMSE.trainingset <- sqrt(mean( (Lironne_DataSet_Training$clickperview - predict(LinearRegression.1, Lironne_DataSet_Training))^2 )) | |
RMSE.trainingset |
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
# READ DATA | |
DataSet <- read.csv("datasetforCS112-TA.csv", stringsAsFactors = FALSE) | |
# FIX DATA TYPES IN DATA FRAME | |
# Factors | |
DataSet$status <- as.factor(DataSet$status) | |
DataSet$project.type <- as.factor(DataSet$project.type) | |
# Dates | |
DataSet$approval.date <- as.Date(DataSet$approval.date, format = "%d-%B-%y") | |
DataSet$implementation.start.date <- as.Date(DataSet$implementation.start.date, format="%d-%B-%y") |