I am trying to run a bootstrapped binary logistic regression. I have loaded the dataset manually into Rstudio (don't know the syntax yet! actually the syntax I learned from Rcommander didn't work in Rstudio); and here is my code for the bootstrapped regression (thanks to this site):
(the variable names are masked for confidentiality)
When I ran it, it gave me these warnings:
I should add that the dataset was mean-centered for all the X variables. For the Y variables, the mean-centered variables was later converted to zeros and 1s (in the reverse format of the original zeros and 1s in the non-centered Y).
Now I am doing a
but it gives me a single confidence interval (possibly for the R-squared(?)) but I need the CIs for all the estimates. I am now working on that, but would appreciate any nice suggestions.
Besides, why it doesn't give any P values?! (just gives betas and biases ans SEs)
(the variable names are masked for confidentiality)
Code:
library (boot)
#defining a function which will be later used within the boot() function
GLM <- function(formula, data, indices) {
d <- data[indices, ] # allows boot to select sample
fit <- glm(Y ~ X1 +X2 +X3 +X4 +X5
+ [I]All the two-sided interactions of the X variables[/I]
family=binomial(logit), data=d)
return(coef(fit))
}
results <- boot(data=CenteredY01 , statistic = GLM, R= 100, formula= Y ~ X1 +X2 +X3 +X4 +X5 )
results
plot(results, index=1) # intercept
plot(results, index=2) # wt
plot(results, index=3) # disp
Code:
1: glm.fit: fitted probabilities numerically 0 or 1 occurred
2: glm.fit: fitted probabilities numerically 0 or 1 occurred
3: glm.fit: fitted probabilities numerically 0 or 1 occurred
4: glm.fit: fitted probabilities numerically 0 or 1 occurred
5: glm.fit: fitted probabilities numerically 0 or 1 occurred
6: glm.fit: fitted probabilities numerically 0 or 1 occurred
7: glm.fit: fitted probabilities numerically 0 or 1 occurred
8: glm.fit: fitted probabilities numerically 0 or 1 occurred
9: glm.fit: fitted probabilities numerically 0 or 1 occurred
10: glm.fit: fitted probabilities numerically 0 or 1 occurred
11: glm.fit: algorithm did not converge
12: glm.fit: fitted probabilities numerically 0 or 1 occurred
13: glm.fit: fitted probabilities numerically 0 or 1 occurred
14: glm.fit: fitted probabilities numerically 0 or 1 occurred
15: glm.fit: fitted probabilities numerically 0 or 1 occurred
16: glm.fit: fitted probabilities numerically 0 or 1 occurred
17: glm.fit: fitted probabilities numerically 0 or 1 occurred
18: glm.fit: fitted probabilities numerically 0 or 1 occurred
19: glm.fit: fitted probabilities numerically 0 or 1 occurred
20: glm.fit: fitted probabilities numerically 0 or 1 occurred
21: glm.fit: fitted probabilities numerically 0 or 1 occurred
22: glm.fit: fitted probabilities numerically 0 or 1 occurred
23: glm.fit: fitted probabilities numerically 0 or 1 occurred
24: glm.fit: algorithm did not converge
25: glm.fit: fitted probabilities numerically 0 or 1 occurred
26: glm.fit: fitted probabilities numerically 0 or 1 occurred
27: glm.fit: fitted probabilities numerically 0 or 1 occurred
28: glm.fit: fitted probabilities numerically 0 or 1 occurred
29: glm.fit: fitted probabilities numerically 0 or 1 occurred
30: glm.fit: fitted probabilities numerically 0 or 1 occurred
31: glm.fit: algorithm did not converge
32: glm.fit: fitted probabilities numerically 0 or 1 occurred
33: glm.fit: fitted probabilities numerically 0 or 1 occurred
34: glm.fit: fitted probabilities numerically 0 or 1 occurred
35: glm.fit: algorithm did not converge
36: glm.fit: fitted probabilities numerically 0 or 1 occurred
37: glm.fit: fitted probabilities numerically 0 or 1 occurred
38: glm.fit: algorithm did not converge
39: glm.fit: fitted probabilities numerically 0 or 1 occurred
40: glm.fit: fitted probabilities numerically 0 or 1 occurred
41: glm.fit: fitted probabilities numerically 0 or 1 occurred
42: glm.fit: fitted probabilities numerically 0 or 1 occurred
43: glm.fit: fitted probabilities numerically 0 or 1 occurred
44: glm.fit: fitted probabilities numerically 0 or 1 occurred
45: glm.fit: fitted probabilities numerically 0 or 1 occurred
46: glm.fit: fitted probabilities numerically 0 or 1 occurred
47: glm.fit: fitted probabilities numerically 0 or 1 occurred
48: glm.fit: fitted probabilities numerically 0 or 1 occurred
49: glm.fit: fitted probabilities numerically 0 or 1 occurred
50: glm.fit: fitted probabilities numerically 0 or 1 occurred
Now I am doing a
Code:
boot.ci(results, conf = 0.95, type = "basic")
Besides, why it doesn't give any P values?! (just gives betas and biases ans SEs)