23
Background & Problem Description Implementation & Application Examples Simulation Study RLRsim: Testing for Random Effects or Nonparametric Regression Functions in Additive Mixed Models Fabian Scheipl 1 joint work with Sonja Greven 1,2 and Helmut K¨ uchenhoff 1 1 Department of Statistics, LMU M¨ unchen, Germany 2 Department of Biostatistics, Johns Hopkins University, USA useR! 2008 August 13, 2008

RLRsim: Testing for Random Effects or Nonparametric ......SAS-implementations of generalized F-test etc.. Main Results: I RLRsim: equivalent performance to bootstrap RLRT, but practically

  • Upload
    others

  • View
    5

  • Download
    0

Embed Size (px)

Citation preview

Page 1: RLRsim: Testing for Random Effects or Nonparametric ......SAS-implementations of generalized F-test etc.. Main Results: I RLRsim: equivalent performance to bootstrap RLRT, but practically

Background & Problem DescriptionImplementation & Application Examples

Simulation Study

RLRsim: Testing for Random Effects orNonparametric Regression Functions

in Additive Mixed Models

Fabian Scheipl 1

joint work with Sonja Greven 1,2 and Helmut Kuchenhoff 1

1Department of Statistics, LMU Munchen, Germany2Department of Biostatistics, Johns Hopkins University, USA

useR! 2008August 13, 2008

Page 2: RLRsim: Testing for Random Effects or Nonparametric ......SAS-implementations of generalized F-test etc.. Main Results: I RLRsim: equivalent performance to bootstrap RLRT, but practically

Background & Problem DescriptionImplementation & Application Examples

Simulation Study

Outline

Background & Problem Description

Implementation & Application Examples

Simulation Study

Page 3: RLRsim: Testing for Random Effects or Nonparametric ......SAS-implementations of generalized F-test etc.. Main Results: I RLRsim: equivalent performance to bootstrap RLRT, but practically

Background & Problem DescriptionImplementation & Application Examples

Simulation Study

Linear Mixed Models

y = Xβ +L∑

l=1

Zlbl + ε

bl ∼ NKl(0, λlσ

2εΣl), bl⊥bs ∀l 6= s

ε ∼ Nn(0, σ2ε In),

We want to test

H0,l : λl = 0 versus HA,l : λl > 0

⇔ H0,l : Var(bl) = 0 versus HA,l : Var(bl) > 0

Application examples:

I testing for equality of means between groups/subjects

I testing for linearity of a smooth function

Page 4: RLRsim: Testing for Random Effects or Nonparametric ......SAS-implementations of generalized F-test etc.. Main Results: I RLRsim: equivalent performance to bootstrap RLRT, but practically

Background & Problem DescriptionImplementation & Application Examples

Simulation Study

Linear Mixed Models

y = Xβ +L∑

l=1

Zlbl + ε

bl ∼ NKl(0, λlσ

2εΣl), bl⊥bs ∀l 6= s

ε ∼ Nn(0, σ2ε In),

We want to test

H0,l : λl = 0 versus HA,l : λl > 0

⇔ H0,l : Var(bl) = 0 versus HA,l : Var(bl) > 0

Application examples:

I testing for equality of means between groups/subjects

I testing for linearity of a smooth function

Page 5: RLRsim: Testing for Random Effects or Nonparametric ......SAS-implementations of generalized F-test etc.. Main Results: I RLRsim: equivalent performance to bootstrap RLRT, but practically

Background & Problem DescriptionImplementation & Application Examples

Simulation Study

Additive Models as Linear Mixed Models

Simple additive model:

y = f (x) + ε

f (xi ) ≈J∑

j=1

δjBj(xi )

I fit via PLS: minδ

(‖y − Bδ‖2 + 1

λδ′Pδ)

I reparametrize s.t. PLS-estimation is equivalent to(RE)ML-estimation

given λ in a LMM withI fixed effects for the unpenalized part of f (x)

