Logistic 响应模型

在 R 中构建响应模型

Kathrin Gruber

Assistant Professor of Econometrics Erasmus University Rotterdam

Logistic 响应函数

  • 将模型预测限制在 0 到 1 之间。
  • 假设为曲线关系。

在 R 中构建响应模型

啤酒需求的 Logistic 模型

logistic.model <- glm(HOPPINESS ~ price.ratio, family = binomial, 
                      data = choice.data)
coef(logistic.model)
(Intercept)  price.ratio 
  -3.572678   -6.738768 
在 R 中构建响应模型

有界预测

plot(HOPPINESS ~ price.ratio, data = choice.data)
curve(predict(logistic.model, data.frame(price.ratio = x), 
              type = "response"), add = TRUE)

在 R 中构建响应模型

平均边际效应

  • 非线性 Logistic 模型:
margins(logistic.model)
price.ratio
    -0.4585
  • 线性概率模型:
coef(probability.model)
(Intercept)  price.ratio 
 0.09700236  -0.29594939 
在 R 中构建响应模型

效应图

x <- seq(-1.25, 1.25, by = 0.25)
cplot(logistic.model, "price.ratio", xvals = x)

在 R 中构建响应模型

开始练习吧!

在 R 中构建响应模型

Preparing Video For Download...