xtmixed & denominator degrees of freedom: myth or magic



Similar documents
Section 13, Part 1 ANOVA. Analysis Of Variance

Lab 5 Linear Regression with Within-subject Correlation. Goals: Data: Use the pig data which is in wide format:

ECON 142 SKETCH OF SOLUTIONS FOR APPLIED EXERCISE #2

Department of Economics Session 2012/2013. EC352 Econometric Methods. Solutions to Exercises from Week (0.052)

Outline. Topic 4 - Analysis of Variance Approach to Regression. Partitioning Sums of Squares. Total Sum of Squares. Partitioning sums of squares

MULTIPLE REGRESSION EXAMPLE

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

Milk Data Analysis. 1. Objective Introduction to SAS PROC MIXED Analyzing protein milk data using STATA Refit protein milk data using PROC MIXED

Handling missing data in Stata a whirlwind tour

Multicollinearity Richard Williams, University of Notre Dame, Last revised January 13, 2015

Please follow the directions once you locate the Stata software in your computer. Room 114 (Business Lab) has computers with Stata software

Sample Size Calculation for Longitudinal Studies

Lecture 15. Endogeneity & Instrumental Variable Estimation

Random effects and nested models with SAS

IAPRI Quantitative Analysis Capacity Building Series. Multiple regression analysis & interpreting results

DETERMINANTS OF CAPITAL ADEQUACY RATIO IN SELECTED BOSNIAN BANKS

Marginal Effects for Continuous Variables Richard Williams, University of Notre Dame, Last revised February 21, 2015

Rockefeller College University at Albany

Multiple Linear Regression

Statistics 104 Final Project A Culture of Debt: A Study of Credit Card Spending in America TF: Kevin Rader Anonymous Students: LD, MH, IW, MY

ESTIMATING AVERAGE TREATMENT EFFECTS: IV AND CONTROL FUNCTIONS, II Jeff Wooldridge Michigan State University BGSE/IZA Course in Microeconometrics

E(y i ) = x T i β. yield of the refined product as a percentage of crude specific gravity vapour pressure ASTM 10% point ASTM end point in degrees F

Multivariate Analysis of Variance (MANOVA)

Correlation and Regression

MODEL I: DRINK REGRESSED ON GPA & MALE, WITHOUT CENTERING

ANOVA. February 12, 2015

Use of deviance statistics for comparing models

MODELING AUTO INSURANCE PREMIUMS

Interaction effects and group comparisons Richard Williams, University of Notre Dame, Last revised February 20, 2015

August 2012 EXAMINATIONS Solution Part I

Stat 5303 (Oehlert): Tukey One Degree of Freedom 1

Using Stata 9 & Higher for OLS Regression Richard Williams, University of Notre Dame, Last revised January 8, 2015

DEPARTMENT OF PSYCHOLOGY UNIVERSITY OF LANCASTER MSC IN PSYCHOLOGICAL RESEARCH METHODS ANALYSING AND INTERPRETING DATA 2 PART 1 WEEK 9

MEAN SEPARATION TESTS (LSD AND Tukey s Procedure) is rejected, we need a method to determine which means are significantly different from the others.

MULTIPLE LINEAR REGRESSION ANALYSIS USING MICROSOFT EXCEL. by Michael L. Orlov Chemistry Department, Oregon State University (1996)

ANOVAs and SPM. July 12, 2005

Getting Correct Results from PROC REG

Interaction effects between continuous variables (Optional)

1. What is the critical value for this 95% confidence interval? CV = z.025 = invnorm(0.025) = 1.96

Discussion Section 4 ECON 139/ Summer Term II

Simple Linear Regression Inference

I L L I N O I S UNIVERSITY OF ILLINOIS AT URBANA-CHAMPAIGN

Overview Classes Logistic regression (5) 19-3 Building and applying logistic regression (6) 26-3 Generalizations of logistic regression (7)

From the help desk: Swamy s random-coefficients model

I n d i a n a U n i v e r s i t y U n i v e r s i t y I n f o r m a t i o n T e c h n o l o g y S e r v i c e s

Multiple Regression in SPSS This example shows you how to perform multiple regression. The basic command is regression : linear.

Statistical Models in R

SAS Software to Fit the Generalized Linear Model

New SAS Procedures for Analysis of Sample Survey Data

Basic Statistical and Modeling Procedures Using SAS

Quick Stata Guide by Liz Foster

Multilevel Analysis and Complex Surveys. Alan Hubbard UC Berkeley - Division of Biostatistics

5. Linear Regression

Package lmertest. July 16, 2015

HURDLE AND SELECTION MODELS Jeff Wooldridge Michigan State University BGSE/IZA Course in Microeconometrics July 2009