I random effects (i.i.d.∼ N (0, λσ2

ε)) for the deviations from theunpenalized part

(Brumback, Ruppert, Wand, 1999; Fahrmeir, Kneib, Lang, 2004)

I In R: mgcv::gamm(), lmeSplines

Page 6: RLRsim: Testing for Random Effects or Nonparametric ......SAS-implementations of generalized F-test etc.. Main Results: I RLRsim: equivalent performance to bootstrap RLRT, but practically

Background & Problem DescriptionImplementation & Application Examples

Simulation Study

Additive Models as Linear Mixed Models

Simple additive model:

y = f (x) + ε

f (xi ) ≈J∑

j=1

δjBj(xi )

I fit via PLS: minδ

(‖y − Bδ‖2 + 1

λδ′Pδ)

I reparametrize s.t. PLS-estimation is equivalent to(RE)ML-estimation given λ in a LMM with

I fixed effects for the unpenalized part of f (x)

I random effects (i.i.d.∼ N (0, λσ2

ε)) for the deviations from theunpenalized part

(Brumback, Ruppert, Wand, 1999; Fahrmeir, Kneib, Lang, 2004)

I In R: mgcv::gamm(), lmeSplines

Page 7: RLRsim: Testing for Random Effects or Nonparametric ......SAS-implementations of generalized F-test etc.. Main Results: I RLRsim: equivalent performance to bootstrap RLRT, but practically

Background & Problem DescriptionImplementation & Application Examples

Simulation Study

Problem:Likelihood Ratio Tests for Zero Variance Components

General Case:

I y1, . . . , yni.i.d.∼ f (y |θ); θ = (θ1, . . . , θp)

I Test: H0 : θi = θ0i versus HA : θi 6= θ0

i

I LRT = 2 log L(θ|y)− 2 log L(θ0|y)n→∞∼ χ2

1

Problem for testing H0 : Var(bl) = 0Underlying assumptions for asymptotics violated:

I data in LMM not independent

I θ0 not an interior point of the parameter space Θ

Page 8: RLRsim: Testing for Random Effects or Nonparametric ......SAS-implementations of generalized F-test etc.. Main Results: I RLRsim: equivalent performance to bootstrap RLRT, but practically

Background & Problem DescriptionImplementation & Application Examples

Simulation Study

Problem:Likelihood Ratio Tests for Zero Variance Components

General Case:

I y1, . . . , yni.i.d.∼ f (y |θ); θ = (θ1, . . . , θp)

I Test: H0 : θi = θ0i versus HA : θi 6= θ0

i

I LRT = 2 log L(θ|y)− 2 log L(θ0|y)n→∞∼ χ2

1

Problem for testing H0 : Var(bl) = 0Underlying assumptions for asymptotics violated:

I data in LMM not independent

I θ0 not an interior point of the parameter space Θ

Page 9: RLRsim: Testing for Random Effects or Nonparametric ......SAS-implementations of generalized F-test etc.. Main Results: I RLRsim: equivalent performance to bootstrap RLRT, but practically

Background & Problem DescriptionImplementation & Application Examples

Simulation Study

Previous Results:

I Stram, Lee (1994); Self, Liang (1987): for i. i. d.observations/subvectors, testing on the boundary of Θ:LRT

as∼ 0.5δ0 : 0.5χ21

I Crainiceanu, Ruppert (2004):I Stram/Lee mixture very conservative for non-i. i. d. data, small

samplesI LRT often with large point mass at zero, restricted LRT

(RLRT ) more usefulI derive exact finite sample distributions of LRT and RLRT in

LMMs with one variance component

I Greven et al. (2007):pseudo-ML arguments to justify application of results inCrainiceanu, Ruppert (2004) to models with multiple variancecomponents

Page 10: RLRsim: Testing for Random Effects or Nonparametric ......SAS-implementations of generalized F-test etc.. Main Results: I RLRsim: equivalent performance to bootstrap RLRT, but practically

Background & Problem DescriptionImplementation & Application Examples

Simulation Study

