0
$\begingroup$

I'm an R newbie and I'm trying to use logistic regression to predict Admission granted using 4 dependent variables - GPA, Gender, International student or not and SOP grade. Since I have only 113 data points, I used bootstrap.

  logit.bootstrap <- function(d, indices,formula) {
  d<-d[indices,]
  fit <- glm(Admission.Granted ~ GPA + Gender + International.student + 
  CLIgrade, data = data, family = "binomial")
  return(coef(fit))
}

library(boot)
logit.boot <- boot(data=data,sim = "parametric", statistic=logit.bootstrap, R=5000, formula= Admission.Granted ~ GPA + Gender + International.student + CLIgrade)
logit.boot

The result I get has only 0 in Bias and Standard Error field. I don't know what I'm doing wrong.

PARAMETRIC BOOTSTRAP


Call:
boot(data = data, statistic = logit.bootstrap, R = 5000, sim = "parametric", 
    formula = Admission.Granted ~ GPA + Gender + International.student + 
        CLIgrade)


Bootstrap Statistics :
      original  bias    std. error
t1*  1.5397795       0           0
t2*  0.5898814       0           0
t3*  0.1148014       0           0
t4* -0.8985390       0           0
t5* -0.1141786       0           0

My original logistic Regression summary is as below:

Call:
glm(formula = Admission.Granted ~ GPA + Gender + International.student + 
    CLIgrade, family = binomial, data = trainData)

Deviance Residuals: 
    Min       1Q   Median       3Q      Max  
-2.2729   0.2912   0.4194   0.5987   0.9952  

Coefficients:
                         Estimate Std. Error z value Pr(>|z|)  
(Intercept)                0.8936     5.0611   0.177   0.8599  
GPA                        1.2303     1.4029   0.877   0.3805  
GenderM                   -1.2121     0.7334  -1.653   0.0984 .
International.studentYes  -1.5696     0.7384  -2.126   0.0335 *
CLIgrade                  -0.1678     0.1893  -0.886   0.3754  
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

(Dispersion parameter for binomial family taken to be 1)

    Null deviance: 60.542  on 68  degrees of freedom
Residual deviance: 52.832  on 64  degrees of freedom
AIC: 62.832

Number of Fisher Scoring iterations: 5
$\endgroup$
0
$\begingroup$

It looks like in your logit.bootstrap function, your call to glm passes in “data=data” instead of “data=d” which is the dataset that you’ve permuted.

$\endgroup$
  • $\begingroup$ Thanks @hreed7! I changed it, but still get the same output. All zeros. :( $\endgroup$ – Priyanka Baxi May 3 '19 at 14:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.