Communicating Regression Results in Meaningful Terms

LSHTM R users group
3/5/2023
Amy Macdougall
 
The aim is to make it easier to communicate results of regressions in
meaningful terms.
Introduction
Using:
Predictions
Comparisons
Slopes 
aka ‘marginal effects’
Introduction
W
h
a
t
 
d
o
e
s
 
m
a
r
g
i
n
a
l
 
m
e
a
n
?
 
Note on terminology: 'marginal'
M
a
r
g
i
n
a
l
 
i
n
 
s
t
a
t
i
s
t
i
c
s
 
 
Marginal mean = mean 
averaged over 
all covariates
vs
Conditional mean = mean 
conditional on 
covariates
Note on terminology: 'marginal'
M
a
r
g
i
n
a
l
 
i
n
 
e
c
o
n
o
m
e
t
r
i
c
s
Marginal effect = the 
slope
Partial derivative of the regression equation with respect to a regressor
of interest
Note on terminology: 'marginal'
Marginal effects != marginal means
Marginal effect = the slope 
     
 
(derivative)
Marginal mean = average 
         
(integral)
Both can be calculated using the 
marginaleffects
 package.
Note on terminology: 'marginal'
 
Today I’ll illustrate 
some
 uses of the package using a data from an
experiment carried out at the Dementia Research Centre.
1.
A model including a non-linear term.
2.
A logistic regression.
In both of these cases the 
regression coefficients 
may not be readily
interpretable
 or the quantity of interest.
Overview
T
h
e
 
c
o
l
o
u
r
 
s
p
a
c
e
s
 
e
x
p
e
r
i
m
e
n
t
Introducing the datset
T
h
e
 
c
o
l
o
u
r
 
s
p
a
c
e
s
 
e
x
p
e
r
i
m
e
n
t
Binary
 outcome: ‘
like
the colour or not
Continuous
 outcome:
change in 
pupil size
from baseline
Introducing the datset
1. Marginal effects for a non-linear term
Continuous outcome and predictor
Hypothesis: as time (‘trial index’) increases, pupil response may
change.
Fit a 
cubic spline 
to ‘trial index’ to measure non-linear effect.
How to interpret the result?
Interpreting a non-linear term - continuous outcome
 
 
 
Interpreting a non-linear term - continuous outcome
plot_predictions()
 
Interpreting a non-linear term - continuous outcome
This could be done be done with predict() + ggplot(), or
other packages.
These predictions are conditional on observed values of all
other covariates.
slopes()
 
 
Interpreting a non-linear term - continuous outcome
 
 
 
Interpreting a non-linear term - continuous outcome
 
Interpreting a non-linear term - continuous outcome
 
Interpreting a non-linear term - continuous outcome
Functions used so far
predictions()
plot_predictions()
Makes it easy to obtain and plot
predictions
slopes()
plot_slopes()
Uses automatic differentiation to
find the ‘marginal effect’ aka slope
and the delta method for standard
errors.
marginaleffects functions
Example 2: interpreting the results of a
logistic regression
Outcome: ‘
like
’ the colour or not
With logistic regression, the
default is to convert scale from
odds
 to 
probability
 
Logistic regression
 
 
 
Interpreting a non-linear term - binary outcome
(i) Continuous predictor
Difference in scale: non-linearity on one scale does not
imply non-linearity on another (interactions too).
These predictions are conditional on observed values of all
other covariates.
Interpreting a non-linear term - binary outcome
(ii) Binary predictor
avg_comparisons() makes it easy
to convert 
odds ratios 
to 
risk
differences
 
1.
Find predicted probabilities for
all individuals under 
both
levels
 of the binary predictor.
2.
Find the 
difference
 between
these probabilities.
3.
Find the 
mean
 of these
differences.
 
Standard error found using the delta method, there is also a
bootstrap option.
 
 
 
Interpreting logistic regression - binary predictor
This is the parametric g-formula
finding the average treatment effect
(a 
marginal
 mean)
C
o
m
p
a
r
e
 
t
h
e
 
e
f
f
e
c
t
 
o
f
 
m
a
t
e
r
i
a
l
 
m
e
d
i
u
m
 
a
n
d
s
p
a
t
i
a
l
 
d
e
p
i
c
t
i
o
n
 
 
Interpreting logistic regression - binary predictor
C
o
m
p
a
r
e
 
t
h
e
 
e
f
f
e
c
t
 
o
f
 
m
a
t
e
r
i
a
l
 
m
e
d
i
u
m
 
a
n
d
s
p
a
t
i
a
l
 
d
e
p
i
c
t
i
o
n
 
 
Interpreting logistic regression - binary predictor
C
o
m
p
a
r
e
 
t
h
e
 
e
f
f
e
c
t
 
o
f
 
m
a
t
e
r
i
a
l
 
m
e
d
i
u
m
 
a
n
d
s
p
a
t
i
a
l
 
d
e
p
i
c
t
i
o
n
 
 
Interpreting logistic regression - binary predictor
Think about assumptions!
 
 
Interpreting logistic regression - binary predictor
Functions used
predictions()
plot_predictions()
Makes it easy to obtain and plot
predictions.
slopes()
plot_slopes()
Uses automatic differentiation to find
the ‘marginal effect’ aka slope.
comparisons()
avg_comparisons()
Compares predicted values at individual
and marginal level.
T
h
e
 