Previous Results:

I Stram, Lee (1994); Self, Liang (1987): for i. i. d.observations/subvectors, testing on the boundary of Θ:LRT

as∼ 0.5δ0 : 0.5χ21

I Crainiceanu, Ruppert (2004):I Stram/Lee mixture very conservative for non-i. i. d. data, small

samplesI LRT often with large point mass at zero, restricted LRT

(RLRT ) more usefulI derive exact finite sample distributions of LRT and RLRT in

LMMs with one variance component

I Greven et al. (2007):pseudo-ML arguments to justify application of results inCrainiceanu, Ruppert (2004) to models with multiple variancecomponents

Page 11: RLRsim: Testing for Random Effects or Nonparametric ......SAS-implementations of generalized F-test etc.. Main Results: I RLRsim: equivalent performance to bootstrap RLRT, but practically

Background & Problem DescriptionImplementation & Application Examples

Simulation Study

Previous Results:

I Stram, Lee (1994); Self, Liang (1987): for i. i. d.observations/subvectors, testing on the boundary of Θ:LRT

as∼ 0.5δ0 : 0.5χ21

I Crainiceanu, Ruppert (2004):I Stram/Lee mixture very conservative for non-i. i. d. data, small

samplesI LRT often with large point mass at zero, restricted LRT

(RLRT ) more usefulI derive exact finite sample distributions of LRT and RLRT in

LMMs with one variance component

I Greven et al. (2007):pseudo-ML arguments to justify application of results inCrainiceanu, Ruppert (2004) to models with multiple variancecomponents

Page 12: RLRsim: Testing for Random Effects or Nonparametric ......SAS-implementations of generalized F-test etc.. Main Results: I RLRsim: equivalent performance to bootstrap RLRT, but practically

Background & Problem DescriptionImplementation & Application Examples

Simulation Study

RLRsim: Algorithm

RLRTn ∼ supλ≥0

((n − p) log

(1 +

Nn(λ)

Dn(λ)

)−

K∑k=1

log (1 + λµk,n)

),

Nn(λ) =K∑

k=1

λµk,n

1 + λµk,nw2

k ; Dn(λ) =K∑

k=1

w2k

1 + λµk,n+

n−p∑k=K+1

w2k

wk ∼ N (0, 1); µ: eigenvalues of Σ1/2Z′(In − X(X′X)−1X)ZΣ1/2

Rapid simulation from this distribution:I do eigenvalue decomposition to get µI repeat:

I draw (K + 1) χ2 variatesI one-dimensional maximization in λ (via grid search)

→ computational cost depends on K , not n→ implemented in C ⇒ quasi-instantaneous→ easy extension to models with L > 1

Page 13: RLRsim: Testing for Random Effects or Nonparametric ......SAS-implementations of generalized F-test etc.. Main Results: I RLRsim: equivalent performance to bootstrap RLRT, but practically

Background & Problem DescriptionImplementation & Application Examples

Simulation Study

RLRsim: Algorithm

RLRTn ∼ supλ≥0

((n − p) log

(1 +

Nn(λ)

Dn(λ)

)−

K∑k=1

log (1 + λµk,n)

),

Nn(λ) =K∑

k=1

λµk,n

1 + λµk,nw2

k ; Dn(λ) =K∑

k=1

w2k

1 + λµk,n+

n−p∑k=K+1

w2k

wk ∼ N (0, 1); µ: eigenvalues of Σ1/2Z′(In − X(X′X)−1X)ZΣ1/2

Rapid simulation from this distribution:I do eigenvalue decomposition to get µI repeat:

I draw (K + 1) χ2 variatesI one-dimensional maximization in λ (via grid search)

→ computational cost depends on K , not n→ implemented in C ⇒ quasi-instantaneous→ easy extension to models with L > 1

Page 14: RLRsim: Testing for Random Effects or Nonparametric ......SAS-implementations of generalized F-test etc.. Main Results: I RLRsim: equivalent performance to bootstrap RLRT, but practically

