blog/binary-logistic-regression-in-r/ #111
Replies: 16 comments 22 replies
-
|
Pure gold - thank you Antoine! |
Beta Was this translation helpful? Give feedback.
-
|
Superb Antoine...much needed post for many researchers.
Thanks always. |
Beta Was this translation helpful? Give feedback.
-
|
This is the kind of helpful post that I always wish I had while attempting some past project. Thank you! Quick mistake: "This means that, the odds of developing a heart disease are (3.574 - 1) × 100 = 257.4% higher for males than for females." (odds should be replaced with probability) On that note, using risk instead of odds is easier for non-gamblers to interpret and also easier to communicate findings. Do you have any suggestions on straightforward ways to convert ORs from models to RRs? For example I would love to use tbl_regression() displaying RRs instead of ORs. Is there a way to do that? |
Beta Was this translation helpful? Give feedback.
-
|
I'm a PhD student currently analyzing my data, and your post is incredibly valuable. I appreciate the effort you put into explaining concepts, which has been particularly helpful for someone like me who is new to data analysis. Could you please provide an explanation for multinomial logistic regression? I need to apply it to my data. Thanks in advance! |
Beta Was this translation helpful? Give feedback.
-
|
God bless you for this fantastic piece, Antoine. |
Beta Was this translation helpful? Give feedback.
-
|
This article is incredibly useful (and so is its sibling on linear regression). Thank you so much for taking the time to put it together. |
Beta Was this translation helpful? Give feedback.
-
|
I don't think the normal distribution of the dependent variable is a prerequisite for the linear model |
Beta Was this translation helpful? Give feedback.
-
|
This post was extremely helpful for a graduate class project, especially for someone relatively new to R and regressions. Thank you for the detailed explanations! |
Beta Was this translation helpful? Give feedback.
-
|
Dear Antoine, thank you very much for the best article on binary logistic regression in R I have been able to find! I would like to ask two questions - I apologise in advance if the answer should be obvious:
Thank you so much for the brilliant article :) |
Beta Was this translation helpful? Give feedback.
-
|
Dear Antoine,
I do have a request. If you can do a blog on model calibration and
validation after the model output - it will be helpful.
Regards
Venkat
…On Thu, May 22, 2025 at 11:59 PM Urtidi ***@***.***> wrote:
Dear Antoine, thank you very much for the best article on binary logistic
regression in R I have been able to find!
I would like to ask two questions - I apologise in advance if the answer
should be obvious:
1.
For multivariable binary logistic regression, how can you find out the
overall significance of your model?
2.
For multivariable binary logistic regression, is it a problem if (some
of) the independent variables are known to logically impact each other - or
would that not be an issue, as long as the VIF (variance inflation factor)
stays below 5 or 10?
Thank you so much for the brilliant article :)
—
Reply to this email directly, view it on GitHub
<#111 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AQO6R25XI4QFSNHLJSGKLBL27YJRDAVCNFSM6AAAAAB2UQKC5KVHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTGMRTHAYDEMA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***
com>
--
Dr.S.Venkataseshan
Professor
Division of Neonatology
Department of Pediatrics
PGIMER, Chandigarh
India-160012
phone: +91-172-4735794 (Residence)
+91-172-2755340 (Office)
+91-9478001129 (Personal Mobile)
+91-7087008487 (Official Mobile)
Mail: ***@***.***
|
Beta Was this translation helpful? Give feedback.
-
|
This is great, thank you so much!
|
Beta Was this translation helpful? Give feedback.
-
|
Hi Antoine,
I exactly followed the steps you have shown.
When I try to execute the val.prob function, I get the following error
message and a warning message.
Error in attributes(.Data) <- c(attributes(.Data), attrib) :
'names' attribute [2] must be the same length as the vector [1]
In addition: Warning message:
In Ops.factor(p, y) : ‘+’ not meaningful for factors
|
Beta Was this translation helpful? Give feedback.
-
|
Interesting discussion.
In this relation, I have another query and we all face the problem. Feature
selection - selection of variables to be entered in a model. Recently, in
one of my analysis, I used the LASSO method for penalised regression for
variable selection. But I later read in a article/blog by Frank Harell that
LASSO is not apt for variable selection due to high noise. Many papers
recommend against using stepwise selection methods.
|
Beta Was this translation helpful? Give feedback.
-
|
Hi again, I am from minutes ago from your other post. From this code you made: # recode sex
dat$sex <- factor(dat$sex,
levels = c(FALSE, TRUE),
labels = c("female", "male")
)
# recode chest_pain
dat$chest_pain <- factor(dat$chest_pain,
levels = 1:4,
labels = c("typical angina", "atypical angina", "non-anginal pain", "asymptomatic")
)Just a suggestion: Since you loaded the entire dat |>
mutate(
sex = factor(
sex,
levels = c(FALSE, TRUE),
labels = c("female", "male")
),
chest_pain = factor(
dat,
levels = 1:4,
labels = c("typical angina", "atypical angina", "non-anginal pain", "asymptomatic")
)
)This is way more readable and less boilerplate (Shameless promotion: I literally have a live course tutorial about R's metaprogramming, which is the core of |
Beta Was this translation helpful? Give feedback.
-
|
A well-thought-out and comprehensive treatment of logistic regression in R. I was impressed by the use of gt() and gtsummary(). Particularly valuable is the illustration of alternative methods for communicating the results of logistic regression in an accessible manner. I would love to see a follow-up in terms of multinomial logistic regression. |
Beta Was this translation helpful? Give feedback.
-
|
If you ever consider writing a book on logistic and multinomial regression, I will buy it. Your approach is quite pedagogical.
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
blog/binary-logistic-regression-in-r/
Learn when and how to use a (univariate and multivariate) binary logistic regression in R. Learn also how to interpret, visualize and report results
https://statsandr.com/blog/binary-logistic-regression-in-r/
Beta Was this translation helpful? Give feedback.
All reactions