0% found this document useful (0 votes)
121 views49 pages

8 Fixed Effects Regression (Powerpoint)

The document discusses individual fixed effects regression, including the idea of using fixed effects to account for time-invariant confounding, examples of how fixed effects models are specified and interpreted, and issues like ensuring the data is properly formatted, including control variables to account for maturation and period effects, and how time-constant variables are handled. Special thanks are given to Josef Brüderl for materials on which parts of the presentation were based.

Uploaded by

Muhsin
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
121 views49 pages

8 Fixed Effects Regression (Powerpoint)

The document discusses individual fixed effects regression, including the idea of using fixed effects to account for time-invariant confounding, examples of how fixed effects models are specified and interpreted, and issues like ensuring the data is properly formatted, including control variables to account for maturation and period effects, and how time-constant variables are handled. Special thanks are given to Josef Brüderl for materials on which parts of the presentation were based.

Uploaded by

Muhsin
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 49

8 Individual Fixed Effects Regression

Jonathan Wörn
Presentation, data and programs at:
https://bit.ly/3ItnOGj

22.03.2022 J.W. 1
Today’s menu: Fixed effects

• Idea & Examples


• Model & Assumptions
• Syntax, Interpretation, Sample Selection
• Getting the data in shape
• A real world example: Marriage & Happiness
• Concluding remarks

Special thanks to Josef Brüderl at Ludwig-Maximilians-University München.


Parts of this presentation are based on his excellent lecture materials:
https://www.ls3.soziologie.uni-muenchen.de/downloads/downloads_lehre/teaching_materials/panelanalysis-bruederl.pdf

22.03.2022 J.W. 2
Idea & Examples

22.03.2022 J.W. 3
Fixed Effects
• A method to get closer to causal estimates with non-
experimental, observational data
• Is change in X associated with change in Y?
• Repeated measures / panel data
• Rules out confounding from time-invariant factors
– Neither observed and unobserved factors

22.03.2022 J.W. 4
Examples

22.03.2022 J.W. 5
Examples

22.03.2022 J.W. 6
Examples

22.03.2022 J.W. 7
Idea
Social participation and depressive symptoms
7

6
Depressive Symptoms

See Brüderl (2015)


0
Year 1 Year 2 Year 3 Year 4 Year 5 Year 6

not treated treated


22.03.2022 J.W. 8
Idea
Social participation and depressive symptoms
7

6
Depressive Symptoms

4 Cross-sectional
regression
3

See Brüderl (2015)


0
Year 1 Year 2 Year 3 Year 4 Year 5 Year 6

not treated treated


22.03.2022 J.W. 9
Idea
Social participation and depressive symptoms
7

6
Depressive Symptoms

4 Fixed effects regression

See Brüderl (2015)


0
Year 1 Year 2 Year 3 Year 4 Year 5 Year 6

not treated treated


22.03.2022 J.W. 10
Why not pooled OLS?
Social participation and depressive symptoms
7

6
Depressive Symptoms

See Brüderl (2015)


0
Year 1 Year 2 Year 3 Year 4 Year 5 Year 6

not treated treated


22.03.2022 J.W. 11
Model & Assumptions

22.03.2022 J.W. 12
Model
• Pooled linear regression for panel data

• Biased estimates if

• Step 1: Splitting error into person-specific and time-


specific components…

• … resulting in error components model

22.03.2022 J.W. 13
Model
• … resulting in error components model

• Step 2: Between transformation (person-specific means over time t)

• Step 3: Within transformation = Fixed effect estimate


(error component model – between transformation)

• drops out – no confounding from time constant


factors, even if
22.03.2022 J.W. 14
Assumptions and Requirements
• Standard assumptions (linear regression)
• Loosend exogeneity assumption:
– No correlation of regressors with time-varying confounders:
– Correlation of regressors with time-constant confounders is
no problem: Consistent estimates even if
• Likely violated: Absence of autocorrelation
– Use cluster robust standard errors
(Huber-White sandwich estimator)
– Also helps with heteroskedasticity
• No maturation or period effects
– Add control group. Necessary assumption: parallel trends
• Required: Temporal variation in predictor (and outcome)

22.03.2022 J.W. 15
Syntax, Interpretation,
Sample Selection

22.03.2022 J.W. 16
Syntax

• xtreg depvar indepvars, fe vce(cluster id)


– xtreg, fe: FE-model
– vce(cluster id): robust standard errors
– Command requires prior xtset. See „Getting the
data in shape“

22.03.2022 J.W. 17
Interpretation

Observations
Persons

Correlation
regressors and
time constant,
person-specific
error

Stata adds back


a constant

See Hamilton (2005)


