Skip to main content
corrected code
Source Link
Scortchi
  • 31.6k
  • 9
  • 102
  • 281

When the logit of the probability $\pi$ of the response's being 1 is linear in the $i$th predictor $x_i$, you can write the model like this

$$\log \frac{\pi}{1-\pi} = \beta_i x_i + \beta_0 +\sum_{j\neq i} \beta_j x_j$$

where the $\beta$s are the coefficients, & the $x_j$s the other predictors. The inflection point $x_i^*$ is where

$$\left.\frac{\partial^2 \pi}{(\partial x_i)^2}\right|_{x_i=x_i^*}=0$$

When you work that out it gives

$$x_i^*=\frac{-(\beta_0 +\sum_{j\neq i} \beta_j x_j)}{\beta_i}$$

& the corresponding probability, $\pi_i^*$, doesn't depend on the coefficients or other predictor values:

$$\pi_i^*=\frac{1}{2}$$

To extract coefficient estimates in R use coefficients(my.model). A convenient way to plot the curve is to make a data frame my.curve with $x_i$ varying over a range of interest & the $x_j$s constant (this is the line of code you queried) & then use predict(mymodel, newdata=my.curve, type="response") to obtain the predicted probabilities.

When the logit of the probability $\pi$ of the response's being 1 is linear in the $i$th predictor $x_i$, you can write the model like this

$$\log \frac{\pi}{1-\pi} = \beta_i x_i + \beta_0 +\sum_{j\neq i} \beta_j x_j$$

where the $\beta$s are the coefficients, & the $x_j$s the other predictors. The inflection point $x_i^*$ is where

$$\left.\frac{\partial^2 \pi}{(\partial x_i)^2}\right|_{x_i=x_i^*}=0$$

When you work that out it gives

$$x_i^*=\frac{-(\beta_0 +\sum_{j\neq i} \beta_j x_j)}{\beta_i}$$

& the corresponding probability, $\pi_i^*$, doesn't depend on the coefficients or other predictor values:

$$\pi_i^*=\frac{1}{2}$$

To extract coefficient estimates in R use coefficients(my.model). A convenient way to plot the curve is to make a data frame my.curve with $x_i$ varying over a range of interest & the $x_j$s constant (this is the line of code you queried) & then use predict(mymodel, newdata=my.curve) to obtain the predicted probabilities.

When the logit of the probability $\pi$ of the response's being 1 is linear in the $i$th predictor $x_i$, you can write the model like this

$$\log \frac{\pi}{1-\pi} = \beta_i x_i + \beta_0 +\sum_{j\neq i} \beta_j x_j$$

where the $\beta$s are the coefficients, & the $x_j$s the other predictors. The inflection point $x_i^*$ is where

$$\left.\frac{\partial^2 \pi}{(\partial x_i)^2}\right|_{x_i=x_i^*}=0$$

When you work that out it gives

$$x_i^*=\frac{-(\beta_0 +\sum_{j\neq i} \beta_j x_j)}{\beta_i}$$

& the corresponding probability, $\pi_i^*$, doesn't depend on the coefficients or other predictor values:

$$\pi_i^*=\frac{1}{2}$$

To extract coefficient estimates in R use coefficients(my.model). A convenient way to plot the curve is to make a data frame my.curve with $x_i$ varying over a range of interest & the $x_j$s constant (this is the line of code you queried) & then use predict(mymodel, newdata=my.curve, type="response") to obtain the predicted probabilities.

Source Link
Scortchi
  • 31.6k
  • 9
  • 102
  • 281

When the logit of the probability $\pi$ of the response's being 1 is linear in the $i$th predictor $x_i$, you can write the model like this

$$\log \frac{\pi}{1-\pi} = \beta_i x_i + \beta_0 +\sum_{j\neq i} \beta_j x_j$$

where the $\beta$s are the coefficients, & the $x_j$s the other predictors. The inflection point $x_i^*$ is where

$$\left.\frac{\partial^2 \pi}{(\partial x_i)^2}\right|_{x_i=x_i^*}=0$$

When you work that out it gives

$$x_i^*=\frac{-(\beta_0 +\sum_{j\neq i} \beta_j x_j)}{\beta_i}$$

& the corresponding probability, $\pi_i^*$, doesn't depend on the coefficients or other predictor values:

$$\pi_i^*=\frac{1}{2}$$

To extract coefficient estimates in R use coefficients(my.model). A convenient way to plot the curve is to make a data frame my.curve with $x_i$ varying over a range of interest & the $x_j$s constant (this is the line of code you queried) & then use predict(mymodel, newdata=my.curve) to obtain the predicted probabilities.