This file contains hidden or 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
set.seed(20181001) | |
### LOOCV | |
# Load packages and data | |
library(Matching) | |
library(boot) | |
data(lalonde) | |
# Train your model on ALL the data -- Use glm instead of lm |
This file contains hidden or 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(haven) | |
library(arm) | |
df <- read_dta("C:/Users/Vinic/Downloads/turnout.dta") | |
View(df) | |
df[1,1] | |
df[1,] | |
lm2 <- glm(turnout ~ ., data = df, family = binomial) | |
summary(lm2) |
This file contains hidden or 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(boot) | |
#estimate the mean via bootstrapping | |
boot.mean <- function(data,index) return(mean(data[index])) | |
#calculate the CI via t-distribution | |
t.dist.ci <- function(samp) { | |
df <- length(samp) - 1 | |
factors <- qt(c(0.025, 0.975), df = df) | |
samp.mean <- mean(samp) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.