Background & Problem DescriptionImplementation & Application Examples

Simulation Study

RLRsim: Algorithm

RLRTn ∼ supλ≥0

((n − p) log

(1 +

Nn(λ)

Dn(λ)

)−

K∑k=1

log (1 + λµk,n)

),

Nn(λ) =K∑

k=1

λµk,n

1 + λµk,nw2

k ; Dn(λ) =K∑

k=1

w2k

1 + λµk,n+

n−p∑k=K+1

w2k

wk ∼ N (0, 1); µ: eigenvalues of Σ1/2Z′(In − X(X′X)−1X)ZΣ1/2

Rapid simulation from this distribution:I do eigenvalue decomposition to get µI repeat:

I draw (K + 1) χ2 variatesI one-dimensional maximization in λ (via grid search)

→ computational cost depends on K , not n→ implemented in C ⇒ quasi-instantaneous→ easy extension to models with L > 1

Page 15: RLRsim: Testing for Random Effects or Nonparametric ......SAS-implementations of generalized F-test etc.. Main Results: I RLRsim: equivalent performance to bootstrap RLRT, but practically

Background & Problem DescriptionImplementation & Application Examples

Simulation Study

Example: One Variance Component

Test for random intercept (nlme::lme):

> m0 <- lme(distance ~ age + Sex, data = Orthodont, random = ~ 1)

> system.time(print( exactRLRT(m0) ), gcFirst=T)

simulated finite sample distribution of RLRT.

(p-value based on 10000 simulated values)

RLRT = 47.0114, p-value < 2.2e-16

user system elapsed

0.42 0.00 0.42

> system.time(simulate.lme(m0,nsim=10000,method='REML'), gcFirst=T)

user system elapsed

55.00 0.03 55.48

Page 16: RLRsim: Testing for Random Effects or Nonparametric ......SAS-implementations of generalized F-test etc.. Main Results: I RLRsim: equivalent performance to bootstrap RLRT, but practically

Background & Problem DescriptionImplementation & Application Examples

Simulation Study

Example: Two Variance Components

Test for random slope with nuisance random intercept(lme4::lmer):

> m0 <- lmer(distance ~ age + Sex + (1|Subject), data = Orthodont)

> mA <- update(m0, .~. + (0 + age|Subject))

> mSlope <- update(mA, .~. - (1|Subject))

> exactRLRT(mSlope, mA, m0)

simulated finite sample distribution of RLRT.

(p-value based on 10000 simulated values)

RLRT = 0.8672, p-value = 0.1603

Page 17: RLRsim: Testing for Random Effects or Nonparametric ......SAS-implementations of generalized F-test etc.. Main Results: I RLRsim: equivalent performance to bootstrap RLRT, but practically

Background & Problem DescriptionImplementation & Application Examples

Simulation Study

Example: Testing for Linearity of a Smooth Function

> library(mgcv); data(trees)

> m1 <- gamm(I(log(Volume)) ~ Height + s(Girth, m = 2),

+ data = trees)$lme

8 10 12 14 16 18 20

−0.

50.

00.

51.

0

Girth

s(G

irth,

2.72

)

s(Girth, m=2)

Significant deviations from linearity?

Page 18: RLRsim: Testing for Random Effects or Nonparametric ......SAS-implementations of generalized F-test etc.. Main Results: I RLRsim: equivalent performance to bootstrap RLRT, but practically

Background & Problem DescriptionImplementation & Application Examples

Simulation Study

Example: Testing for Linearity of a Smooth Function

> library(mgcv); data(trees)

> m1 <- gamm(I(log(Volume)) ~ Height + s(Girth, m = 2),

+ data = trees)$lme

> exactRLRT(ml)

simulated finite sample distribution of RLRT.

(p-value based on 10000 simulated values)

RLRT = 5.4561, p-value = 0.0052

Page 19: RLRsim: Testing for Random Effects or Nonparametric ......SAS-implementations of generalized F-test etc.. Main Results: I RLRsim: equivalent performance to bootstrap RLRT, but practically

Background & Problem DescriptionImplementation & Application Examples

Simulation Study

Simulation Study: Settings

H0 tested VC nuisance VCsequality of group means random intercept -

random slopeuni-/bivariate smooth

equality of group trends random slope random intercept

no effect / linearity univariate smooth -random intercept

uni-/bivariate smooth

additivity bivariate smooth 2 univariate smooths

Goal: compare size & power of tests for zero variance components

I sample sizes n = 50, 100, 500

I mildly unbalanced group sizes for K = 5, 20

I details: Scheipl, Greven, Kuchenhoff (2007)

Page 20: RLRsim: Testing for Random Effects or Nonparametric ......SAS-implementations of generalized F-test etc.. Main Results: I RLRsim: equivalent performance to bootstrap RLRT, but practically

Background & Problem DescriptionImplementation & Application Examples

Simulation Study

Simulation studyCompared Tests:

I RLR-type tests:RLRsim, parametric bootstrap, 0.5δ0 : 0.5χ2

1

I F -type tests:bootstrap F -type statistics, mgcv’s approximate F -test,SAS-implementations of generalized F -test etc..

Main Results:

I RLRsim: equivalent performance to bootstrap RLRT, butpractically instantaneous

I χ2-mixture approximation for RLRT: always conservative,lower than nominal size & reduced power

I bootstrap RLRT, bootstrap F -type statistics similar

I F -test from mgcv: similar power as χ2-mixture, occasionallyseriously anti-conservative

Page 21: RLRsim: Testing for Random Effects or Nonparametric ......SAS-implementations of generalized F-test etc.. Main Results: I RLRsim: equivalent performance to bootstrap RLRT, but practically

Background & Problem DescriptionImplementation & Application Examples

Simulation Study

Simulation studyCompared Tests:

I RLR-type tests:RLRsim, parametric bootstrap, 0.5δ0 : 0.5χ2

1

I F -type tests:bootstrap F -type statistics, mgcv’s approximate F -test,SAS-implementations of generalized F -test etc..

Main Results:

I RLRsim: equivalent performance to bootstrap RLRT, butpractically instantaneous

I χ2-mixture approximation for RLRT: always conservative,lower than nominal size & reduced power

I bootstrap RLRT, bootstrap F -type statistics similar

I F -test from mgcv: similar power as χ2-mixture, occasionallyseriously anti-conservative

Page 22: RLRsim: Testing for Random Effects or Nonparametric ......SAS-implementations of generalized F-test etc.. Main Results: I RLRsim: equivalent performance to bootstrap RLRT, but practically

Background & Problem DescriptionImplementation & Application Examples

Simulation Study

Conclusion

I conventional RLRTs for Var(Random Effect) = 0 are broken,but not beyond repair.

⇒ RLRsimI is a rapid, more powerful alternative that performs as well as a

parametric bootstrap.I has a convenient interface for models fit with nlme::lme or

lme4::lmer.I Current limitations: no correlated random effects, no serial

correlation, only Gaussian responses.

Page 23: RLRsim: Testing for Random Effects or Nonparametric ......SAS-implementations of generalized F-test etc.. Main Results: I RLRsim: equivalent performance to bootstrap RLRT, but practically

Background & Problem DescriptionImplementation & Application Examples

Simulation Study

Further Reading:

I Crainiceanu, C. and Ruppert, D. (2004) Likelihood ratio testsin linear mixed models with one variance component,JRSS-B, 66(1), 165–185.

I Greven, S., Crainiceanu, C. M., Kuchenhoff, H. and Peters, A.(2008) Restricted Likelihood Ratio Testing for Zero VarianceComponents in Linear Mixed Models,JCGS, to appear.

I Scheipl, F., Greven, S., and Kuchenhoff, H. (2008) Size andpower of tests for a zero random effect variance or polynomialregression in additive and linear mixed models,CSDA, 52(7), 3283–3299.