testing for serial correlation in hierarchical linear models · tests work under both normality and...

40
Testing for serial correlation in hierarchical linear models * Javier Alejo Universidad Nacional de La Plata and CONICET Gabriel Montes-Rojas City University London, CONICET and Universitat Aut` onoma de Barcelona Walter Sosa-Escudero Universidad de San Andr´ es and CONICET October 14, 2016 Abstract This paper proposes a simple hierarchical model and a testing strategy to identify intra-cluster correlations, in the form of nested random effects and serially correlated error components. We focus on intra-cluster serial correlation at different nested levels, a topic that has not been studied in the literature before. A Neyman C (α) frame- work is used to derive LM-type tests that allow researchers to identify the appropriate level of clustering as well as the type of intra-group correlation. An extensive Monte Carlo exercise shows that the pro- posed tests perform well in finite samples and under non-Gaussian distributions. Keywords: Clusters, random effects, serial correlation. JEL Classification: I14, I18, I19 * Corresponding author: Walter Sosa-Escudero. Universidad de San Andr´ es, Vito Dumas 284 (b1644bid); Buenos Aires ; Argentina, Tel: (54-11) 4725-7024, Email: [email protected]. 1

Upload: truongxuyen

Post on 27-Jun-2018

213 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Testing for serial correlation in hierarchical linear models · tests work under both normality and non-normality, in line with the results in Honda (1985), who shows that the classical

Testing for serial correlation in hierarchicallinear models∗

Javier AlejoUniversidad Nacional de La Plata and CONICET

Gabriel Montes-RojasCity University London, CONICET and Universitat Autonoma de Barcelona

Walter Sosa-EscuderoUniversidad de San Andres and CONICET

October 14, 2016

Abstract

This paper proposes a simple hierarchical model and a testingstrategy to identify intra-cluster correlations, in the form of nestedrandom effects and serially correlated error components. We focus onintra-cluster serial correlation at different nested levels, a topic thathas not been studied in the literature before. A Neyman C(α) frame-work is used to derive LM-type tests that allow researchers to identifythe appropriate level of clustering as well as the type of intra-groupcorrelation. An extensive Monte Carlo exercise shows that the pro-posed tests perform well in finite samples and under non-Gaussiandistributions.

Keywords: Clusters, random effects, serial correlation.

JEL Classification: I14, I18, I19

∗Corresponding author: Walter Sosa-Escudero. Universidad de San Andres, VitoDumas 284 (b1644bid); Buenos Aires ; Argentina, Tel: (54-11) 4725-7024, Email:[email protected].

1

Page 2: Testing for serial correlation in hierarchical linear models · tests work under both normality and non-normality, in line with the results in Honda (1985), who shows that the classical

1 Introduction

Intra-group correlation has received considerable interest in the applied and

theoretical literature. When the data can be grouped in clusters it is the

rule rather than the exception that observations within a group are not inde-

pendent. Failure to accommodate these interactions can lead to misleading

statistical inferences, as highlighted by the influential article by Bertrand,

Duflo and Mullainathan (2004); a concern that dates back to Moulton’s

(1986) seminal paper. Consequently, the problem of what and how to clus-

ter observations is related to identifying: a) the ‘finest’ grouping structure

that leaves out more independent groups and, b) the type of intra-cluster

correlation, in the form of either random effects, serial correlation or both.

The empirical practice relies on ‘cluster robust methods’, that is, for ex-

ample, on estimates of standard errors that explicitly allow for correlations

among observations within a group. The reliability of such strategy comes at

a cost, since its consistency depends on the number of independent groups

growing large. This is problematic in the case where grouping obeys a nested

structure, as would be the case of students in a given class, in a particular

school, etc. In such scenario a safer strategy that allows for arbitrary corre-

lations at a larger group (say, at the school instead of the class level) comes

at the price of leaving fewer independent groups, rendering asymptotic ap-

proximations less reliable. The recent exhaustive survey by Cameron and

Miller (2015) points out that ‘there is no general solution to this trade-off,

and there is no formal test of the level at which to cluster. The consensus is

to be conservative and avoid bias and use bigger and more aggregated clus-

ters when possible, up to and including the point at which there is concern

about having too few clusters.” (p.321).

We are thus concerned with the appropriate level of clustering in a hi-

erarchical linear model. Proper identification of the source of intra-group

correlation is important in order to decide how to handle estimation of the

parameters of interest and its standard deviations. For example, when only

2

Page 3: Testing for serial correlation in hierarchical linear models · tests work under both normality and non-normality, in line with the results in Honda (1985), who shows that the classical

random effects cause intra-cluster correlation, feasible GLS strategies as in

Baltagi, Song and Jung (2001) might offer a simple and convenient alter-

native over cluster robust methods in the few groups scenario. The most

obvious source of intra-group correlation arises when all observations within

a group share an unobserved common factor, hence all observations in a group

are ‘equicorrelated’ in the sense that all pairwise correlations are the same.

Tests for nested random effects have been studied in Baltagi, Song and Jung

(2002b). Another source of intra-cluster correlation that has received partic-

ular consideration in Bertrand et al.’s (2004) article is time, that is, cluster

correlation induced when observations are sorted chronologically, i.e. serial

correlation. Baltagi, Song and Jung (2002a) propose tests for nested random

effects allowing for serial correlation at the ‘finest’ level only (students, in

our example).

Our paper considers intra-group correlations as a combination of ran-

dom effects and serially correlated error components in a nested, hierarchical

structure. It focuses only on the issue of different levels of serial correlation in

a hierarchical model, assuming the presence of nested random effects, a topic

that has not been analyzed in the literature. We argue that these tests are

important to understand the nature of intra-cluster correlation, since only

controlling for random-effects in general underestimates standard errors in

the presence of serial correlation, as highlighted recently by Montes-Rojas

(2016). These tests complement the results in the literature (in particular,

Baltagi, Song and Jung, 2002a,2002b). A comprehensive testing framework

for both random effects and/or serial correlation, at different nested levels,

could thus be developed based on our results and those of Baltagi et al.

articles.

In particular, our testing strategy allows for serial correlation at both hi-

erarchical levels, jointly or conditional on the presence of the other. Our

tests are based on the Lagrange Multiplier (LM) principle, constructed un-

der Gaussian error components. Our simulation experiments show that the

3

Page 4: Testing for serial correlation in hierarchical linear models · tests work under both normality and non-normality, in line with the results in Honda (1985), who shows that the classical

tests work under both normality and non-normality, in line with the results

in Honda (1985), who shows that the classical Breusch-Pagan test is robust

to alternative distributional assumptions. Consistent estimators of the pa-

rameters under the null can be obtained using an ANOVA-type analysis (in

particular see Baltagi and Li, 1991, Baltagi, Jung and Song, 2001), which are

easier to obtain than full maximum likelihood estimators. Hence we propose

Neyman’s C(α) tests, which are asymptotically equivalent to likelihood based

LM tests under any initial consistent non-maximum likelihood estimation of

the nuisance parameters.

The paper is organized as follows. The next section discusses a simple

model for grouped data and the relevant hypotheses for intra-cluster corre-

lations. Section 3 derives tests for all possible combination of cluster effects.

The reliability of the asymptotic results in the small sample context is eval-

uated in a comprehensive Monte Carlo experiment in Section 4. Section 5

presents an empirical case that illustrates how to implement the proposed

testing strategy in practice. Section 5 concludes.

2 Nested intra-group and serial correlation

Consider a hierarchical linear model with two nested cluster groups,

yijt = x′ijtβ + uijt, (1)

uijt = φi + δit + µij + νijt, (2)

for i = 1, 2, ...,M , j = 1, 2, ..., N and t = 1, 2, ..., T . To simplify notation and

derivations we will assume a balanced panel data. The model can be easily

extended to the unbalanced case following Baltagi et al. (2001,2002a,2002b)

by considering that each i group is of size Ni, and each ji intra-group cluster

has Tji observations. yijt is the outcome of interest where as in Baltagi et

al. (2001), each observation (i, j, t) will be referred to as corresponding to

individual j in group i and period t. xijt and β are 1×K and K × 1 vectors

with the observable covariates and unknown parameters, respectively.

4

Page 5: Testing for serial correlation in hierarchical linear models · tests work under both normality and non-normality, in line with the results in Honda (1985), who shows that the classical

The error structure allows for unobserved heterogeneity at the i, it, ij

and ijt levels in the form of unobserved random effects and autocorrelation

that determine the error structure uijt. φi and µij are nested random effects

at the i and ij levels, respectively. The presence of two hierarchical levels

leads to two autocorrelation patterns. Consider two nested stationary AR(1)

processes:

δit = λδit−1 + ηit, |λ| < 1,

νijt = ρνijt−1 + εijt, |ρ| < 1.

A canonical example for this model may be the following. Consider M

classrooms each with N students observed during T periods, where each

student belongs to only one classroom. Let yijt denote a learning outcome

such as GPA. Intra cluster correlation in the unobservables may occur due

to the presence of an unobserved time invariant term that is student specific

(µij, i.e. ability, family background) or classroom specific (φi, i.e. teachers’

effect). Alternatively, intra-group dependences may arise due to the time

dependence of shocks at the student or classroom levels, modeled as AR(1)

processes in our case.

The full null hypothesis of no cluster effects is the joint null of no random

effects nor serial correlation at both levels. Departures away from this joint

null are informative about two practical issues. The first one is the decision

about ‘what to cluster over’, that is, choosing the appropriate hierarchical

level up to which to allow for possible intra-group correlations. As mentioned

in the Introduction, this is a crucial question since allowing for correlations

at a bigger level leaves fewer groups of independent observations, harming

the reliability of cluster robust standard errors. Secondly, it is relevant to

know not only the level at which to cluster but also the source of intra-

group correlation, as a previous step in deciding how to handle correlations

to estimate standard errors consistently. For example, under the null of

no serial correlation, only random effects cause intra-cluster correlation, in

5

Page 6: Testing for serial correlation in hierarchical linear models · tests work under both normality and non-normality, in line with the results in Honda (1985), who shows that the classical

which case minimum norm quadratic unbiased estimates of variances can be

simply derived as in Baltagi et al. (2001) or Matyas (1996, pp. 61), which

may have a considerable advantage over cluster robust methods in the few

groups scenario, especially in terms of bias.

Consequently, in this setup, testing for cluster correlations amounts to

checking for random effects and serial correlation at different hierarchical

levels. When there is only one hierarchical level (students in different pe-

riods, for example) the setup is a standard panel data structure, hence the

problem reduces to learning the source of intra-group correlation in the form

of random effects or serial correlation. The classic Breusch and Pagan (1980)

test checks for random effects in a simple error components model. Baltagi

and Li (1991) propose a test for first order serial correlation in the same

framework. Bera, Sosa-Escudero and Yoon (2001) point out that both tests

reject their nulls incorrectly when the unwanted effect is present, that is, the

Breusch-Pagan test rejects under serial correlation even when no random ef-

fects are present and a similar symmetric concern affects the test by Baltagi

and Li (1991). Consequently, both tests might detect intra-group correlation

but are unable to identify its source. Bera, Sosa-Escudero and Yoon (2001)

propose a modification that can identify each effect separately. Finally, Inoue

and Solon (2006) propose a test for first order serial correlation after fixed

effect estimation.

When more than one hierarchical level is allowed for, Baltagi, Song and

Jung (2002b) develop LM tests for random effects in a nested error compo-

nents model, but with no serial correlation. Baltagi, Song and Jung (2002a)

allow for serial correlation although at the finest level only (i.e. ijt). By al-

lowing a full nested autocorrelation structure, the testing strategy proposed

in this paper can correctly identify the level at which cluster effects take place

and their sources, that is, whether they are caused by unobserved random

effects and/or serial correlation and, more importantly, at which hierarchical

level each of them operates.

6

Page 7: Testing for serial correlation in hierarchical linear models · tests work under both normality and non-normality, in line with the results in Honda (1985), who shows that the classical

Related strategies include Kezdi (2004), who proposes an omnibus test

based on the comparison of variance estimates with or without allowing for

cluster correlation, in the spirit of the classic White test for heteroskedastic-

ity. King and Roberts (2015) propose a similar procedure using the general-

ized information matrix. These two procedures do not detect the appropriate

level of clusters since they only check for differences with respect to the joint

null of absence of cluster correlation.

3 Tests for cluster effects

Let xi = [x′i11, ..., x′i1T , ..., x

′iN1, ..., x

′iNT ]′. We will make the following assump-

tions:

Assumption 1:

yi·, xi, φi, ηi·, µi·, εi·Mi=1 is an independent and identically distributed random

sample.

Assumption 2:

Correct mean specification: E[φi|xi] = E[ηit|xi] = E[µij|xi] = E[εijt|xi] =

0,∀i, j, t.

Assumption 3:

Variance: V ar[φi|xi] = σ2φ, V ar[δit|xi] = σ2

δ = σ2η/(1− λ2), V ar[µij|xi] = σ2

µ,

V ar[νijt|xi] = σ2ν = σ2

ε/(1− ρ2).

Assumption 4:

Nested autocovariance structure: Cov[δit, δih|xi] = λ|t−h|σ2η,∀i, h, t, |λ| < 1,

Cov[νijt, νijh|xi] = ρ|t−h|σ2ε ,∀i, j, t, h, |ρ| < 1.

Assumption 5:

Normality: φi ∼ i.i.d. N(0, σ2φ),∀i, µij ∼ i.i.d. N(0, σ2

µ),∀i, j, ηit ∼ i.i.d. N(0, σ2η),

∀i, j, t, εijt ∼ i.i.d. N(0, σ2ε ).

7

Page 8: Testing for serial correlation in hierarchical linear models · tests work under both normality and non-normality, in line with the results in Honda (1985), who shows that the classical

In matrix form the model can be written as

y = Xβ + u, (3)

where y and u are the MNT × 1 column vectors with all the dependent

variable and residual observations, and X is the MNT ×K matrix with the

observable covariates. Under the Assumptions 1 to 5, the covariance matrix

is:

Ω ≡ E(uu>) = σ2φ(IM⊗JN⊗JT )+σ2

δ (IM⊗JN⊗Vλ)+σ2µ(IM⊗IN⊗JT )+σ2

ν(IM⊗IN⊗Vρ),(4)

where I· is a · -dimensional identity matrix, J· is a · - dimensional matrix of

ones,

Vλ =

1 λ λ2 · · · λT−1

λ 1 λ · · · λT−2

λ2 λ 1 · · · λT−3

......

. . ....

...λT−1 λT−2 λT−3 · · · 1

,

Vρ =

1 ρ ρ2 · · · ρT−1

ρ 1 ρ · · · ρT−2

ρ2 ρ 1 · · · ρT−3

......

. . ....

...ρT−1 ρT−2 ρT−3 · · · 1

,

and ⊗ is the Kronecker product. We remark that in the unbalanced case

the Kronecker product needs to be changed to allow for different intra-group

sizes and all matrices are to be indexed by the corresponding group they

belong to. For future reference define the idempotent matrices J· ≡ 1· J· and

E· ≡ I· − J·, which correspond to the projection and residual projection

matrices, respectively, on a set of dummy variables for the · level.

The log likelihood function for this problem is given by

8

Page 9: Testing for serial correlation in hierarchical linear models · tests work under both normality and non-normality, in line with the results in Honda (1985), who shows that the classical

L(β, θ) ∝ −1

2ln |Ω| − 1

2u>Ω−1u, (5)

with θ = (σ2φ, σ

2η, σ

2µ, σ

2ε , ρ, λ) and Ω is given by equation (4).

Baltagi, Song and Jung (2002b) develop LM tests for random effects in a

nested error components model, assuming σ2η = λ = ρ = 0. They derive tests

for the joint null Hσ2φ,σ

0 : σ2φ = σ2

µ = 0 and for the conditional hypotheses

Hσ2µ

0 : σ2µ = 0, assuming σ2

φ ≥ 0, and Hσ2φ

0 : σ2φ = 0, assuming σ2

µ ≥ 0.

A joint test for no cluster effects in a nested random effects model and

no serial correlation at the finest level was studied by Baltagi, Song and

Jung (2002a). That is, their null hypothesis is Hσ2φ,σ

2µ,ρ

0 : σ2φ = σ2

µ = ρ = 0,

assuming σ2η = λ = 0.

In this paper we develop tests for detecting the appropriate level of au-

tocorrelation in a nested random effects structure. We propose tests for the

join null of no serial correlation at any hierarchical level (Hρ,λ0 : ρ = 0, λ = 0,

assuming σ2φ ≥ 0, σ2

η ≥ 0, σ2µ ≥ 0) and conditional tests for one type of

serial correlation given that the other is present, that is, Hρ0 : ρ = 0, as-

suming σ2φ ≥ 0, σ2

η ≥ 0, σ2µ ≥ 0, |λ| < 1 and Hλ

0 : λ = 0, assuming

σ2φ ≥ 0, σ2

η ≥ 0, σ2µ ≥ 0, |ρ| < 1. The combination of the proposed tests with

those previously proposed by Baltagi et al. (2002a,2002b) allows researchers

to fully identify the levels and the sources of intra-cluster correlation, and

decide on a appropriate strategy to handle it. For example, and as mentioned

in the Introduction, under the joint null of no serial correlation, a hierarchical

FGLS strategy produces asymptotically efficient estimates of the parameters

of interest and consistent estimates of their variances, which may have con-

siderable advantages over cluster robust methods who unnecessarily allow

intra-class correlations to vary. Also, in the case of serial correlation, the

tests identify whether it takes place at the fine or coarse level, indicating at

which level to cluster observations, which, as stressed previously, is crucial

to maximize the number of independent groups in order to make asymptotic

approximations more reliable if clustering occurs at the finer level.

9

Page 10: Testing for serial correlation in hierarchical linear models · tests work under both normality and non-normality, in line with the results in Honda (1985), who shows that the classical

Let θ ∈ Θ ⊆ Rp, where p is the dimension of θ. Using the formulas

in Harville (1977, p.326) (see also Baltagi, 2013) the score functions can be

expressed as

sr(θ) = ∂L/∂θr = −1

2tr[Ω−1∂Ω/∂θr] +

1

2[u>Ω−1(∂Ω/∂θr)Ω

−1u], (6)

for 1 ≤ r ≤ p. The information matrix J can be obtained for for 1 ≤ r, k ≤ p.

as

∂2L/∂θr∂θk =1

2tr

[Ω−1

∂2Ω

∂θr∂θk− ∂Ω

∂θrΩ−1 ∂Ω

∂θk

]+

1

2u>Ω−1

[∂Ω

∂θr∂θk− 2

∂Ω

∂θrΩ−1 ∂Ω

∂θr

]Ω−1u,

and

Jrk(θ) ≡ −E[∂2L/∂θr∂θk] =1

2tr

[Ω−1 ∂Ω

∂θrΩ−1 ∂Ω

∂θk

]. (7)

Note that

∂Ω/∂σ2φ = (IM ⊗ JN ⊗ JT ),

∂Ω/∂σ2η =

1

1− λ2(IM ⊗ JN ⊗ Vλ),

∂Ω/∂σ2µ = (IM ⊗ IN ⊗ JT ),

∂Ω/∂σ2ε =

1

1− ρ2(IM ⊗ IN ⊗ Vρ),

∂Ω/∂ρ = − 2ρσ2ε

(1− ρ2)2(IM ⊗ IN ⊗ Vρ) +

σ2ε

(1− ρ2)(IM ⊗ IN ⊗Wρ),

and

∂Ω/∂λ = −2λσ2

η

(1− λ2)2(IM ⊗ JN ⊗ Vλ) +

σ2η

(1− λ2)(IM ⊗ JN ⊗Wλ),

10

Page 11: Testing for serial correlation in hierarchical linear models · tests work under both normality and non-normality, in line with the results in Honda (1985), who shows that the classical

where Wρ = ∂Vρ/∂ρ and Wλ = ∂Vλ/∂λ. These derivative matrices have the

following form:

Wρ =

0 1 2ρ · · · (T − 1)ρT−2

1 0 1 · · · (T − 2)ρT−3

2ρ 1 0 · · · (T − 3)ρT−4

......

. . ....

...(T − 1)ρT−2 (T − 2)ρT−3 (T − 3)ρT−4 · · · 0

,and

Wλ =

0 1 2λ · · · (T − 1)λT−2

1 0 1 · · · (T − 2)λT−3

2λ 1 0 · · · (T − 3)λT−4

......

. . ....

...(T − 1)λT−2 (T − 2)λT−3 (T − 3)λT−4 · · · 0

.In order to construct LM tests, first note that the block diagonality be-

tween β and θ allow us to focus on the scores corresponding to θ only. Second,

consistent estimators of θ under the null can be obtained using an ANOVA-

type analysis (in particular see Baltagi and Li, 1991, Baltagi, Jung and Song,

2001; see also the Appendices). Hence our tests will be based on Neyman’s

C(α) principle, which produces tests that are asymptotically equivalent to

likelihood based LM tests under any initial consistent non-maximum likeli-

hood estimation of the nuisance parameters.

Consider a partition of θ = (θ′1, θ′2)′, where θ2 contains the parameters

under the corresponding null hypothesis H20 : θ2 = 0, and θ1 the nuisance

parameters that need to be estimated. In our particular case, θ will be

partitioned into either θ1 = (σ2φ, σ

2η, σ

2µ, σ

2ε )′, θ2 = (ρ, λ)′ (subsection 3.1), θ1 =

(σ2φ, σ

2η, σ

2µ, σ

2ε , ρ)′, θ2 = λ (subsection 3.2) or θ1 = (σ2

φ, σ2η, σ

2µ, σ

2ε , λ)′, θ2 = ρ

(subsection 3.3). Correspondingly, the score will be partitioned as s(θ) =

(s1(θ)′, s2(θ)′)′, and the information matrix as J (θ) =

[J11(θ) J12(θ)J21(θ) J22(θ)

].

Conditional LM statistics for H20 under maximum likelihood estimation

are defined as

11

Page 12: Testing for serial correlation in hierarchical linear models · tests work under both normality and non-normality, in line with the results in Honda (1985), who shows that the classical

LM2(θ) = s2(θ)′[J22(θ)− J21(θ)J −111 (θ)J12(θ)]−1s2(θ).

Neyman’s C(α) adjusted scores are defined as

s2·1(θ) ≡ s2(θ)− J21(θ)J −111 (θ)J12(θ)s1(θ).

Then, the Neyman’s C(α) LM statistic is

LM2·1(θ) = s2·1(θ)′[J22(θ)− J21(θ)J −111 (θ)J12(θ)]−1s2·1(θ).

A well known result is that LM2·1(θ∗)d→ χ2

dim(θ2), where θ∗ is any consistent

estimator under the corresponding null hypothesis.

3.1 LM test for serial correlation under random ef-fects: Hρ,λ

0 : ρ = 0, λ = 0, assuming σ2φ ≥ 0, σ2

η ≥0, σ2

µ ≥ 0

Consider first a test for no autocorrelation at both hierarchical levels but

allowing for a nested error components random effects structure. In this case

Ω0 = σ2φ(IM⊗JN⊗JT )+σ2

η(IM⊗JN⊗IT )+σ2µ(IM⊗IN⊗JT )+σ2

ε (IM⊗IN⊗IT ),

and

∂Ω/∂σ2φ|H0 = (IM ⊗ JN ⊗ JT ),

∂Ω/∂σ2η|H0 = (IM ⊗ JN ⊗ IT ),

∂Ω/∂σ2µ|H0 = (IM ⊗ IN ⊗ JT ),

∂Ω/∂σ2ε |H0 = (IM ⊗ IN ⊗ IT ),

∂Ω/∂ρ|H0 = σ2ε (IM ⊗ IN ⊗BT ),

∂Ω/∂λ|H0 = σ2η(IM ⊗ JN ⊗BT ),

12

Page 13: Testing for serial correlation in hierarchical linear models · tests work under both normality and non-normality, in line with the results in Honda (1985), who shows that the classical

where BT is a T ×T bi-diagonal matrix, that is, with zeros in all its elements

except bt,t−1 = 1 for t = 2, 3, ..., T and bt,t+1 = 1 for t = 1, 2, ..., (T − 1).

For this case define θ1 = (σ2φ, σ

2η, σ

2µ, σ

2ε ) and θ2 = (ρ, λ). Appendix A1

provides consistent estimates for all the elements of θ under the null hypoth-

esis, θ = (σ2φ, σ

2η, σ

2µ, σ

2ε , 0, 0).

Then a test for absence of autocorrelation at any level is constructed

by replacing in LM2·1 all unknown parameters by its consistent estimates,

using the matrix derivative formulae above and replacing the unobserved u

by ordinary least-squares (OLS) residuals u. The resulting test statistic will

be labeled as LM(ρ,λ)·σ. Computer routines to implement all the proposed

tests are available upon request.

3.2 Test for serial correlation at the group level: Hλ0 :

λ = 0, assuming σ2φ ≥ 0, σ2

η ≥ 0, σ2µ ≥ 0, |ρ| < 1

This is a test for autocorrelation at the most aggregate level. In this case we

have

Ω0 = σ2φ(IM⊗JN⊗JT )+σ2

η(IM⊗JN⊗IT )+σ2µ(IM⊗IN⊗JT )+

σ2ε

1− ρ2(IM⊗IN⊗Vρ)

Note that:

∂Ω/∂σ2φ|H0 = (IM ⊗ JN ⊗ JT ),

∂Ω/∂σ2η|H0 = (IM ⊗ JN ⊗ IT ),

∂Ω/∂σ2µ|H0 = (IM ⊗ IN ⊗ JT ),

∂Ω/∂σ2ε |H0 =

1

1− ρ2(IM ⊗ IN ⊗ Vρ),

∂Ω/∂ρ|H0 = − 2ρσ2ε

(1− ρ2)2(IM ⊗ IN ⊗ Vρ) +

σ2ε

(1− ρ2)(IM ⊗ IN ⊗Wρ),

∂Ω/∂λ|H0 = σ2η(IM ⊗ JN ⊗BT ).

13

Page 14: Testing for serial correlation in hierarchical linear models · tests work under both normality and non-normality, in line with the results in Honda (1985), who shows that the classical

Two tests will be proposed for this case. First a test for Hλ0 that im-

poses ρ = 0, that is, assuming that that there is no autocorrelation at the

aggregate level while testing for autocorrelation at the individual level. It

implicitly defines θ1 = (σ2φ, σ

2η, σ

2µ, σ

2ε ) and θ2 = λ. This is based on LM2·1

and will be defined as LMλ·σ, a marginal LM statistic. The second test is

based on consistent estimates of ρ as well as other variance parameters as

detailed in Appendix A2. For this case θ1 = (σ2φ, σ

2η, σ

2µ, σ

2ε , ρ) and θ2 = λ.

Replacing these estimates in the previous formula we obtain the conditional

test LMλ·(σ,ρ).

3.3 LM test for autocorrelation at the individual level:Hρ

0 : ρ = 0, assuming σ2φ ≥ 0, σ2

η ≥ 0, σ2µ ≥ 0, |λ| < 1

This is a test for autocorrelation at the individual level. In this case

Ω0 = σ2φ(IM⊗JN⊗JT )+

σ2η

1− λ2(IM⊗JN⊗Vλ)+σ2

µ(IM⊗IN⊗JT )+σ2ε (IM⊗IN⊗IT ),

with

∂Ω/∂σ2φ|H0 = (IM ⊗ JN ⊗ JT ),

∂Ω/∂σ2η|H0 =

1

1− λ2(IM ⊗ JN ⊗ Vλ),

∂Ω/∂σ2µ|H0 = (IM ⊗ IN ⊗ JT ),

∂Ω/∂σ2ε |H0 = (IM ⊗ IN ⊗ IT ),

∂Ω/∂ρ|H0 = σ2ε (IM ⊗ IN ⊗BT ),

and

∂Ω/∂λ|H0 = −2λσ2

η

(1− λ2)2(IM ⊗ JN ⊗ Vλ) +

σ2η

1− λ2(IM ⊗ JN ⊗Wλ).

Once again, two different tests will be derived. The first one is a test for

Hρ0 that imposes λ = 0, that is, it assumes that there is not autocorrelation at

the aggregate level while it tests for autocorrelation at the individual level. It

14

Page 15: Testing for serial correlation in hierarchical linear models · tests work under both normality and non-normality, in line with the results in Honda (1985), who shows that the classical

implicitly defines θ1 = (σ2φ, σ

2η, σ

2µ, σ

2ε ) and θ2 = ρ. This is based on LM2·1 and

will be defined as LMρ·σ, a marginal LM statistic. The second test checks for

serial correlation after having estimated λ. Appendix A3 provides consistent

estimates of θ under the null hypothesis, θ = (σ2φ, σ

2η, σ

2µ, σ

2ε , 0, λ). For this

case let θ1 = (σ2φ, σ

2η, σ

2µ, σ

2ε , λ) and θ2 = ρ. The test derived by replacing

these estimates in the formula will be labeled LMρ·(σ,λ).

4 Monte Carlo experiments

This section explores the small sample performance of the proposed tests

through a Monte Carlo experiment. We will consider the following simple

hierarchical model:

yijt = β1x1,i + β2x2,it + β3x3,ij + β4x4,ijt + uijt,

uijt = φi + δit + µij + νijt, i = 1, ...M, j = 1, 2, ..., N, t = 1, 2, ..., T, with

β1 = β2 = β3 = β4 = 1 and ρx = λx = 0.5. Let [v1,i, v2,it, v3,ij, v4,ijt]

and [φi, ηit, εijt] be independent and identically distributed vectors of N(0, 1)

random variables, and µij be N(0, 0.1). We set x1,i = v1,i and x3,ij = x1,i +

v3,ij. We consider two AR(1) structures for both the covariates and error

terms,

δit = λδit−1 + ηit, |λ| < 1,

νijt = ρνijt−1 + εijt, |ρ| < 1,

x2,it = x1,i + λxx2,it−1 + v2,it,

x2,i1 = x1,i + v2,i1,

x4,ijt = x1,i + x2,it + x3,ij + ρxx4,ijt−1 + vijt,

x4,ij1 = x1,i + x2,i1 + x3,ij + v4,ij1.

We consider different panel sizes with M ∈ 5, 10 (i.e. number of school

districts), N ∈ 5, 10 (i.e. number of schools within each district) and T =

15

Page 16: Testing for serial correlation in hierarchical linear models · tests work under both normality and non-normality, in line with the results in Honda (1985), who shows that the classical

5, 10 (i.e. number of repeated observations of the same school). Alternative

sample sizes only reinforce the results, and are not shown to save space. We

evaluate the tests using a nominal size of 0.05 and 1,000 replications. For all

data generating processes we consider the performance of the LM statistics

constructed in the previous section: (i) joint test for H0 : λ = ρ = 0,

LM(ρ,λ)·σ, (ii) tests for H0 : λ = 0, LMλ·σ, LMλ·(σ,ρ), and (iii) for H0 : ρ = 0,

LMρ·σ, LMρ·(σ,λ).

Table 1 focuses on size performance under the joint null of no serial cor-

relation at both hierarchical levels (H0 : ρ = λ = 0), and under serial correla-

tion at each hierarchical level separately (ρ = 0.2, λ = 0 and ρ = 0, λ = 0.2).

Rows correspond to rejections rates of alternative tests for different sample

sizes of the temporal dimension (T ). Columns consider alternative values for

M and N , and for alternative configurations of the serial correlation param-

eters.

[ INSERT TABLE 1 HERE ]

The simulations show that all tests have approximately correct empirical

size for all panel size dimensions, i.e. close to 5% in all cases when H0 : ρ =

λ = 0 is true. Moreover, when one correlation parameter is increased while

keeping the other constant, all tests properly aimed at detecting it correctly

increase their rejection rates.

In order to explore the power performance of the tests with more detail

results are shown graphically to avoid cluttering information. Figure 1 stud-

ies the performance of all tests when λ takes values in (0, 0.1, 0.2, ..., 0.9).

Graphs a) and b) present results when ρ = 0. Graph a) presents results for

tests checking for λ = 0 (LMλ and LMλ·ρ) while graph b) considers tests

for ρ = 0 (LMρ and LMρ·λ). The joint test LMρλ is reproduced in both

graphs for easy comparison. Graphs c) and d) present the same information,

but when ρ = 0.2. Finally, Figure 2 presents the same information but now

altering ρ in (0, 0.1, 0.2, ..., 0.9), and λ in 0, 0.2.

16

Page 17: Testing for serial correlation in hierarchical linear models · tests work under both normality and non-normality, in line with the results in Honda (1985), who shows that the classical

[ INSERT FIGURE 1 HERE ]

[ INSERT FIGURE 2 HERE ]

The experiments suggest the following results. First, and as expected,

all tests (joint, marginal and conditional) increase their power when the

alternative hypothesis they are designed to test for is activated. Second, when

only one pattern of serial correlation is present, the power ranking always

favor the marginal test, followed by the conditional and the joint test. Third,

conditional tests perform very similarly to marginal tests. Fourth, marginal

and conditional tests in one direction are not affected by the direction not

tested for, that is, for example, the presence of serial correlation at the ‘fine’

level does not affect tests for serial correlation at the ‘coarse’ level.

The role of the normality assumption is explored by repeating the exer-

cises assuming errors from the centred and standardized chi-square distribu-

tion with 1 degree of freedom, and for the standardized Student’s t distri-

bution with 5 degrees of freedom. Results are presented in Table 2, Figures

3 and 4 for the chi-square distribution and Table 3, and Figures 5 and 6

for Student’s t distribution, which are organized as the ones corresponding

to the normal case. All results are virtually unaltered, suggesting that the

Gaussian assumption is not restrictive. This is in line with the results in

Honda (1985), who shows that the classical Breusch-Pagan test is robust to

alternative distributional assumptions.

[ INSERT TABLE 2 HERE ]

[ INSERT FIGURES 3 AND 4 HERE ]

[ INSERT TABLE 3 HERE ]

[ INSERT FIGURES 5 AND 6 HERE ]

In summary, the Monte Carlo results suggest that a proper combination

of joint and marginal tests is able to identify the right pattern of serial

17

Page 18: Testing for serial correlation in hierarchical linear models · tests work under both normality and non-normality, in line with the results in Honda (1985), who shows that the classical

correlation. That is, a joint test can be used to check if serial correlation

is present, and the marginal tests to check which one is active. A ‘multiple

testing’ strategy (as in Bera and Jarque (1982)) can be implemented using a

Bonferroni approach, by rejecting the joint null if at least one of the marginal

test lies in its rejection region, where the significance level for the marginal

tests is halved to preserve the asymptotic size of the resulting joint test.

We highlight the fact that both marginal tests for serial correlation are

needed to correctly identify the relevant serial correlation pattern, which is

the main contribution of this paper. Conditional tests do not seem to offer

any practical gain over marginal ones. This is practically convenient since

the former require previous estimation of parameters of the serial correlation

process to be controlled for, that is, marginal test require simple GLS esti-

mation of variances of random effects only. Finally, the Gaussian assumption

does not seem restrictive.

5 Empirical application: educational perfor-

mance

As an empirical illustration we apply the proposed tests to study the dynam-

ics of educational performance. The Programme for International Student

Assessment (PISA) tests are administered every three years in the OECD

and a group of partner countries. The program collects harmonized infor-

mation about students and schools using a single questionnaire, thus being

comparable across countries.

Understanding the channels behind the dynamics of educational perfor-

mance is a relevant issue for policy making purposes. Following Hanushek

and Woessmann (2011), consider a stylized educational production function

model

scoreijt = α stratioijt + β gradeijt + γ pcgirlsijt + δ hiseiijt + uijt,

18

Page 19: Testing for serial correlation in hierarchical linear models · tests work under both normality and non-normality, in line with the results in Honda (1985), who shows that the classical

where the outcome variable (score) is the mean score in a standardized inter-

national reading test. Covariates include some of the usual inputs proposed

in the literature: the average students-teacher ratio (stratio), the school year

that students attend (grade), the proportion of girls at school (pcgirls) and

an index of socio-economic level (hisei). All variables are averages at the

school level. The first covariate is a proxy of the educational resources of

the school, the second is a measure of students’ experience, and the last

two variables capture differences in educational performance related to de-

mographic and economic factors. Finally, the error term uijt is assumed to

have the nested structure in Section 2. In this case i corresponds to the coun-

try, j to type of school, and t is the year in which the survey information

was collected. We use the sub-sample of the eight (M = 8) countries with

complete data in the five existing surveys: Austria, Belgium, Switzerland,

Spain, Hong Kong, Ireland, Republic of Korea, Portugal and Thailand. In

each country there are three types of schools (N = 3): Private independent,

Private government-dependent and Public. The information was collected

for 2000, 2003, 2006, 2009 and 2012 (T = 5).

Table 4 shows the results of applying the tests proposed in this paper.

At a 5% significance level, the joint null hypothesis of no autocorrelation

in both cluster groups is rejected. However, further analysis reveals that

both tests for λ = 0 rejected theis nulls, at the 1% of significance level for

LMλ·σ and 5% for LMλ·(σ,ρ). Interestingly, the tests for ρ = 0 do not provide

enough evidence to reject their nulls. Therefore, the persistence of temporal

exogenous shocks that affect educational performance seems to be related to

those affecting the country and not the type of school.

[ INSERT TABLE 4 HERE ]

Clearly a detailed study of this subject exceeds the scope of this illus-

tration. Nevertheless, the key point of the exercise is clear, which is to

highlight the usefulness of the proposed tests to isolate the relevant source of

19

Page 20: Testing for serial correlation in hierarchical linear models · tests work under both normality and non-normality, in line with the results in Honda (1985), who shows that the classical

intra-cluster correlation. The joint tests suggest correlated shocks in terms of

serially correlated errors, but the proposed testing strategy indicates that the

temporal persistence of shocks occurs only at the coarse (country) level, but

not at the finer one (school type), which has both economic and modelling

consequences.

6 Discussion and conclusion

The proposed testing framework allows for a comprehensive analysis of the

appropriate level of clustering in a multi-level nested longitudinal panel data

structure.

There are several extensions that could be considered. First, the simula-

tion exercises reveal that the estimates of the nuisance parameter is demand-

ing for moderate to large panel sizes (i.e. M = 10, N = 10, T ≥ 10). The

main problem relates to the Wallace and Hussain (1969) transformation of

OLS residuals to obtain consistent estimators of the σ parameters. In partic-

ular, the computation of the inverse of the corresponding matrices is slow in

both Stata and R, the two standard platforms used for the implementation.

Thus, alternatives as those analyzed in Baltagi, Song and Jung (2001) could

be explored to speed-up the process.

Second, the quest for the adequate level of clustering should also be an-

alyzed in terms of heteroskedasticity. As argued by Wooldridge (2012) both

serial correlation and heteroskedasticity concerns call for cluster robust stan-

dard errors, even after GLS random effects estimation. Then, an important

extension would be to adapt the results of Montes-Rojas and Sosa-Escudero

(2011) on testing for heteroskedasticity for the error-components model to

the nested structure combined here. A general testing framework to iden-

tify the appropriate level and type of clustering to be used should consider

random effects, serial correlation and heteroskedasticity jointly.

20

Page 21: Testing for serial correlation in hierarchical linear models · tests work under both normality and non-normality, in line with the results in Honda (1985), who shows that the classical

References

Angrist, J. and Pischke, J-S (2009). Mostly Harmless Econometrics: An

Empiricist’s Companion. Princeton University Press, Princeton.

Amemiya, T. (1971). “The estimation of the variances in a variance-components

model,” International Economic Review 12(1), 1-13.

Bera, A., and Jarque, C. (1982), “Model specification tests: a simultaneous

approach”, Journal of Econometrics 20, 5982.

- Baltagi, B.H. (2013) Econometric Analysis of Panel Data (fifth ed.) John

Wiley & Sons.

Baltagi, B. H., and P. X. Wu. (1999). “Unequally spaced panel data regres-

sions with AR(1) disturbances.” Econometric Theory 15, 814-823.

Baltagi, B. H., and Li. Q. (1991). “A transformation that will circumvent

the problem of autocorrelation in an error-component model .” Journal of

Econometrics 48, 385–393.

Baltagi, B. H., and Li., Q. (1995). “Testing AR(l) against MA(l) disturbances

in an error component model.” Journal of Econometrics 68, 133-151.

Baltagi, B. H., Song, S.H., and Jung, B.C. (2001). “The unbalanced nested

error component regression model.” Journal of Econometrics 101, 357-381.

Baltagi, B. H., Song, S.H., and Jung, B.C. (2002a). “LM Tests for the un-

balanced nested panel data regression model with serially correlated errors.”

Annales d’conomie et de Statistique 65, 219–268.

Baltagi, B. H., Song, S.H., and Jung, B.C. (2002b). “Simple LM tests for the

unbalanced nested error component regression model.” Econometric Reviews

21(2), 167-187.

Bera, A., Sosa-Escudero, W., and Yoon, M. (2001). “Tests for the error com-

ponent model in the presence of local misspecification.” Journal of Econo-

21

Page 22: Testing for serial correlation in hierarchical linear models · tests work under both normality and non-normality, in line with the results in Honda (1985), who shows that the classical

metrics 101, 1–23.

Bertrand, M., Duflo, E. and Mullainathan, S. (2004). “How much should we

trust differences-in-differences estimates?” Quarterly Journal of Economics

119(1), 249-275.

Breusch, T. S. and A.R. Pagan (1980). “The Lagrange multiplier test and

its applications to model specification in econometrics,” Review of Economic

Studies 47(1), 239-253.

Cameron, C., and Miller, D.L. (2015). “A practicioner’s guide to cluster-

robust inference,” Journal of Human Resources Volume 50, No. 2, pp 317-

372.

Hanushek, E.A., and Woessmann, L. (2011). The Economics of International

Differences in Educational Achievement in In E.A. Hanushek, S. Machin and

L. Woessmann (Eds.), Handbook of the Economics of Education, Vol. 3,

Amsterdam: North Holland, pp 89-200.

Harville, D.A. (1977). “Maximum likelihood approaches to variance compo-

nent estimation and to related problems,” Journal of the American Statistical

Association 72, 320–340.

Honda, Y. (1985). “Testing the error components model with non-normal

disturbances” Review of Economic Studies 52(4), 681–690.

Inoue, A., and Solon, G. (2006). “A Portmanteau test for serially correlated

errors in fixed effects models,” Econometric Theory 22, 835-851.

Kezdi, G. (2004). “Robust standard error estimation in fixed-effects panel

models,” Hungarian Statistical Review Special Number 9, 95-116.

King, G., and Roberts, M.E. (2015). “How robust standard errors expose

methodological problems they do not fix, and what to do about it,” Political

Analysis 23(2), 159-179.

Matyas, L. (1996). “Error Components Models”, chapter 4 in Matyas, L.

22

Page 23: Testing for serial correlation in hierarchical linear models · tests work under both normality and non-normality, in line with the results in Honda (1985), who shows that the classical

and Sevestre, P. (eds), The Econometrics of Panel Data, 2nd edition, Kluver

Academic Publishers, Dordrecht.

Montes-Rojas, G. (2016) “An equicorrelation Moulton factor in the presence

of arbitrary intra-cluster correlation, Economics Letters 45, 221-224.

Montes-Rojas, G., and Sosa-Escudero, W. (2011). “Robust tests for het-

eroskedasticity in the one-way error components model,” Journal of Econo-

metrics 160(2), 300–310.

Moulton, B.R. (1986). “Random group effects and the precision of regression

estimates,” Journal of Econometrics 32, 385-397.

Moulton, B.R. (1987). “Diagnostics for group effects in regression analysis,”

Journal of Business & Economic Sataistics 5(2), 275-282.

Moulton, B.R. (1990). “An illustration of a pitfall in estimating the effects

of aggregate variables in micro units,” Review of Economics and Statistics

72, 334-338.

Wallace, T.D., and Hussain, A. (1969). “The use of error components models

in combining cross section with time series data, ” Econometrica 37(1), 55-72.

Wooldridge, J.M. (2010). Econometric Analysis of Cross Section and Panel

Data (second ed.) MIT Press.

Wooldridge, J.M. (2012). VER! Es el libro? (second ed.) MIT Press.

23

Page 24: Testing for serial correlation in hierarchical linear models · tests work under both normality and non-normality, in line with the results in Honda (1985), who shows that the classical

Appendix 1: Estimates of (σ2φ, σ

2η, σ

2µ, σ

2ε ), assuming ρ =

λ = 0 using invariant quadratic forms

We consider best quadratic unbiased estimators (σ2φ, σ

2η, σ

2µ, σ

2ε ) as a simple

extension of the spectral decomposition given in Wallace and Hussain (1969)

and Baltagi (2003, pp.38-39).

Rewriting the variance covariance matrix under the null we have

Ω0 = σ2φ(IM⊗JN⊗JT )+σ2

η(IM⊗JN⊗IT )+σ2µ(IM⊗IN⊗JT )+σ2

ε (IM⊗IN⊗IT ).

Then replacing J· by its idempotent counterpart J· and using the fact

that I· = J· + E·, we obtain

Ω0 = NTσ2φ(IM ⊗ JN ⊗ JT ) +Nσ2

η(IM ⊗ JN ⊗ JT ) +Nσ2η(IM ⊗ JN ⊗ ET )

+Tσ2µ(IM ⊗ JN ⊗ JT ) + Tσ2

µ(IM ⊗ EN ⊗ JT ) + σ2ε (IM ⊗ JN ⊗ JT )

+σ2ε (IM ⊗ JN ⊗ ET ) + σ2

ε (IM ⊗ EN ⊗ JT ) + σ2ε (IM ⊗ EN ⊗ ET )

= σ21(IM ⊗ EN ⊗ ET ) + σ2

2(IM ⊗ EN ⊗ JT ) + σ23(IM ⊗ JN ⊗ ET )

+σ24(IM ⊗ JN ⊗ JT )

= σ21Q1 + σ2

2Q2 + σ23Q3 + σ2

4Q4,

where σ21 = σ2

ε , σ22 = Tσ2

µ+σ2ε , σ

23 = Nσ2

η+σ2ε , σ

24 = NTσ2

φ+Nσ2η+Tσ2

µ+σ2ε ,

Q1 = (IM ⊗ EN ⊗ ET ), Q2 = (IM ⊗ EN ⊗ JT ), Q3 = (IM ⊗ JN ⊗ ET ) and

Q4 = (IM ⊗ JN ⊗ JT ).

Thus, asymptotically unbiased and consistent estimates can be obtained

as

σ2ε =

u′Q1u

M(N − 1)(T − 1),

σ22 =

u′Q2u

M(N − 1),

24

Page 25: Testing for serial correlation in hierarchical linear models · tests work under both normality and non-normality, in line with the results in Honda (1985), who shows that the classical

σ23 =

u′Q3u

M(T − 1),

σ24 =

u′Q4u

M,

and

σ2µ =

σ22 − σ2

ε

T,

σ2η =

σ23 − σ2

ε

N,

σ2φ =

σ24 −Nσ2

η − Tσ2µ − σ2

ε

NT.

However, since u is not observed, using u = QXu, the OLS residuals where

QX = IMNT − X(X ′X)−1X ′ is the residual matrix projection, produces an

asymptotic bias. We follow Baltagi, Song and Jung (2001) adaptation for the

Wallace and Hussain (1969) estimator to our particular case. Note that if a is

a n-dimensional normal random vector and a ∼ N(0,Σ), then if A is a n×nconstant symmetric matrix, E(a′Aa) = tr(AΣ). Now, u ∼ N(0, QXΩ0QX)

and then

E(u′Q·u) = tr(Q·QXΩ0QX) =4∑

h=1

σ2htr(Q·QXQhQX).

This generates a 4× 4 system of equations from which estimates of σ2h, h =

1, 2, 3, 4 can be obtained and the variance component estimates follow.

Appendix 2: Estimates of (σ2φ, σ

2η, σ

2µ, σ

2ε , ρ), assuming λ =

0

We follow Baltagi and Wu (1999) strategy. First, we construct the within

residuals from a least-squares dummy variables fixed effects model. Consider

the regression model

yijt = x′ijtβ +M∑i=1

T∑t=1

ηitdit +M∑i=1

N∑j=1

µijdij + uijt,

25

Page 26: Testing for serial correlation in hierarchical linear models · tests work under both normality and non-normality, in line with the results in Honda (1985), who shows that the classical

where dij is a set of dummies for the NM clusters, dit is another set for

the MT interactions of time and M -group, and let uijt be the residuals.

Second we estimate ρ using the estimator

ρ =MNT

MN(T − 1)

∑Mi=1

∑Nj=1

∑Tt=2 uijtuijt−1∑M

i=1

∑Nj=1

∑Tt=1 u

2ijt

.

Third, we transform the data to eliminate the AR(1) structure. In partic-

ular, this is done for all variables yijt, xijtM,N,Ti=1,j=1,t=1 with the transformation

obtained from the pre-multiplication of the matrix

Cρ =

(1− ρ2)1/2 0 0 · · · 0 0 0−ρ 1 0 · · · 0 0 0...

......

. . ....

......

0 0 0 · · · −ρ 1 00 0 0 · · · 0 −ρ 1

.This is equivalent to the transformation

aijt =

(1− ρ2)1/2aijt if t = 1

(1− ρ2)1/2

[(1

1−ρ2

)1/2

aijt −(

ρ2

1−ρ2

)1/2

aijt−1

]if t > 1

.

Then consider the spectral decomposition and solution given in Appendix

A1 for the residuals u transformed by Cρ. In this case, following Baltagi,

Song and Jung (2002b, p256-257), we use JρT = ιρT ι′ρT/d

2, EρT = IT − JρT ,

where ιρT = (αρ, 1, 1, ..., 1)′, αρ =√

1+ρ1−ρ , d2 = ι′ρT ιρT = α2

ρ + T − 1, instead

of JT and ET and T needs to be replaced by Tρ = (1 − ρ2)(α2ρ + T − 1). In

particular, note that tr(CρC′ρ) = Tρ/T tr(IT ) = Tρ/T tr(J

ρT + Eρ

T ), a factor

that applies to the σ2η term. These are used to construct Qh, h = 1, 2, 3, 4.

Then,

26

Page 27: Testing for serial correlation in hierarchical linear models · tests work under both normality and non-normality, in line with the results in Honda (1985), who shows that the classical

tr(CρΩ0C′ρ) = NTρσ

2φtr(IM ⊗ JN ⊗ J

ρT )

+NTρ/Tσ2ηtr(IM ⊗ JN ⊗ J

ρT ) +NTρ/Tσ

2ηtr(IM ⊗ JN ⊗ E

ρT )

+Tρσ2µtr(IM ⊗ JN ⊗ J

ρT ) + Tρσ

2µtr(IM ⊗ EN ⊗ J

ρT )

+σ2ε tr(IM ⊗ JN ⊗ J

ρT ) + σ2

ε (IM ⊗ JN ⊗ EρT )

+σ2ε tr(IM ⊗ EN ⊗ JTρ) + σ2

ε tr(IM ⊗ EN ⊗ EρT )

= σ21tr(IM ⊗ EN ⊗ E

ρT ) + σ2

2tr(IM ⊗ EN ⊗ JρT ) + σ2

3tr(IM ⊗ JN ⊗ EρT )

+σ24tr(IM ⊗ JN ⊗ J

ρT )

= σ21tr(Q1) + σ2

2tr(Q2) + σ23tr(Q3) + σ2

4tr(Q4),

where σ21 = σ2

ε , σ22 = Tρσ

2µ+σ2

ε , σ23 = NTρ/Tσ

2η+σ

2ε , σ

24 = NTρσ

2φ+NTρ/Tσ

2η+

Tρσ2µ+σ2

ε , Q1 = (IM⊗EN⊗EρT ), Q2 = (IM⊗EN⊗ JρT ), Q3 = (IM⊗ JN⊗Eρ

T )

and Q4 = (IM ⊗ JN ⊗ JρT ).

Thus, asymptotically unbiased and consistent estimates can be obtained

as

σ2ε =

u′Q1u

M(N − 1)(Tρ − 1),

σ22 =

u′Q2u

M(N − 1),

σ23 =

u′Q3u

M(Tρ − 1),

σ24 =

u′Q4u

M,

and

σ2µ =

σ22 − σ2

ε

Tρ,

σ2η =

σ23 − σ2

ε

NTρ/T,

σ2φ =

σ24 −NTρ/T σ2

η − Tρσ2µ − σ2

ε

NTρ.

27

Page 28: Testing for serial correlation in hierarchical linear models · tests work under both normality and non-normality, in line with the results in Honda (1985), who shows that the classical

However, since u is not observed, we use the same procedure of Baltagi,

Song and Jung (2001) adaptation for the Wallace and Hussain (1969) as in

Appendix A1.

Appendix 3: Estimates of (σ2φ, σ

2η, σ

2µ, σ

2ε , λ), assuming ρ =

0

We follow Baltagi and Wu (1999) strategy adapted to this case. First, we

consider the regression model

yijt = x′ijtβ +M∑i=1

N∑j=1

µijdij + uijt,

where dij is a set of dummies for the NM clusters and let uijt be the

corresponding residual estimates. Second we estimate λ using the estimator

λ =MT

M(T − 1)

∑Mi=1

∑Tt=2

(1N

∑Nj=1 uijt

)(1N

∑Nj=1 uijt−1

)∑M

i=1

∑Tt=1

(1N

∑Nj=1 uijt

)2 .

Third, we transform the data to eliminate the AR(1) structure. In partic-

ular, this is done for all variables yijt, xijtM,N,Ti=1,j=1,t=1 with the transformation

Cλ =

(1− λ2)1/2 0 0 · · · 0 0 0−λ 1 0 · · · 0 0 0...

......

. . ....

......

0 0 0 · · · −λ 1 00 0 0 · · · 0 −λ 1

.This is equivalent to the transformation

aijt =

(1− λ2)1/2aijt if t = 1

(1− λ2)1/2

[(1

1−λ2

)1/2

aijt −(

λ2

1−λ2

)1/2

aijt−1

]if t > 1

.

28

Page 29: Testing for serial correlation in hierarchical linear models · tests work under both normality and non-normality, in line with the results in Honda (1985), who shows that the classical

Then follow Appendix A2, where λ replaces ρ and all the corresponding

matrices and factores are defined accordingly, i.e. JλT , EλT and Tλ. Note that

in this case multiplying by Cλ produces the following:

tr(CλΩ0C′λ) = NTλσ

2φtr(IM ⊗ JN ⊗ JλT )

+Nσ2ηtr(IM ⊗ JN ⊗ JλT ) +Nσ2

ηtr(IM ⊗ JN ⊗ EλT )

+Tλσ2µtr(IM ⊗ JN ⊗ JλT ) + Tλσ

2µtr(IM ⊗ EN ⊗ JλT )

+Tλ/Tσ2ε tr(IM ⊗ JN ⊗ JλT ) + Tλ/Tσ

2ε (IM ⊗ JN ⊗ Eλ

T )

+Tλ/Tσ2ε tr(IM ⊗ EN ⊗ JTλ) + Tλ/Tσ

2ε tr(IM ⊗ EN ⊗ Eλ

T )

= σ21tr(IM ⊗ EN ⊗ Eλ

T ) + σ22tr(IM ⊗ EN ⊗ JλT ) + σ2

3tr(IM ⊗ JN ⊗ EλT )

+σ24tr(IM ⊗ JN ⊗ JλT )

= σ21tr(Q1) + σ2

2tr(Q2) + σ23tr(Q3) + σ2

4tr(Q4),

where σ21 = Tλ/Tσ

2ε , σ

22 = Tλσ

2µ + Tλ/Tσ

2ε , σ

23 = Nσ2

η + Tλ/Tσ2ε , σ

24 =

NTλσ2φ+Nσ2

η +Tλσ2µ+Tλ/Tσ

2ε , Q1 = (IM⊗EN⊗Eλ

T ), Q2 = (IM⊗EN⊗ JλT ),

Q3 = (IM ⊗ JN ⊗ EλT ) and Q4 = (IM ⊗ JN ⊗ JλT ).

Thus, asymptotically unbiased and consistent estimates can be obtained

as

σ2ε = T/Tλ

u′Q1u

M(N − 1)(Tλ − 1),

σ22 =

u′Q2u

M(N − 1),

σ23 =

u′Q3u

M(Tλ − 1),

σ24 =

u′Q4u

M,

and

σ2µ =

σ22 − Tλ/T σ2

ε

Tλ,

29

Page 30: Testing for serial correlation in hierarchical linear models · tests work under both normality and non-normality, in line with the results in Honda (1985), who shows that the classical

σ2η =

σ23 − Tλ/T σ2

ε

N,

σ2φ =

σ24 −Nσ2

η − Tλσ2µ − Tλ/Tσ2

ε

NTλ.

However, since u is not observed, we use the same procedure of Baltagi,

Song and Jung (2001) adaptation for the Wallace and Hussain (1969) as in

Appendix A1.

30

Page 31: Testing for serial correlation in hierarchical linear models · tests work under both normality and non-normality, in line with the results in Honda (1985), who shows that the classical

Tab

le1:

Em

pir

ical

size

and

pow

erfo

rnor

mal

lydis

trib

ute

der

rors

ρ=

0,λ

=0

ρ=

0.2

=0

ρ=

0,λ

=0.2

M=

5M

=10

M=

5M

=10

M=

5M

=10

N=

5N

=10

N=

5N

=10

N=

5N

=10

N=

5N

=10

N=

5N

=10

N=

5N

=10

LM

(ρ,λ

)·σ

T 54.2%

3.6%

4.0%

5.9%

17.6%

35.5%

40.9%

68.8%

4.9%

6.4%

5.1%

9.2%

10

4.6%

4.6%

5.0%

3.5%

55.3%

85.4%

89.7%

99.7%

10.9%

20.2%

12.1%

21.4%

LMλ·σ

T 54.9%

8.3%

6.2%

9.9%

7.9%

12.5%

6.8%

13.4%

9.9%

15.0%

10.7%

16.7%

10

6.0%

7.1%

8.4%

7.2%

7.1%

8.0%

7.8%

7.7%

18.8%

30.3%

18.8%

32.0%

LMλ·(σ,ρ

)T 5

4.8%

8.9%

6.4%

9.9%

7.3%

11.7%

7.2%

12.9%

8.6%

13.0%

10.3%

16.0%

10

5.7%

6.8%

8.2%

6.7%

6.6%

8.5%

7.1%

7.1%

16.3%

25.8%

17.1%

29.8%

LMρ·σ

T 53.1%

1.0%

2.1%

2.6%

15.1%

30.9%

29.8%

57.4%

3.3%

1.5%

2.5%

3.9%

10

3.2%

4.0%

3.2%

3.2%

62.0%

89.7%

92.4%

99.8%

3.9%

5.6%

4.5%

4.3%

LMρ·(σ,λ

)T 5

2.9%

0.7%

2.1%

2.8%

13.4%

29.1%

28.8%

56.2%

3.0%

1.2%

2.5%

3.9%

10

3.3%

3.6%

3.0%

3.2%

59.6%

88.9%

92.3%

99.8%

3.6%

5.2%

4.4%

4.3%

Not

es:

Mon

teC

arlo

exp

erim

ents

bas

edon

1,00

0re

plica

tion

san

da

5%nom

inal

size

.

31

Page 32: Testing for serial correlation in hierarchical linear models · tests work under both normality and non-normality, in line with the results in Honda (1985), who shows that the classical

Tab

le2:

Em

pir

ical

size

and

pow

erfo

rch

i-sq

uar

eddis

trib

ute

der

rors

ρ=

0,λ

=0

ρ=

0.2

=0

ρ=

0,λ

=0.2

M=

5M

=10

M=

5M

=10

M=

5M

=10

N=

5N

=10

N=

5N

=10

N=

5N

=10

N=

5N

=10

N=

5N

=10

N=

5N

=10

LM

(ρ,λ

)·σ

T 55.6%

5.8%

5.1%

4.5%

18.1%

36.5%

34.9%

69.2%

7.2%

8.0%

5.9%

8.5%

10

4.9%

5.4%

4.4%

4.4%

53.9%

86.4%

89.1%

99.7%

9.9%

20.4%

12.0%

21.0%

LMλ·σ

T 56.8%

9.1%

4.9%

6.4%

7.3%

9.9%

7.0%

11.2%

9.7%

14.9%

8.4%

14.0%

10

6.6%

5.7%

4.6%

5.1%

7.2%

6.6%

5.9%

7.1%

15.9%

29.8%

16.8%

30.8%

LMλ·(σ,ρ

)T 5

7.2%

8.2%

4.9%

6.5%

5.8%

8.8%

6.5%

10.1%

9.4%

12.6%

8.0%

12.5%

10

5.8%

5.4%

4.1%

4.3%

7.0%

6.2%

6.0%

5.9%

12.6%

24.7%

14.4%

27.5%

LMρ·σ

T 52.9%

2.5%

2.1%

1.2%

15.8%

30.9%

27.8%

58.1%

3.6%

3.0%

2.8%

1.8%

10

3.1%

4.8%

2.9%

2.8%

60.9%

90.8%

91.5%

99.7%

4.2%

5.6%

3.7%

3.8%

LMρ·(σ,λ

)T 5

2.5%

1.6%

2.2%

1.3%

13.6%

28.4%

26.8%

56.6%

3.1%

2.4%

2.6%

1.7%

10

2.7%

4.4%

2.8%

2.7%

58.8%

89.6%

91.2%

99.7%

3.9%

5.1%

3.8%

3.8%

Not

es:

Mon

teC

arlo

exp

erim

ents

bas

edon

1,00

0re

plica

tion

san

da

5%nom

inal

size

.

32

Page 33: Testing for serial correlation in hierarchical linear models · tests work under both normality and non-normality, in line with the results in Honda (1985), who shows that the classical

Tab

le3:

Em

pir

ical

size

and

pow

erfo

rStudent−t 4

dis

trib

ute

der

rors

ρ=

0,λ

=0

ρ=

0.2

=0

ρ=

0,λ

=0.2

M=

5M

=10

M=

5M

=10

M=

5M

=10

N=

5N

=10

N=

5N

=10

N=

5N

=10

N=

5N

=10

N=

5N

=10

N=

5N

=10

LM

(ρ,λ

)·σ

T 55.0%

5.2%

3.4%

4.9%

18.2%

35.3%

36.0%

67.7%

6.5%

8.6%

4.9%

8.8%

10

3.8%

4.4%

4.7%

4.5%

52.8%

85.9%

90.6%

99.8%

9.2%

15.7%

13.6%

21.2%

LMλ·σ

T 55.7%

8.3%

5.5%

6.0%

7.0%

10.9%

5.9%

11.0%

11.1%

15.5%

7.5%

14.7%

10

6.3%

5.7%

6.0%

6.4%

6.3%

7.1%

6.9%

6.6%

14.9%

27.7%

18.5%

32.3%

LMλ·(σ,ρ

)T 5

6.0%

9.0%

5.5%

6.0%

6.5%

10.2%

5.5%

9.9%

9.9%

12.6%

7.3%

13.7%

10

5.5%

5.3%

5.8%

5.8%

5.5%

7.0%

6.0%

6.5%

12.0%

23.0%

17.2%

29.7%

LMρ·σ

T 52.9%

1.9%

1.4%

1.4%

16.3%

31.4%

29.2%

60.2%

4.4%

2.8%

2.4%

2.8%

10

3.8%

2.8%

4.3%

3.0%

60.1%

91.0%

92.9%

99.7%

4.4%

3.9%

4.6%

4.2%

LMρ·(σ,λ

)T 5

2.7%

1.7%

1.3%

1.3%

14.1%

28.5%

27.4%

59.1%

3.8%

2.8%

2.3%

2.5%

10

3.6%

3.2%

4.0%

3.2%

58.6%

90.5%

92.6%

99.6%

4.2%

4.0%

4.4%

4.4%

Not

es:

Mon

teC

arlo

exp

erim

ents

bas

edon

1,00

0re

plica

tion

san

da

5%nom

inal

size

.

33

Page 34: Testing for serial correlation in hierarchical linear models · tests work under both normality and non-normality, in line with the results in Honda (1985), who shows that the classical

Table 4: PISA nested autocorrelation analysis

Estimation p-valueLM(ρ,λ)·σ 6.90 0.0318

LMλ·σ 7.56 0.0060LMλ·(σ,ρ) 5.02 0.0251

LMρ·σ 0.64 0.4252LMρ·(σ,λ) 0.10 0.7491

Notes: computations with data from PISA survey.

34

Page 35: Testing for serial correlation in hierarchical linear models · tests work under both normality and non-normality, in line with the results in Honda (1985), who shows that the classical

Figure 1: Empirical size and power, normally distributed errors and λ ∈0, 0.1, 0.2, ..., 0.9

Notes: Monte Carlo experiments based on 1,000 replications and a 5%nominal size. Panel size M = 5, N = 5, T = 10.

35

Page 36: Testing for serial correlation in hierarchical linear models · tests work under both normality and non-normality, in line with the results in Honda (1985), who shows that the classical

Figure 2: Empirical size and power, normally distributed errors and ρ ∈0, 0.1, 0.2, ..., 0.9

Notes: Monte Carlo experiments based on 1,000 replications and a 5%nominal size. Panel size M = 5, N = 5, T = 10.

36

Page 37: Testing for serial correlation in hierarchical linear models · tests work under both normality and non-normality, in line with the results in Honda (1985), who shows that the classical

Figure 3: Empirical size and power, chi-squared distributed errors and λ ∈0, 0.1, 0.2, ..., 0.9

Notes: Monte Carlo experiments based on 1,000 replications and a 5%nominal size. Panel size M = 5, N = 5, T = 10.

37

Page 38: Testing for serial correlation in hierarchical linear models · tests work under both normality and non-normality, in line with the results in Honda (1985), who shows that the classical

Figure 4: Empirical size and power, chi-squared distributed errors and ρ ∈0, 0.1, 0.2, ..., 0.9

Notes: Monte Carlo experiments based on 1,000 replications and a 5%nominal size. Panel size M = 5, N = 5, T = 10.

38

Page 39: Testing for serial correlation in hierarchical linear models · tests work under both normality and non-normality, in line with the results in Honda (1985), who shows that the classical

Figure 5: Empirical size and power, Student-t distributed errors and λ ∈0, 0.1, 0.2, ..., 0.9

Notes: Monte Carlo experiments based on 1,000 replications and a 5%nominal size. Panel size M = 5, N = 5, T = 10.

39

Page 40: Testing for serial correlation in hierarchical linear models · tests work under both normality and non-normality, in line with the results in Honda (1985), who shows that the classical

Figure 6: Empirical size and power, Student-t distributed errors and ρ ∈0, 0.1, 0.2, ..., 0.9

Notes: Monte Carlo experiments based on 1,000 replications and a 5%nominal size. Panel size M = 5, N = 5, T = 10.

40