International Statistical Institute, 56th Session, 2007: Phil Everson

Linear Mixed-Effects Modeling in SPSS: An Introduction to the MIXED Procedure

Statistical Functions in Excel

Data Analysis Methodology 1

Chapter 4 and 5 solutions

Nonlinear Regression Functions. SW Ch 8 1/54/

Introduction to Hierarchical Linear Modeling with R

THE FIRST SET OF EXAMPLES USE SUMMARY DATA... EXAMPLE 7.2, PAGE 227 DESCRIBES A PROBLEM AND A HYPOTHESIS TEST IS PERFORMED IN EXAMPLE 7.

Lesson 1: Comparison of Population Means Part c: Comparison of Two- Means

Standard errors of marginal effects in the heteroskedastic probit model

Multinomial and Ordinal Logistic Regression

Technical report. in SPSS AN INTRODUCTION TO THE MIXED PROCEDURE

Linear Regression Models with Logarithmic Transformations

Correlated Random Effects Panel Data Models

An analysis method for a quantitative outcome and two categorical explanatory variables.

MIXED MODEL ANALYSIS USING R

25 Working with categorical data and factor variables

Post-hoc comparisons & two-way analysis of variance. Two-way ANOVA, II. Post-hoc testing for main effects. Post-hoc testing 9.

ABSORBENCY OF PAPER TOWELS

Comparing Group Means: The T-test and One-way ANOVA Using STATA, SAS, and SPSS

MULTIPLE REGRESSION AND ISSUES IN REGRESSION ANALYSIS

Using Stata for Categorical Data Analysis

