Skip to content

Instantly share code, notes, and snippets.

View viniciusmss's full-sized avatar

Vinícius Miranda viniciusmss

  • Facebook
  • San Francisco
View GitHub Profile
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
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)
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.