Menu
I am having trouble interpreting the results of a logistic regression. My outcome variable is Decision and is binary (0 or 1, not take or take a product, respectively).My predictor variable is Thoughts and is continuous, can be positive or negative, and is rounded up to the 2nd decimal point.I want to know how the probability of taking the product changes as Thoughts changes.The logistic regression equation is: glm(Decision Thoughts, family = binomial, data = data)According to this model, Thoughts has a significant impact on probability of Decision (b =.72, p =.02).
![Logistic regression in r from scratch Logistic regression in r from scratch](http://www.sthda.com/english/sthda-upload/figures/machine-learning-essentials/030-logistic-regression-assumptions-and-diagnostics-linearity-assumptions-1.png)
The coefficient returned by a logistic regression in r is a logit, or the log of the odds. To convert logits to odds ratio, you can exponentiate it, as you've done above. To convert logits to probabilities, you can use the function exp(logit)/(1+exp(logit)). However, there are some things to note about this procedure.First, I'll use some reproducible data to illustrate library('MASS')data('menarche')m z )(Intercept) -21.22639 0.77068 -27.54. Odds and probability are two different measures, both addressing the same aim of measuring the likeliness of an event to occur. They should not be compared to each other, only among themselves!While odds of two predictor values (while holding others constant) are compared using 'odds ratio' (odds1 / odds2), the same procedure for probability is called 'risk ratio' (probability1 / probability2).In general, odds are preferred against probability when it comes to ratios since probability is limited between 0 and 1 while odds are defined from -inf to +inf.To easily calculate odds ratios including their confident intervals, see the oddsratio package: library(oddsratio)fitglm.
![Logistic regression in r to make predictions Logistic regression in r to make predictions](/uploads/1/2/4/1/124110119/148554273.png)
Example in R. Things to keep in mind, 1- A linear regression method tries to minimize the residuals, that means to minimize the value of ((mx + c) — y)². Whereas a logistic regression model tries to predict the outcome with best possible accuracy after considering all the variables at hand.