p
a
c
k
a
g
e
 
i
s
 
e
x
t
r
e
m
e
l
y
 
w
e
l
l
 
d
o
c
u
m
e
n
t
e
d
Marginal effects website
Solomon Kurt blog ‘
causal
inference with logistic regression
 
End
 
 
Slide Note
Embed
Share

The aim is to facilitate the communication of regression results in an understandable manner, focusing on marginal effects and means. Explore the differences between marginal mean and conditional mean in statistics and econometrics. Learn how to calculate and interpret marginal effects in statistical analysis. Illustrate practical uses of these concepts in data analysis from an experiment conducted at the Dementia Research Centre.

  • Regression
  • Marginal Effects
  • Statistics
  • Econometrics
  • Data Analysis

Uploaded on Feb 18, 2025 | 0 Views


Download Presentation

Please find below an Image/Link to download the presentation.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.

You are allowed to download the files provided on this website for personal or commercial use, subject to the condition that they are used lawfully. All files are the property of their respective owners.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.

E N D

Presentation Transcript


  1. LSHTM R users group 3/5/2023 Amy Macdougall

  2. The aim is to make it easier to communicate results of regressions in meaningful terms. Introduction

  3. Using: Predictions Comparisons Slopes aka marginal effects Introduction

  4. What does marginal marginal mean? Note on terminology: 'marginal'

  5. Marginal Marginal in statistics Marginal mean = mean averaged over all covariates vs Conditional mean = mean conditional on covariates Note on terminology: 'marginal'

  6. Marginal Marginal in econometrics Marginal effect = the slope Partial derivative of the regression equation with respect to a regressor of interest Note on terminology: 'marginal'

  7. Marginal effects != marginal means Marginal effect = the slope Marginal mean = average (derivative) (integral) Both can be calculated using the marginaleffects package. Note on terminology: 'marginal'

  8. Today Ill illustrate some uses of the package using a data from an experiment carried out at the Dementia Research Centre. 1. A model including a non-linear term. 2. A logistic regression. In both of these cases the regression coefficients may not be readily interpretable or the quantity of interest. Overview

  9. The colour spaces colour spaces experiment Introducing the datset

  10. The colour spaces colour spaces experiment Continuous outcome: change in pupil size from baseline Binaryoutcome: like the colour or not Introducing the datset

  11. 1. Marginal effects for a non-linear term Continuous outcome and predictor Hypothesis: as time ( trial index ) increases, pupil response may change. Fit a cubic spline to trial index to measure non-linear effect. How to interpret the result? Interpreting a non-linear term - continuous outcome

  12. Interpreting a non-linear term - continuous outcome

  13. plot_predictions() This could be done be done with predict() + ggplot(), or other packages. These predictions are conditional on observed values of all other covariates. Interpreting a non-linear term - continuous outcome

  14. slopes() Interpreting a non-linear term - continuous outcome

  15. Interpreting a non-linear term - continuous outcome

  16. Interpreting a non-linear term - continuous outcome

  17. Interpreting a non-linear term - continuous outcome

  18. Functions used so far predictions() slopes() plot_predictions() plot_slopes() Makes it easy to obtain and plot predictions Uses automatic differentiation to find the marginal effect aka slope and the delta method for standard errors. marginaleffects functions

  19. Example 2: interpreting the results of a logistic regression Outcome: like the colour or not With logistic regression, the default is to convert scale from odds to probability Logistic regression

  20. Interpreting a non-linear term - binary outcome

  21. (i) Continuous predictor Difference in scale: non-linearity on one scale does not imply non-linearity on another (interactions too). These predictions are conditional on observed values of all other covariates. Interpreting a non-linear term - binary outcome

  22. (ii) Binary predictor avg_comparisons() makes it easy to convert odds ratios to risk differences 1. Find predicted probabilities for all individuals under both levels of the binary predictor. 2. Find the difference between these probabilities. 3. Find the mean of these differences. This is the parametric g-formula finding the average treatment effect (a marginal mean) Standard error found using the delta method, there is also a bootstrap option. Interpreting logistic regression - binary predictor

  23. Compare the effect of material medium spatial depiction spatial depiction material medium and Interpreting logistic regression - binary predictor

  24. Compare the effect of material medium spatial depiction spatial depiction material medium and Interpreting logistic regression - binary predictor

  25. Compare the effect of material medium spatial depiction spatial depiction material medium and Interpreting logistic regression - binary predictor

  26. Think about assumptions! Interpreting logistic regression - binary predictor

  27. slopes() Functions used plot_slopes() predictions() Uses automatic differentiation to find the marginal effect aka slope. plot_predictions() comparisons() Makes it easy to obtain and plot predictions. avg_comparisons() Compares predicted values at individual and marginal level.

  28. The package is extremely extremely well documented Marginal effects website Solomon Kurt blog causal inference with logistic regression

  29. End

More Related Content

giItT1WQy@!-/#giItT1WQy@!-/#giItT1WQy@!-/#giItT1WQy@!-/#giItT1WQy@!-/#giItT1WQy@!-/#giItT1WQy@!-/#giItT1WQy@!-/#