เริ่มต้นใช้งานเริ่มต้นใช้งานได้ฟรี

Average marginal effects

The logistic response function is essentially nonlinear. Therefore, it is not immediately clear what is the effect of a unit change in the price ratio on the probability that a customer purchases Hoppiness. A solution is to interpret the effect of a unit change averaged over all customers.

This average marginal effect can be derived by using the function margins(). The function is loaded from the add-on package margins. Finally, you will compare the average marginal effect for price.ratio of the logistic.model to the price.ratio coefficient of the probability.model.

แบบฝึกหัดนี้เป็นส่วนหนึ่งของหลักสูตร

Building Response Models in R

ดูคอร์ส

คำแนะนำการฝึกหัด

  • Load the add-on package margins by using the function library().
  • Obtain the price.ratio coefficient for the probability.model by using the function coef().
  • Obtain the marginal effect for price.ratio of the logistic.model by using the function margins().

แบบฝึกหัดเชิงโต้ตอบแบบลงมือทำ

ลองทำแบบฝึกหัดนี้โดยเติมโค้ดตัวอย่างนี้ให้สมบูรณ์

# Load the margins package


# Linear probability model


# Logistic model
แก้ไขและรันโค้ด