Syntax Menu Description Options Remarks and examples Stored results Methods and formulas References Also see. level(#) , options2

especially with continuous

Introduction to structural equation modeling using the sem command

The following postestimation commands for time series are available for regress:

Nonlinear relationships Richard Williams, University of Notre Dame, Last revised February 20, 2015

Title. Syntax. stata.com. fp Fractional polynomial regression. Estimation

Module 14: Missing Data Stata Practical

MATH 564 Project Report. Analysis of Desktop Virtualization Capacity with. Linear Regression Model

1.5 Oneway Analysis of Variance

Lecture 11: Confidence intervals and model comparison for linear regression; analysis of variance

Data Mining and Data Warehousing. Henryk Maciejewski. Data Mining Predictive modelling: regression

1 Simple Linear Regression I Least Squares Estimation

From the help desk: hurdle models

Univariate Regression

Statistics Review PSY379

Week 5: Multiple Linear Regression

Generalized Linear Models

An Introduction to Statistical Tests for the SAS Programmer Sara Beck, Fred Hutchinson Cancer Research Center, Seattle, WA

The Analysis of Variance ANOVA

Descriptive Statistics

Transcription:

xtmixed & denominator degrees of freedom: myth or magic 2011 Chicago Stata Conference Phil Ender UCLA Statistical Consulting Group July 2011 Phil Ender xtmixed & denominator degrees of freedom: myth or magic

Terminology Here are two abbreviations I will be using: ddf Denominator degrees of freedom. ddfm Denominator degrees of freedom method. 2 / 30

Consider this Simple Randomized Block Example Randomized block design with 16 subjects and 3 treatment levels.. anova y trt id Number of obs = 48 R-squared = 0.7592 Root MSE = 3.23265 Adj R-squared = 0.6227 Source Partial SS df MS F Prob > F -------+--------------------------------------------------- Model 988.166667 17 58.127451 5.56 0.0000 trt 63.1666667 2 31.5833333 3.02 0.0637 id 925 15 61.6666667 5.90 0.0000 Residual 313.5 30 10.45 ---------+--------------------------------------------------- Total 1301.66667 47 27.6950355 3 / 30

Computing the F-ratio F = (SS n)/(ndf ) (SS d )/(ddf ) = (63.1666667)/(2) (313.5)/(30) = 31.583 10.45 = 3.02 The denominator degrees of freedom is 30. 4 / 30

Same data using xtmixed. xtmixed y i.trt id:, var Mixed-effects REML regression Number of obs = 48 Group variable: id Number of groups = 16 Obs per group: min = 3 avg = 3.0 max = 3 ---------------------------------------------------------------- -------------+-------------------------------------------------- ---------------------------------------------------------------- Wald chi2(2) = 6.04 Log restricted-likelihood = -134.12322 Prob > chi2 = 0.0487 y Coef. Std. Err. z P> z [95% CI] 2.trt -.875 1.142913-0.77 0.444-3.12 1.37 3.trt -2.75 1.142913-2.41 0.016-4.99 -.51 _cons 15.625 1.311541 11.91 0.000 13.05 18.2 5 / 30

xtmixed con t -------------------------------------------------------------- Random-effects Parameters Estimate Std. Err. [95% CI] --------------------------+----------------------------------- id: Identity var(_cons) 17.07223 7.559526 7.17 40.66 --------------------------+----------------------------------- var(residual) 10.45 2.698177 6.3 17.33 -------------------------------------------------------------- LR test vs. linear regression: chibar2(01) = 16.95 Prob >= chibar2 = 0.0000 6 / 30

Testing main effect of trt Omnibus test for treatment.. test 2.trt 3.trt ( 1) [y]2.trt = 0 ( 2) [y]3.trt = 0 chi2( 2) = 6.04 Prob > chi2 = 0.0487 Scale chi-square as F-ratio.. display r(chi2)/r(df) 3.0223293 F-ratio from xtmixed is the same as the F-ratio from anova. 7 / 30

Assumming... Assuming that the ddf for this simple balanced model is, ddf = obs df (trt) df (id) 1 = 48 2 15 1 = 30 Then, the p-value equals, Ftail(2, 30, 3.022) = 0.06372709 8 / 30

Comparing p-values The p-value for the chi-square is 0.0487 The p-value for the anova F-ratio is 0.0637 Chi-square is a large sample normal based statistic, so for small experimental designs we prefer the p-values obtained from the F-distribution. If xtmixed provided denominator degrees of freedom this would be a very simple matter. 9 / 30

What s your problem, just use anova. Stop Complaining. There are many situations that anova does not handle well. Here are three examples. Incomplete data within subject Unequally spaced time intervals Level 1 covariance structures other than compound symmetry UCLA has many researchers working within traditional anova frameworks with relatively small experimental designs. Reviewers and editors of journals in these fields are familiar with experimental designs and with F-ratios. However, it is common for data to be unbalanced within subject, as is the need for alternative level 1 covariance structures. Xtmixed would be ideal for these situations if it could produce probabilities adjusted for smaller samples. 10 / 30

MIssing Observations Example Consider a modification of our randomized block example with one missing observation for each of four subjects. Same xtmixed command.. xtmixed y i.trt id:, var 11 / 30

xtmixed with missing observations Mixed-effects REML regression Number of obs = 44 Group variable: id Number of groups = 16 Obs per group: min = 2 avg = 2.8 max = 3 Wald chi2(2) = 6.51 Log restricted-likelihood = -120.42308 Prob > chi2 = 0.0385 --------------------------------------------------------------- y Coef. Std. Err. z P> z [95% CI] -------+------------------------------------------------------- 2.trt -1.358164 1.133608-1.20 0.231-3.58.86 3.trt -2.821488 1.105687-2.55 0.011-4.99 -.65 _cons 15.37974 1.275609 12.06 0.000 12.88 17.878 --------------------------------------------------------------- 12 / 30

xtmixed with missing observations Continued --------------------------------------------------------------- Random-effects Parameters Estimate Std. Err. [95% CI] -----------------------------+--------------------------------- id: Identity var(_cons) 16.27504 7.162905 6.87 38.56 -----------------------------+--------------------------------- var(residual) 8.929243 2.465748 5.2 15.34 --------------------------------------------------------------- LR test vs. linear regression: chibar2(01) = 16.66 Prob >= chibar2 = 0.0000 13 / 30

Testing trt Omnibus test for main effect for treatment.. test 2.trt 3.trt ( 1) [y]2.trt = 0 ( 2) [y]3.trt = 0 chi2( 2) = 6.51 Prob > chi2 = 0.0385 Scale chi-square as F-ratio.. display r(chi2)/r(df) 3.2572416 14 / 30

Comparing p-values The p-value for the chi-square is 0.0385 The p-value for the F-ratio is Ftail(2,?, 3.257) =? Even thought the chi-square has been rescaled as an F-ratio, there is no p-value for the F-ratio because we don t know the denominator degrees of freedom. 15 / 30

So, why doesn t xtmixed provide the ddf? The simple answer: xtmixed does not know the denominator degrees of freedom. It does not have mean squares or numerators or denominators in the anova sense. And, it does not compute F-ratios at all. xtmixed performs statistical tests by dividing parameter estimates by their standard errors. 16 / 30

What can be done? Since there is no actual denominator degrees of freedom, we need an approximation of an F-distribution that has appropriate control over the Type I Error and has adequate power. This is not an easy task. There does not seem to be a single F-approximation that works for all possible mixed models. It may be difficult, but it doesn t mean that no one ever tried. 17 / 30

Suvery of Major Stat Packages Package Command ddf method Philosophy Stata xtmixed none Statistical R lmer none Purity R lme containment Empirical SPSS mixed Satterthwaite Pragmatism SAS proc mixed Satterthwaite Kenward-Roger* between-within residual containment * SAS current favorite. 18 / 30

Residual, Containment & Between-within ddf Residual df = N rank(x ) = 44 3 = 41 Containment df = N rank(x, Z) = 44 3 15 = 44 18 = 26 Betwithin df = Residual df rank(z) = 41 15 = 26 19 / 30

Satterthwaite Approximation The Satterthwaite approximation is intended as an accurate F-test approximation, and hence accurate p-values for the F-test. SAS does warn that the small-sample properties of the Satterthwaite approximation have not been thoroughly investigated for all models. 20 / 30

Kenward-Roger Approximation The Kenward-Roger method is an attempt to make a further adjustment to the F-statistic, to take into account the fact that the REML estimates of the covariance parameters are estimates and not known quantities. This method inflates the marginal variance-covariance matrix and then applies the Satterthwaite method on the resulting matrix. 21 / 30

Computational Issues Residual, containment and between-within methods are fairly simple to compute. However, Satterthwaite and Kenward-Rogers are both computationally and resource intensive. The computational overhead increases with the complexity of the design and with the complexity of the unbalancedness. 22 / 30

The RB-3 example with missing observations Various F-approximations with our RB-3 example with 4 missing observations using SAS. Statistic Value ddf p-value ddfm F 3.26 26.7 0.0542 Satterthwaite F 3.25 26.7 0.0546 Kenward-Roger F 3.26 26 0.0547 between-within F 3.26 26 0.0547 contain F 3.26 41 0.0487 residual chi2 6.514 0.0385 from Stata 23 / 30

Exceptions in Stata xtmixed does not provide adjusted ddf s, however anova with the repeated option will adjust both the numerator and denominator degrees of freedom. We will return the the original randomized block data, the one without any missing observations and rerun anova using repeated(trt). 24 / 30

anova repeated option. anova y trt id, repeated(trt)... Between-subjects error term: id Levels: 16 (15 df) Lowest b.s.e. variable: id Repeated variable: trt Huynh-Feldt epsilon = 1.0847 *Huynh-Feldt epsilon reset to 1.0000 Greenhouse-Geisser epsilon = 0.9505 Box s conservative epsilon = 0.5000 ------------ Prob > F ------------ Source df F Regular H-F G-G Box -----------+-------------------------------------------------- trt 2 3.02 0.0637 0.0637 0.0668 0.1026 Residual 30 25 / 30

ddf with repeated option Ftail(2, 30, 3.022) = 0.06372709//Regular (1) Ftail(2 1, 30 1, 3.022) = //Huynh Feldt (2) Ftail(2, 30, 3.022) = 0.06372709 Ftail(2.9505, 30.9505, 3.022) = //Greenhouse Geisser (3) Ftail(1.901, 28.515, 3.022) = 0.0668668 Ftail(2.5, 30.5, 3.022) = //Box s Conservative (4) Ftail(1, 15, 3.0222) = 0.10261965 Use Three-Step Procedure to determine statistical significance. 26 / 30

And, of course, t-test with unequal variances both Satterthwaite and Welch degrees of freedom for t-tests with unequal variances produce latent ddf.. ttest y, by(grp) Two-sample t test with equal variances: t = -2.0325 df = 38 p-value = 0.0491 Two-sample t test with unequal variances using Satterthwaite s df: t = -2.0325 df = 26.7921 p-value = 0.0521 Two-sample t test with unequal variances using Welch s df: t = -2.0325 df = 27.6124 p-value = 0.0518 27 / 30

What can you do short of running SAS? Consider a split-plot design with a between subjects and b within subjects and with missing observations within subject:. xtmixed y a##b id: Use the ddf from the following anova models with the chi-squares rescaled as F-ratios from xtmixed: Between-within ddf: (two error terms). anova y a / id a b a#b / Containment ddf: (one error term). anova y a id a b a#b Residual ddf: (one error term). anova y a b a#b 28 / 30

Conclusion Myth or Magic? Mostly myth 29 / 30

References Giesbrecht, F.G. and Burns, J.C. (1985). Two-stage analysis based on a mixed model: Large-sample asymtotic theory and small-sample simulation results. Biometrics, 41, 477-486. Gould, W. (2009). How are the chi-squared and F distributions related? Stata FAQ, www.stata.com/support/faqs/stat/wald.html. Kenward, M.G. and Roger, J. H. (1997). Small sample Inference for fixed effects from restricted maximum likelihood. Biometrics, 53, 983997. (2009). SAS/STAT 9.2 User s Guide, Second Edition, SAS Institute Inc, Cary, NC. Satterthwaite, F. E. (1946). An approximate distribution of estimates of variance components. Biometrics Bulletin, 2, 110-114. 30 / 30