Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
:::{#exm-uniform-not-exponential-family}
#### The uniform distribution on $[0, \highend]$ is not an exponential family
#### The uniform distribution on ${[0, \highend]}$ is not an exponential family

<!-- no-figure: the example compares two density values at one point -->

Expand Down
6 changes: 3 additions & 3 deletions _subfiles/logistic-inference/_cor-logistic-odds-ratio.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,18 @@ $$

::: proof

Let $\diff \vpredvar \eqdef \vpredvar' - \vpredvar$, so that $\vpredvar' = \vpredvar + \diff \vpredvar$, and the first entry of $\diff \vpredvar$ is $1 - 1 = 0$.
Let $\diffvpredvar \eqdef \vpredvar' - \vpredvar$, so that $\vpredvar' = \vpredvar + \diffvpredvar$, and the first entry of $\diffvpredvar$ is $1 - 1 = 0$.

$$
\ba
\orf{\vpredvar', \vpredvar}
&= \frac{\oddsf{\vpredvar'}}{\oddsf{\vpredvar}}
&& \text{(definition of the odds ratio)}
\\
&= \frac{\oddsf{\vpredvar} \, \oddsfactorf{\diff \vpredvar}}{\oddsf{\vpredvar}}
&= \frac{\oddsf{\vpredvar} \, \oddsfactorf{\diffvpredvar}}{\oddsf{\vpredvar}}
&& \text{(odds multiplier theorem)}
\\
&= \oddsfactorf{\diff \vpredvar}.
&= \oddsfactorf{\diffvpredvar}.
&& \text{(divide numerator and denominator by } \oddsf{\vpredvar} > 0 \text{)}
\ea
$$
Expand Down
6 changes: 3 additions & 3 deletions _subfiles/logistic-inference/_def-odds-multiplier.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
Let:

- $\vcoef$ be the coefficient vector of a [logistic regression model](#def-logistic-regression).
- $\diff \vpredvar$ be a change in the [predictor](https://morrison-lab.github.io/pds/expectation.html#def-input) vector, whose first entry is $0$, because every predictor vector has first entry $1$.
- $\diffvpredvar$ be a change in the [predictor](https://morrison-lab.github.io/pds/expectation.html#def-input) vector, whose first entry is $0$, because every predictor vector has first entry $1$.

The **odds multiplier** of $\diff \vpredvar$ is the [exponential](https://morrison-lab.github.io/mds/algebra-exponentials.html#def-exponential-function) of the [dot product](https://morrison-lab.github.io/mds/linear-algebra-vectors.html#def-dot-product) of $\vcoef$ with $\diff \vpredvar$:
The **odds multiplier** of $\diffvpredvar$ is the [exponential](https://morrison-lab.github.io/mds/algebra-exponentials.html#def-exponential-function) of the [dot product](https://morrison-lab.github.io/mds/linear-algebra-vectors.html#def-dot-product) of $\vcoef$ with $\diffvpredvar$:

$$
\oddsfactorf{\diff \vpredvar} \eqdef \e{\dprod{\vcoef}{\diff \vpredvar}}.
\oddsfactorf{\diffvpredvar} \eqdef \e{\dprod{\vcoef}{\diffvpredvar}}.
$$

:::
2 changes: 1 addition & 1 deletion _subfiles/logistic-inference/_exm-not-odds-multiplier.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

In the [six-patient trial](#exm-logistic-regression), the [probability](https://morrison-lab.github.io/pds/probability-basics.html#def-probability) of recovery under the [maximum likelihood fit](intro-MLEs.qmd#def-mle) is $2/3$ in the treatment group and $1/3$ in the control group. <!-- check-term-links: allow: "control" here is a trial arm, not a case-control control -->
The code computes the [risk ratio](categorical-tests.qmd#def-risk-ratio) of treatment against control, <!-- check-term-links: allow: "control" here is a trial arm, not a case-control control -->
and shows beside it the [odds multiplier](#def-odds-multiplier) of the change $\diff \vpredvar = \tp{\paren{0, 2}}$ from @exm-odds-multiplier.
and shows beside it the [odds multiplier](#def-odds-multiplier) of the change $\diffvpredvar = \tp{\paren{0, 2}}$ from @exm-odds-multiplier.

```{r}
#| code-fold: false
Expand Down
2 changes: 1 addition & 1 deletion _subfiles/logistic-inference/_exm-odds-multiplier.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#### The odds multiplier of moving from control to treatment
<!-- no-figure: the example computes a single number -->

In the [six-patient trial](#exm-logistic-regression), moving a patient from the control group ($\predvar = -1$) to the treatment group ($\predvar = +1$) changes the predictor vector by $\diff \vpredvar = \tp{\paren{0, 2}}$. <!-- check-term-links: allow: "control" here is a trial arm, not a case-control control -->
In the [six-patient trial](#exm-logistic-regression), moving a patient from the control group ($\predvar = -1$) to the treatment group ($\predvar = +1$) changes the predictor vector by $\diffvpredvar = \tp{\paren{0, 2}}$. <!-- check-term-links: allow: "control" here is a trial arm, not a case-control control -->
The code computes the [odds multiplier](#def-odds-multiplier) of that change under the [maximum likelihood fit](intro-MLEs.qmd#def-mle).

```{r}
Expand Down
4 changes: 2 additions & 2 deletions _subfiles/logistic-inference/_exm-thm-odds-multiplier.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
#### The treated odds from the control odds
<!-- no-figure: the example checks one product of two numbers -->

In the [six-patient trial](#exm-logistic-regression), take $\vpredvar = \tp{\paren{1, -1}}$, a control patient, and $\diff \vpredvar = \tp{\paren{0, 2}}$, so that $\vpredvar' = \tp{\paren{1, 1}}$ is a treated patient. <!-- check-term-links: allow: "control" here is a trial arm, not a case-control control -->
In the [six-patient trial](#exm-logistic-regression), take $\vpredvar = \tp{\paren{1, -1}}$, a control patient, and $\diffvpredvar = \tp{\paren{0, 2}}$, so that $\vpredvar' = \tp{\paren{1, 1}}$ is a treated patient. <!-- check-term-links: allow: "control" here is a trial arm, not a case-control control -->
Under the [maximum likelihood fit](intro-MLEs.qmd#def-mle), the code computes the [odds](https://morrison-lab.github.io/pds/probability-basics.html#def-odds) of recovery at both [predictor](https://morrison-lab.github.io/pds/expectation.html#def-input) vectors,
and the control odds times the [odds multiplier](#def-odds-multiplier) of $\diff \vpredvar$. <!-- check-term-links: allow: "control" here is a trial arm, not a case-control control -->
and the control odds times the [odds multiplier](#def-odds-multiplier) of $\diffvpredvar$. <!-- check-term-links: allow: "control" here is a trial arm, not a case-control control -->

```{r}
#| code-fold: false
Expand Down
18 changes: 9 additions & 9 deletions _subfiles/logistic-inference/_thm-odds-multiplier.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
Let:

- $\vpredvar$ be a [predictor](https://morrison-lab.github.io/pds/expectation.html#def-input) vector in the [logistic regression model](#def-logistic-regression) of @eq-logistic-model.
- $\diff \vpredvar$ be a change in the predictor vector, with first entry $0$.
- $\vpredvar' \eqdef \vpredvar + \diff \vpredvar$.
- $\diffvpredvar$ be a change in the predictor vector, with first entry $0$.
- $\vpredvar' \eqdef \vpredvar + \diffvpredvar$.

Then the [odds](https://morrison-lab.github.io/pds/probability-basics.html#def-odds) of $\Outvar = 1$ at $\vpredvar'$ are the odds at $\vpredvar$ times the [odds multiplier](#def-odds-multiplier) of $\diff \vpredvar$:
Then the [odds](https://morrison-lab.github.io/pds/probability-basics.html#def-odds) of $\Outvar = 1$ at $\vpredvar'$ are the odds at $\vpredvar$ times the [odds multiplier](#def-odds-multiplier) of $\diffvpredvar$:

$$
\oddsf{\vpredvar'} = \oddsf{\vpredvar} \, \oddsfactorf{\diff \vpredvar}.
\oddsf{\vpredvar'} = \oddsf{\vpredvar} \, \oddsfactorf{\diffvpredvar}.
$$

:::
Expand All @@ -27,19 +27,19 @@ $$
&= \e{\dprod{\vcoef}{\vpredvar'}}
&& \text{(log-odds of the model at } \vpredvar' \text{)}
\\
&= \e{\dprod{\vcoef}{\paren{\vpredvar + \diff \vpredvar}}}
&= \e{\dprod{\vcoef}{\paren{\vpredvar + \diffvpredvar}}}
&& \text{(definition of } \vpredvar' \text{)}
\\
&= \e{\dprod{\vcoef}{\vpredvar} + \dprod{\vcoef}{\diff \vpredvar}}
&= \e{\dprod{\vcoef}{\vpredvar} + \dprod{\vcoef}{\diffvpredvar}}
&& \text{(the dot product is linear in each slot)}
\\
&= \e{\dprod{\vcoef}{\vpredvar}} \, \e{\dprod{\vcoef}{\diff \vpredvar}}
&= \e{\dprod{\vcoef}{\vpredvar}} \, \e{\dprod{\vcoef}{\diffvpredvar}}
&& \text{(} \e{a + b} = \e{a} \e{b} \text{)}
\\
&= \oddsf{\vpredvar} \, \e{\dprod{\vcoef}{\diff \vpredvar}}
&= \oddsf{\vpredvar} \, \e{\dprod{\vcoef}{\diffvpredvar}}
&& \text{(log-odds of the model at } \vpredvar \text{)}
\\
&= \oddsf{\vpredvar} \, \oddsfactorf{\diff \vpredvar}.
&= \oddsf{\vpredvar} \, \oddsfactorf{\diffvpredvar}.
&& \text{(definition of the odds multiplier)}
\ea
$$
Expand Down
2 changes: 1 addition & 1 deletion latex-macros
Loading