sigma_u: standard deviation of the time constant, person-specific error (𝑠𝑖𝑔𝑚𝑎 𝑢)2
sigma_e: standard deviation of the time- and person-specific error 𝑟h𝑜=
(𝑠𝑖𝑔𝑚𝑎 𝑢 )2+(𝑠𝑖𝑔𝑚𝑎 𝑒 )2
rho: fraction of unexplained variance due to differences between units/persons
(intraclass correlation coefficient)
22.03.2022 J.W. 18
Interpretation
• Descriptive interpretation
– After participating in social activities, respondents‘
depressive symptoms are .92 units lower than before
participating in social activities
– Always correct
• Causal interpretation
– Participating in social activities reduces respondents‘
depressive symptoms by .92 units
– Correct if exogeneity assumption holds

See Brüderl (2015)


22.03.2022 J.W. 19
Effect-estimate: only treated units
• Only persons being treated contribute to effect-estimate
– M1: FE with 2 treated persons, 2 non-treated persons
– M2: FE with 2 treated persons
– M3: pooled OLS with 2 treated and 2 non-treated persons

22.03.2022 J.W. 20
Maturation and period effects
Social participation and depressive symptoms
7

6
Depressive Symptoms

0
Year 1 Year 2 Year 3 Year 4 Year 5 Year 6

not treated treated


22.03.2022 J.W. 21
Maturation and period effects
• Coefficients will be biased by
– Time trends
– Age effects
– Period effects
• Wrongly attribute temporal effect to treatment
• Always include time and control group in the model!
– Control group: „at risk“ but not treated
– Assumption: Parallel trends in treatment and control
– If different trends: biased estimates

22.03.2022 J.W. 22
Maturation and period effects

Accounting for time: smaller coefficient for treatment

M1: xtreg depr social, fe vce(cluster id)


M2: xtreg depr social wave, fe vce(cluster id)
M3: xtreg depr social i.wave, fe vce(cluster id)

22.03.2022 J.W. 23
Time constant variables
• Main effects of time-constant variables cannot be
estimated by FE-model
– Not necessary, as confounding is whiped out with
– Not logical to assume that a time constant variable causes a
change in the outcome
• Possible: Interaction time-constant with time-varying
variables
– Does the effect of a time-varying variable differ between
different groups?
– See „A real world example“

22.03.2022 J.W. 24
Sample selection
1. Include only persons who can potentially change
from the state of not being treated to the state of
being treated
– In example: those not participating in social activities (yet)
– When studying effects of marriage: those not (yet) married

22.03.2022 J.W. 25
Sample selection
2. Think carefully how to handle persons that change
to yet another state than treated later on
– In studies of marriage effects:
never married  married  divorce
– Keep?
– Exclude the person completely?
– Exclude only time points (“observations”) while divorced, but
keep while never married and married?
– (substantial considerations)

22.03.2022 J.W. 26
Sample selection
3. Exclude persons with only one observation
– They cannot provide a within estimation

4. Consider including a control group


– Those that are “at risk” / not treated
– AND will not be treated during the observation period
– Allows controlling for time/age

22.03.2022 J.W. 27
Problems not solved by FE-models
• Endogeneity
– reversed causality
– time-varying confounders
– …
• Panel attrition associated with time-variant factors
• Selection into treatment
– Treatment effect on the treated

22.03.2022 J.W. 28
Getting the data in shape

22.03.2022 J.W. 29
Data format
panelvar timevar

• Long data format


– Multiple lines per person
– Each line = 1 time point
• xtsetting long data
– xtreg, fe requires xtset
– xtset panelvar timevar
[, options]

22.03.2022 J.W. 30
Digression:
Transforming wide to long format

. reshape long depr social, i(id) j(wave)


(note: j = 1 2 3 4 5 6)

Data wide -> long

Number of obs. 4 -> 24


Number of variables 13 -> 4
j variable (6 values) -> wave
xij variables:
depr1 depr2 ... depr6 -> depr
social1 social2 ... social6 -> social

22.03.2022 J.W. 31
Describing xtset-data
• Describe transitions between statuses:
xttrans varname [, freq]

freq-option gives numbers in addition to percentages

22.03.2022 J.W. 32
Describing xtset-data
• Describe variables: xtsum varlist

Varies only
between persons

Varies only
within persons

“Enough” within-
variation in treatment?

More info about xtsum and its interpretation: https://www.stata.com/manuals/xtxtsum.pdf

22.03.2022 J.W. 33
Describing xtset-data
• Tabulate variables: xttab varlist

Observation/timepoint-level Unit/person-level

• Also: distinct-command
to identify IDs with
certain features

22.03.2022 J.W. 34
Describing xtset-data

• Useful for patterns of missingness:


