coding-for-reproducible-research / coding-for-reproducible-research/cfrrRtutorials

Logistic regression dummy variables

Open
#17 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
HTML
Stars
3
Forks
3
PR merge metrics
No merged PRs in 30d

Description

## Problem

In the last delivery of the course, some participants were confused by the logistic regression section as new variables were introduced to the mathematics without much explanation.

The logistic regression is introduced as:

$$\sigma(t) = \frac{e^t}{e^t+1}$$

But then in a single line, this is converted to:

$$ln(odds) = ln\big(\frac{p}{(1-p)}\big) = \beta_0 + \beta_1x$$

## Suggested edit

A simple explanation that we are looking at the odds ratio (probability of case / probability of not a case) would explain where the $\frac{p}{(1-p)}$ part comes from (though this is in my opinion rather obvious).

From here, the fact that ㅤ $ln(\frac{p}{(1-p)}) = \beta_0 + \beta_1x$ ㅤ might benefit from a small footnote explaining why this step works. The mathematics isn't required, but some might want to know where this actually comes from. As such a footnote/smalltext is probably better than adding this into the main text.

This step works because you are using the logistic equation as your probability function ($\sigma = p$). Substituting $p = \frac{e^t}{e^t+1}$ into the odds ratio equation gets you:

$$ln\Bigg(\frac{\frac{e^t}{e^t+1}}{1-\frac{e^t}{e^t+1}}\Bigg)=ln\big(\frac{e^t}{e^t+1-e^t}\big)=ln(e^t)=t$$

You would then need to explain that $t = \beta_0 + \beta_1x$ as this is just a dummy variable. I'm not 100% sure how to convey this idea in a way that would be comfortable to all audiences however.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.