OP写道:
我该如何纠正?我想如果它没有通过正确的点,那么所有的概率都应该被略微低估。
这不是真的。完全有可能低估某些值(如截距)并高估其他值。
根据您的情况举例:
真实概率:
set.seed(444)
true_prob <- function(x) {
# logit probabilities
lp <- (x - 0.5)
# true probabilities
p <- 1 / (1 + exp(-lp))
p
}
true_prob(x = 0.5)
[1] 0.5
但是,如果您模拟数据并拟合模型,截距可能会被低估,而其他值可能会被高估:
n <- 100
# simulated predictor
x <- runif(n, 0, 1)
probs <- true_prob(x)
# simulated binary response
y <- as.numeric(runif(n) < probs)
现在拟合一个模型并比较真实概率与拟合概率:
> true_prob(0.5)
[1] 0.5
> predict(m, newdata = data.frame(x = 0.5), type = "response")
1
0.479328
> true_prob(2)
[1] 0.8175745
> predict(m, newdata = data.frame(x = 2), type = "response")
1
0.8665702
所以在这个例子中,模型在 x = 0.5 时低估,在 x = 2 时高估