xtdescribe [, width(#) patterns(#)]
– Width of participation patterns (default: 100)
– Patterns: maximum number of patterns (default: 9)

22.03.2022 J.W. 35
Useful commands for long data

J.W. 36
Useful commands for long data
• bysort: repeat command on subsets
– Sort and execute for each id and each wave:
bysort id wave
– Sort by id and wave, but execute by id:
bysort id (wave)
• Counting:
– Running count: gen run = _n
– Overall count: gen count = _N
• egen: extensions to generate
– egen newvar = fcn(arguments) [, options]
– fcn: min(exp), max(exp), and many more

22.03.2022 J.W. 37
Useful commands for long data
• Powerful combinations:
– bysort id (wave) : gen round = _n (each person: number rows in correct order)
– bysort id : gen total = _N (each person: how many rows)

22.03.2022 J.W. 38
Useful commands for long data
Goal: Finding first treatment, after treatment, ever treated

22.03.2022 J.W. 39
Useful commands for long data
Goal: Finding first treatment, after first treatment, ever treated

1. First treatment:
– bysort id (wave) :
gen first_social = sum(social == 1) == 1 & sum(social[_n - 1] == 1) == 0
Is 1 if condition is true: social is 1 in row _n and is not 1 in row _n-1
Is 0 otherwise.

2. After first treatment


– bysort id (wave) : gen after_social = sum(first_social)
Running sum of first_social up until wave _n, for person i

3. Tagging all observations of persons ever treated


Finds the maximum of social (0 or 1) for each person
– bysort id : egen ever_social = max(social)

22.03.2022 J.W. 40
A real world example:
Marriage & Happiness

22.03.2022 J.W. 41
A real world example
• Does marriage make happy?
• Based on a 50%-subsample from the German Family Panel
– 11 waves (2009-2019)
– 12.000 respondents, plus their partners, children, and parents
– Born 1971-73, 1981-83, 1991-93 und 2001-03
– https://www.pairfam.de/
• Log-file with syntax and output is available on course homepage
• For data access: Fill in data access form and send to me:
– https://www.pairfam.de/fileadmin/user_upload/uploads/Covid-19/
Antragsformular/DistributionTeachingVersion_pairfam11.0
_COVID-19_en.pdf

22.03.2022 J.W. 42
Interaction with constant variables

Effect of married when


male == 0 (i.e., for women)

Not estimated b/c


constant over time
DIFFERENCE in effect of married
between men vs. women (n.s.).
Effect of being married for men:
0.0268+(-0.0383)=-0.0114

22.03.2022 J.W. 43
Impact functions using dummies

Controlling for wave-dummies Not controlling for wave-dummies

• Dummy variables indicating years since marriage


– Factor-notation in Stata
– Set variable „years since marriage“ to a constant value (e.g. 10000) instead
of missing  included in model as control group
• Plot: coefplot-ado
• See 9-fixed-effects-regression_example.do / .smcl

22.03.2022 J.W. 44
Impact functions using dummies

• See 9-fixed-effects-regression_example.do / .smcl

22.03.2022 J.W. 45
Concluding remarks

22.03.2022 J.W. 46
Application to other data structures
• Applicable to other panel data structures
– Children in families
– Children in schools
– Areas within countries
– …
• Model will exploit the variation within…
– families (different children)
– schools (different children)
– countries (different areas)
– …
– … and whipe out specifics of families, schools, countries, etc

22.03.2022 J.W. 47
Summary individual fixed effects

• Approaching causality with panel data


• Uses within-variation
• Controls time-constant factors
• xtset and xtreg, fe vce(cluster id)
• Model
– Include those not treated at outset
– Include control group and control for time

22.03.2022 J.W. 48
References

Allison, P.D. (2009). Fixed effects regression models. SAGE Publications,


doi.org/10.4135/9781412993869
Best, H., & Wolf, C. (Eds.) (2014). The SAGE handbook of regression analysis and causal
inference. SAGE Publications, doi.org/10.4135/9781446288146
Brüderl, J. (2015). Applied Panel Data Analysis Using STATA. Course Material, available at
https://www.ls3.soziologie.uni-muenchen.de/downloads/downloads_lehre/teaching_materials/pa
nelanalysis-bruederl.pdf
Gould, W.G. (n.d.). How can there be an intercept in the fixed-effects model estimated by xtreg,
fe?, available at https://www.stata.com/support/faqs/statistics/intercept-in-fixed-effects-model/
Gunasekara, F.I., K. Richardson, K. Carter, T. Blakely. Fixed effects analysis of repeated
measures data, International Journal of Epidemiology, Volume 43, Issue 1, February 2014,
Pages 264–269, https://doi.org/10.1093/ije/dyt221
Hamilton, L.C. (2005). Statistics with STATA. Thomson, Belmont.
Torres-Reyna, O. (2007). Panel Data Analysis Fixed and Random Effects using Stata. Course
Material available at https://www.princeton.edu/~otorres/Panel101.pdf
Wooldridge, J.M. (2009). Introductory Econometrics: A Modern Approach. South-Western.
ISBN: 9780324581621

22.03.2022 J.W. 49

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy