Multilevel Mixed-Effects Generalized Linear Models. Prof. Dr. Luiz Paulo Fávero Prof. Dr. Matheus Albergaria

Similar documents
Foley Retreat Research Methods Workshop: Introduction to Hierarchical Modeling

Multilevel/ Mixed Effects Models: A Brief Overview

Example Analysis with STATA

Example Analysis with STATA

Categorical Data Analysis

Bios 312 Midterm: Appendix of Results March 1, Race of mother: Coded as 0==black, 1==Asian, 2==White. . table race white

Unit 2 Regression and Correlation 2 of 2 - Practice Problems SOLUTIONS Stata Users

Unit 5 Logistic Regression Homework #7 Practice Problems. SOLUTIONS Stata version

All analysis examples presented can be done in Stata 10.1 and are included in this chapter s output.

Multilevel Modeling Tenko Raykov, Ph.D. Upcoming Seminar: April 7-8, 2017, Philadelphia, Pennsylvania

Table. XTMIXED Procedure in STATA with Output Systolic Blood Pressure, use "k:mydirectory,

Appendix A Mixed-Effects Models 1. LONGITUDINAL HIERARCHICAL LINEAR MODELS

* STATA.OUTPUT -- Chapter 5

UNIVERSITY OF OSLO DEPARTMENT OF ECONOMICS

Exploring Functional Forms: NBA Shots. NBA Shots 2011: Success v. Distance. . bcuse nbashots11

COMPARING MODEL ESTIMATES: THE LINEAR PROBABILITY MODEL AND LOGISTIC REGRESSION

Logistic Regression, Part III: Hypothesis Testing, Comparisons to OLS

Using Stata 11 & higher for Logistic Regression Richard Williams, University of Notre Dame, Last revised March 28, 2015

Interactions made easy

(LDA lecture 4/15/08: Transition model for binary data. -- TL)

Topics in Biostatistics Categorical Data Analysis and Logistic Regression, part 2. B. Rosner, 5/09/17

Introduction of STATA

Module 6 Case Studies in Longitudinal Data Analysis

Module 20 Case Studies in Longitudinal Data Analysis

Module 15: Multilevel Modelling of Repeated Measures Data. Stata Practical

Center for Demography and Ecology

Analyzing CHIS Data Using Stata

Modeling Contextual Data in. Sharon L. Christ Departments of HDFS and Statistics Purdue University

3. The lab guide uses the data set cda_scireview3.dta. These data cannot be used to complete assignments.

Guideline on evaluating the impact of policies -Quantitative approach-

Post-Estimation Commands for MLogit Richard Williams, University of Notre Dame, Last revised February 13, 2017

X. Mixed Effects Analysis of Variance

EFA in a CFA Framework

Nested or Hierarchical Structure School 1 School 2 School 3 School 4 Neighborhood1 xxx xx. students nested within schools within neighborhoods

Case study: Modelling berry yield through GLMMs

Never Smokers Exposure Case Control Yes No

********************************************************************************************** *******************************

Tabulate and plot measures of association after restricted cubic spline models

Application: Effects of Job Training Program (Data are the Dehejia and Wahba (1999) version of Lalonde (1986).)

Methods for Multilevel Modeling and Design Effects. Sharon L. Christ Departments of HDFS and Statistics Purdue University

Appendix C: Lab Guide for Stata

MNLM for Nominal Outcomes

Survey commands in STATA

PubHlth Introduction to Biostatistics. 1. Summarizing Data Illustration: STATA version 10 or 11. A Visit to Yellowstone National Park, USA

RESIDUAL FILES IN HLM OVERVIEW

Getting Started with HLM 5. For Windows

ECONOMICS AND ECONOMIC METHODS PRELIM EXAM Statistics and Econometrics May 2014

Working with Stata Inference on proportions

SOCY7706: Longitudinal Data Analysis Instructor: Natasha Sarkisian Two Wave Panel Data Analysis

The study obtains the following results: Homework #2 Basics of Logistic Regression Page 1. . version 13.1

The Multivariate Dustbin

Examining Turnover in Open Source Software Projects Using Logistic Hierarchical Linear Modeling Approach

Week 10: Heteroskedasticity

Failure to take the sampling scheme into account can lead to inaccurate point estimates and/or flawed estimates of the standard errors.

Count model selection and post-estimation to evaluate composite flour technology adoption in Senegal-West Africa

Sociology 7704: Regression Models for Categorical Data Instructor: Natasha Sarkisian. Preliminary Data Screening

STATISTICS PART Instructor: Dr. Samir Safi Name:

Stata v 12 Illustration. One Way Analysis of Variance

Categorical Data Analysis for Social Scientists

Correlated Random Effects Panel Data Models

Trunkierte Regression: simulierte Daten

ECONOMICS AND ECONOMIC METHODS PRELIM EXAM Statistics and Econometrics May 2011

Milk Data Analysis. 1. Objective: analyzing protein milk data using STATA.

Biostatistics 208. Lecture 1: Overview & Linear Regression Intro.

Longitudinal Data Analysis, p.12

log: F:\stata_parthenope_01.smcl opened on: 17 Mar 2012, 18:21:56

Module 7: Multilevel Models for Binary Responses. Practical. Introduction to the Bangladesh Demographic and Health Survey 2004 Dataset.

This is a quick-and-dirty example for some syntax and output from pscore and psmatch2.

Survival analysis. Solutions to exercises

Biostatistics 208 Data Exploration

ROBUST ESTIMATION OF STANDARD ERRORS

Interpreting and Visualizing Regression models with Stata Margins and Marginsplot. Boriana Pratt May 2017

BIOSTATS 640 Spring 2016 At Your Request! Stata Lab #2 Basics & Logistic Regression. 1. Start a log Read in a dataset...

İnsan Tunalı November 29, 2018 Econ 511: Econometrics I. ANSWERS TO ASSIGNMENT 10: Part II STATA Supplement

The Impact of Anchors Stores in the Perform of Shopping Centers

CHAPTER 10 ASDA ANALYSIS EXAMPLES REPLICATION IVEware

PREDICTIVE MODEL OF TOTAL INCOME FROM SALARIES/WAGES IN THE CONTEXT OF PASAY CITY

Timing Production Runs

Lecture 2a: Model building I

Notes on PS2

Logistic Regression Part II. Spring 2013 Biostat

What is Multilevel Structural Equation Modelling?

Checking the model. Linearity. Normality. Constant variance. Influential points. Covariate overlap

DAY 2 Advanced comparison of methods of measurements

Mixed Mode Surveys in Business Research: A Natural Experiment. Dr Andrew Engeli March 14 th 2018

A Survey on Survey Statistics: What is done, can be done in Stata, and what s missing?

ECON Introductory Econometrics Seminar 6

Midterm Exam. Friday the 29th of October, 2010

Week 11: Collinearity

Latent Growth Curve Analysis. Daniel Boduszek Department of Behavioural and Social Sciences University of Huddersfield, UK

ADVANCED ECONOMETRICS I

Dealing with missing data in practice: Methods, applications, and implications for HIV cohort studies

The Big Picture: Four Domains of HLM. Today s Discussion. 3 Background Concepts. 1) Nested Data. Introduction to Hierarchical Linear Modeling (HLM)

Hierarchical Linear Modeling: A Primer 1 (Measures Within People) R. C. Gardner Department of Psychology

*STATA.OUTPUT -- Chapter 13

. *increase the memory or there will problems. set memory 40m (40960k)

Title. Syntax. Description. xt Introduction to xt commands

C-14 FINDING THE RIGHT SYNERGY FROM GLMS AND MACHINE LEARNING. CAS Annual Meeting November 7-10

This example demonstrates the use of the Stata 11.1 sgmediation command with survey correction and a subpopulation indicator.

Florida. Difference-in-Difference Models 8/23/2016

Transcription:

Multilevel Mixed-Effects Generalized Linear Models in aaaa Prof. Dr. Luiz Paulo Fávero Prof. Dr. Matheus Albergaria

SUMMARY - Theoretical Fundamentals of Multilevel Models. - Estimation of Multilevel Mixed-Effects Generalized Linear Models in Stata.

Theoretical Fundamentals of Multilevel Models

THINKING Different researchers, from the same database, can estimate different models and, consequently, obtain different predicted values of the phenomenon under study. The objective is to estimate models that, although simplifications of reality, present the best possible adherence between real and fitted values. Silberzahn, R.; Uhlmann, E. L. Many hands make tight work. Nature, v. 526, p. 189-191, Out 2015.

0 Fitted Values 20 40 60 80 100 THINKING 0 20 40 60 80 100 Real Values 45º

0 Fitted Values 20 40 60 80 100 THINKING 0 20 40 60 80 100 Real Values 45º Model 1

0 Fitted Values 20 40 60 80 100 THINKING 0 20 40 60 80 100 Real Values 45º Model 1 Model 2

0 Fitted Values 20 40 60 80 100 THINKING 0 20 40 60 80 100 Real Values 45º Model 1 Model 2 Model 3

GLLAMM Multilevel Mixed-Effects Generalized Linear Models (GLLAMM) Multilevel Mixed-Effects Linear Models Multilevel Mixed-Effects Non-Linear Models Multilevel Mixed-Effects Logistic Models Multilevel Mixed-Effects Count Data Models (Poisson + Negative Binomial) SOURCE: Manual de Análise de Dados: Estatística e Modelagem Multivariada (Fávero e Belfiore, 2017).

O MULTILEVEL QUE SÃO MODELOS MODELING MULTINÍVEL? Multilevel models are models that recognize nested structure in the data. Hierarchical linear models: applications and data analysis methods. 2. ed. Thousand Oaks: Sage Publications, 2002. Stephen W. Raudenbush University of Chicago Anthony S. Bryk Stanford University

MULTILEVEL STRUCTURE

MULTILEVEL STRUCTURE Level 1 Firm Level 2 Country

0.0 Desempenho Outcome 20.0 40.0 60.0 80.0 100.0 MULTILEVEL MODEL 5 10 15 20 25 30 Variável de Firma Predictor Variable

0.0 Desempenho Outcome 20.0 40.0 60.0 80.0 100.0 MULTILEVEL MODEL 5 10 15 20 25 30 Variável de Firma Predictor Variable

0.0 Desempenho Outcome 20.0 40.0 60.0 80.0 100.0 MULTILEVEL MODEL 5 10 15 20 25 30 Variável de Firma Predictor Variable

0.0 Desempenho Outcome 20.0 40.0 60.0 80.0 100.0 MULTILEVEL MODEL 5 10 15 20 25 30 Variável de Firma Predictor Variable

MULTILEVEL MODEL Context 1: Y. X r i1 01 11 i1 i1 Context 2: Y. X r i2 02 12 i2 i2 Context 3: Y. X r i3 03 13 i3 i3 Context 4: Y. X r i4 04 14 i4 i4

MULTILEVEL MODEL Level 1 ij 0j 1 j. Xij rij Level 2 γ γ.w u 1 γ10 γ 11.W u1 0 j 00 01 j 0 j j j j ij γ00 γ 01.W j u 0 j γ10 γ 11.W j u1 j. Xij rij intercept with slope with random effects random effects

MULTILEVEL MODEL γ γ. X γ.w γ.w. X u u. X r ij 00 10 ij 01 j 11 j ij 0 j 1 j ij ij Fixed Effects Random Effects - Traditional GLM models ignore interactions between variables in the fixed efects component and between error terms and variables in the random effects component. Multilevel statistical models. 4. ed. Chichester: John Wiley & Sons, 2011. Harvey Goldstein Centre for Multilevel Modelling University of Bristol

VARIANCE OF ERROR TERMS - If variances of error terms u 0j e u 1j are statistically different from zero, traditional GLM estimations will not be adequate. Using multivariate statistics. 6. ed. Boston: Pearson, 2013. Barbara G. Tabachnick California State University Linda S. Fidell California State University

MULTILEVEL MODEL - The inclusion of dummies representing groups do not capture contextual effects, because this procedure do not allow the split between observable and unobservable effects over the outcome variable. Multilevel and longitudinal modeling using Stata. 3. ed. College Station: Stata Press, 2012. Sophia Rabe-Hesketh U. C. Berkeley Anders Skrondal Norwegian Institute of Public Health University of Oslo U. C. Berkeley

WHY SHOULD WE USE MULTILEVEL MODELING? Multilevel models allow the development of new and more complex research constructs. Within a model structure with a single equation, there seems to be no connection between individuals and the society in which they live. In this sense, the use of level equations allows the researcher to 'jump' from one science to another: students and schools, families and neighborhoods, firms and countries. Ignoring this relationship means elaborate incorrect analyzes about the behavior of the individuals and, equally, about the behavior of the groups. Only the recognition of these reciprocal influences allows the correct analysis of the phenomena. Methodology and epistemology of multilevel analysis. London: Kluwer Academic Publishers, 2003. Daniel Courgeau Institut National D Études Démographiques

Estimation of Multilevel Mixed-Effects Generalized Linear Models in aaaaaa

A THREE-LEVEL MIXED-EFFECTS COUNT DATA MODEL Level 1 0 1 1 2 2 ln.z.z....z ijk jk jk jk jk jk Pjk Pjk Level 2 Q p b b.x r pjk p0k pqk qjk pjk q 1 Level 3 S pq b γ γ.w u pqk pq0 pqs sk pqk s 1

IMPLEMENTATION Stata example - Let s look at the relationship between traffic accidents and alcohol consumption (Fávero and Belfiore, 2017). - We want to estimate the relationship between the number of traffic accidents and the consumption alcohol per person/day in the district, considering differences in cities and states.

IMPLEMENTATION Data description (file TrafficAccidents.dta ). desc obs: 1,062 vars: 5 size: 15,930 --------------------------------------------------------------------------------------- storage display variable name type format variable label ---------------------------------------------------------------------------------------------------------- state str2 %2s state k (level 3) city int %8.0g city j (level 2) district int %8.0g municipal district i (level 1) accidents byte %8.0g number of traffic accidents in the district over the last year alcohol float %9.2f average consumption of alcohol per person/day in the district (in grams) ---------------------------------------------------------------------------------------------------------- Sorted by:

IMPLEMENTATION. tab accidents Data tabulation number of traffic accidents Freq. Percent Cum. ------------+----------------------------------- 0 26 2.45 2.45 1 168 15.82 18.27 2 308 29.00 47.27 3 208 19.59 66.85 4 110 10.36 77.21 5 62 5.84 83.05 6 38 3.58 86.63 7 27 2.54 89.17 8 22 2.07 91.24 9 17 1.60 92.84 10 15 1.41 94.26 11 10 0.94 95.20 12 10 0.94 96.14 13 5 0.47 96.61 14 4 0.38 96.99 15 4 0.38 97.36 16 6 0.56 97.93 17 5 0.47 98.40 18 2 0.19 98.59 21 2 0.19 98.78 22 4 0.38 99.15 23 5 0.47 99.62 24 1 0.09 99.72 32 1 0.09 99.81 33 2 0.19 100.00 ------------+----------------------------------- Total 1,062 100.00

0 Frequency 100 200 300 IMPLEMENTATION Histogram. hist accidents, discrete freq (start=0, width=1) 0 10 20 30 40 number of traffic accidents in the district over the last year

IMPLEMENTATION Mean and variance (possible existence of overdispersion). tabstat accidents, stats(mean var) variable mean variance -------------+-------------------- accidents 3.812618 15.24007 ----------------------------------

IMPLEMENTATION Proposed Model accidents 0 1 ln ijk jk jk.alcohol jk b r 0 jk 00k 0 jk b 1 jk 10k b γ u b 00k 000 00k γ 10k 100 accidents γ000 γ100 alcohol u00 r0 ln ijk jk k jk

IMPLEMENTATION Multilevel Mixed-Effects Poisson Model. meglm accidents alcohol state: city:, family(poisson) link(log) nolog Mixed-effects GLM Number of obs = 1062 Family: Poisson Link: log ----------------------------------------------------------- No. of Observations per Group Group Variable Groups Minimum Average Maximum ----------------+------------------------------------------ state 27 1 39.3 95 city 235 1 4.5 13 ----------------------------------------------------------- Integration method: mvaghermite Integration points = 7 Wald chi2(1) = 5.60 Log likelihood = -2295.9047 Prob > chi2 = 0.0180 ------------------------------------------------------------------------------ accidents Coef. Std. Err. z P> z [95% Conf. Interval] -------------+---------------------------------------------------------------- alcohol.0478279.020216 2.37 0.018.0082053.0874506 _cons.7293659.2638594 2.76 0.006.2122111 1.246521 -------------+---------------------------------------------------------------- state var(_cons).3857761.12319.2063103.7213563 -------------+---------------------------------------------------------------- state>city var(_cons).0829691.0142976.059188.1163053 ------------------------------------------------------------------------------ LR test vs. Poisson regression: chi2(2) = 1279.65 Prob > chi2 = 0.0000. estimates store mepoisson

Multilevel Mixed-Effects Negative Binomial Model. meglm accidents alcohol state: city:, family(nbinomial) link(log) nolog Mixed-effects GLM Number of obs = 1062 Family: negative binomial Link: log Overdispersion: mean ----------------------------------------------------------- No. of Observations per Group Group Variable Groups Minimum Average Maximum ----------------+------------------------------------------ state 27 1 39.3 95 city 235 1 4.5 13 ----------------------------------------------------------- Integration method: mvaghermite Integration points = 7 Wald chi2(1) = 4.38 Log likelihood = -2234.3721 Prob > chi2 = 0.0363 ------------------------------------------------------------------------------ accidents Coef. Std. Err. z P> z [95% Conf. Interval] ----------------------+---------------------------------------------------------------- alcohol.0466768.0222975 2.09 0.036.0029746.0903791 _cons.7538477.2843403 2.65 0.008.196551 1.311144 ----------------------+---------------------------------------------------------------- /lnalpha -2.258241.1355339-16.66 0.000-2.523883-1.9926 ----------------------+---------------------------------------------------------------- state var(_cons).3775391.1205934.2018698.7060775 ----------------------+------------------------------------------------------------- state>city var(_cons).0613878.0138809.0394104.0956212 --------------------------------------------------------------------------------------- LR test vs. nbinomial regression: chi2(2) = 508.99 Prob > chi2 = 0.0000. estimates store menegbin IMPLEMENTATION

