set.seed(1)
x = runif(1000, -2, 2)
link = x*2+3+rnorm(1000)
p = 1/(1+exp(-link))
y = sapply(p, function(.x) rbinom(1, 1, .x))
fit = glm(y~x, family=binomial)
> coef(fit)
(Intercept) x
2.661760 1.821602
> predict(fit)[1:10] ## log-odds
1 2 3 4 5 6 7
0.9531603 1.7300025 3.1925992 5.6361285 0.4880927 5.5645897 5.9018454
8 9 10
3.8333982 3.6025375 -0.5312442
> predict(fit, type="response")[1:10] ## probabilidade
1 2 3 4 5 6 7 8
0.7217503 0.8494127 0.9605548 0.9964460 0.6196570 0.9961835 0.9972731 0.9788222
9 10
0.9734686 0.3702268
> plot(link, predict(fit))
> abline(a=0, b=1, col=2)