IMPLEMENTATION Likelihood-ratio test. lrtest mepoisson menegbin Likelihood-ratio test LR chi2(1) = 123.07 (Assumption: mepoisson nested in menegbin) Prob > chi2 = 0.0000

IMPLEMENTATION predict lambda predict u00 r0, remeans list state city accidents lambda u00 r0 if state=="mt", sepby(city) +-----------------------------------------------------------+ state city accidents lambda u00 r0 ----------------------------------------------------------- 669. MT 148 2 1.600369 -.815816 -.0064477 670. MT 148 2 1.63053 -.815816 -.0064477 671. MT 148 1 1.63053 -.815816 -.0064477 672. MT 148 1 1.585499 -.815816 -.0064477 673. MT 148 2 1.499133 -.815816 -.0064477 ----------------------------------------------------------- 674. MT 149 0 1.415119 -.815816 -.1107979 675. MT 149 3 1.441788 -.815816 -.1107979 676. MT 149 1 1.428391 -.815816 -.1107979 677. MT 149 1 1.441788 -.815816 -.1107979 678. MT 149 1 1.338034 -.815816 -.1107979 679. MT 149 1 1.388943 -.815816 -.1107979 680. MT 149 2 1.415119 -.815816 -.1107979 681. MT 149 1 1.350584 -.815816 -.1107979 682. MT 149 1 1.350584 -.815816 -.1107979 683. MT 149 2 1.40197 -.815816 -.1107979 684. MT 149 1 1.376037 -.815816 -.1107979 685. MT 149 1 1.441788 -.815816 -.1107979 ----------------------------------------------------------- 686. MT 150 2 1.667662 -.815816.01607 687. MT 150 2 1.576821 -.815816.01607 688. MT 150 1 1.621606 -.815816.01607 689. MT 150 2 1.547654 -.815816.01607 690. MT 150 1 1.547654 -.815816.01607 691. MT 150 2 1.533273 -.815816.01607 ----------------------------------------------------------- 692. MT 151 1 1.462078 -.815816 -.031476 693. MT 151 2 1.489632 -.815816 -.031476 694. MT 151 1 1.517706 -.815816 -.031476 +-----------------------------------------------------------+

0 2 4 6 8 IMPLEMENTATION quietly nbreg accidents alcohol predict lambdatrad graph twoway lfit accidents accidents mspline lambda accidents mspline lambdatrad accidents, legend(label(2 " GLLAMM Multilevel Negative Binomial") label(3 "GLM Traditional Negative Binomial ")) 0 2 4 6 8 Fitted values (45º) GLLAMM Multilevel Negative Binomial GLM Traditional Negative Binomial

CHALLENGES IN MULTILEVEL MODELING Deep interactions Methods of parameter estimations Sample clustering Estimation of models with better adjustment between real and fitted values! Andrew Gelman Multilevel Conference, 31 Out 2015, Columbia University, NYC.

CONCLUSIONS - Multilevel Mixed-Effects Generalized Linear Models: still employed with parsimony today. - Stata 15 has a full command suite for the estimation of these models. - Several research opportunities, both in theoretical and applied terms, in areas such as microecomics, finance, transportation, real estate, leisure, ecology, education, and health.

REFERENCES COURGEAU, D. Methodology and epistemology of multilevel analysis. London: Kluwer Academic Publishers, 2003. FÁVERO, L. P.; BELFIORE, P. Manual de análise de dados: estatística e modelagem multivariada com Excel, SPSS e Stata. Rio de Janeiro: Elsevier, 2017. RABE-HESKETH, S.; SKRONDAL, A. Multilevel and longitudinal modeling using Stata: continuous responses (Vol. I). 3. ed. College Station: Stata Press, 2012. 38

MULTILEVEL MESSAGE We must widen the circle of our love till it embraces the whole village; the village in its turn must take into its fold the district; the district the province; and so on, until the scope of our love becomes co-terminous with the world. 39

Thank you! Multilevel Mixed-Effects Generalized Linear Models in Stata Prof. Dr. Luiz Paulo Fávero - lpfavero@usp.br Prof. Dr. Matheus Albergaria - matheus.albergaria@usp.br

APPENDIX: STATA DO-FILE 41

APPENDIX: STATA DO-FILE 42