Introduction to Hierarchical Data Theory Real Example. NLME package in R. Jiang Qi. Department of Statistics Renmin University of China.

Similar documents
CO2 Handout. t(cbind(co2$type,co2$treatment,model.matrix(~type*treatment,data=co2)))

nonlinear mixed effect model fitting with nlme

lme and nlme Mixed-Effects Methods and Classes for S and S-PLUS Version 3.0 October 1998 by José C. Pinheiro and Douglas M. Bates

Randomized Block Designs with Replicates

Hierarchical Linear Models (HLM) Using R Package nlme. Interpretation. 2 = ( x 2) u 0j. e ij

These slides illustrate a few example R commands that can be useful for the analysis of repeated measures data.

Technische Universität München. Zentrum Mathematik. Linear Mixed Models Applied to Bank Branch Deposit Data

Stat 209 Lab: Linear Mixed Models in R This lab covers the Linear Mixed Models tutorial by John Fox. Lab prepared by Karen Kapur. ɛ i Normal(0, σ 2 )

13. October p. 1

STAT3401: Advanced data analysis Week 10: Models for Clustered Longitudinal Data

Coping with Additional Sources of Variation: ANCOVA and Random Effects

Outline. Mixed models in R using the lme4 package Part 3: Longitudinal data. Sleep deprivation data. Simple longitudinal data

Workshop 9.3a: Randomized block designs

Exploring Hierarchical Linear Mixed Models

Introduction and Background to Multilevel Analysis

Mixed effects models

Covariance Models (*) X i : (n i p) design matrix for fixed effects β : (p 1) regression coefficient for fixed effects

Using Non-Linear Mixed Models for Agricultural Data

A brief introduction to mixed models

Correlated Data: Linear Mixed Models with Random Intercepts

Linear Mixed Models. Appendix to An R and S-PLUS Companion to Applied Regression. John Fox. May 2002

Information. Hierarchical Models - Statistical Methods. References. Outline

20. REML Estimation of Variance Components. Copyright c 2018 (Iowa State University) 20. Statistics / 36

Introduction to Mixed Models in R

The estimation methods in Nonlinear Mixed-Effects Models (NLMM) still largely rely on numerical approximation of the likelihood function

Linear, Generalized Linear, and Mixed-Effects Models in R. Linear and Generalized Linear Models in R Topics

Stat 579: Generalized Linear Models and Extensions

Modelling finger force produced from different tasks using linear mixed models with lme R function

Random Coefficients Model Examples

Introduction to the Analysis of Hierarchical and Longitudinal Data

Workshop 9.1: Mixed effects models

Intruction to General and Generalized Linear Models

A Handbook of Statistical Analyses Using R 2nd Edition. Brian S. Everitt and Torsten Hothorn

A Handbook of Statistical Analyses Using R 2nd Edition. Brian S. Everitt and Torsten Hothorn

lme4 Luke Chang Last Revised July 16, Fitting Linear Mixed Models with a Varying Intercept

Non-independence due to Time Correlation (Chapter 14)

ON THE CONSEQUENCES OF MISSPECIFING ASSUMPTIONS CONCERNING RESIDUALS DISTRIBUTION IN A REPEATED MEASURES AND NONLINEAR MIXED MODELLING CONTEXT

Mixed models in R using the lme4 package Part 5: Generalized linear mixed models

November 2002 STA Random Effects Selection in Linear Mixed Models

Repeated measures, part 2, advanced methods

Package CorrMixed. R topics documented: August 4, Type Package

Regression, Ridge Regression, Lasso

#Alternatively we could fit a model where the rail values are levels of a factor with fixed effects

Mixed models in R using the lme4 package Part 5: Generalized linear mixed models

Approaches to Modeling Menstrual Cycle Function

Introduction to General and Generalized Linear Models

The linear mixed model: introduction and the basic model

A Handbook of Statistical Analyses Using R. Brian S. Everitt and Torsten Hothorn

Mixed models in R using the lme4 package Part 7: Generalized linear mixed models

22s:152 Applied Linear Regression. Returning to a continuous response variable Y...

STK4900/ Lecture 10. Program

Estimation and Model Selection in Mixed Effects Models Part I. Adeline Samson 1

Time-Series Regression and Generalized Least Squares in R*

22s:152 Applied Linear Regression. In matrix notation, we can write this model: Generalized Least Squares. Y = Xβ + ɛ with ɛ N n (0, Σ)

R Output for Linear Models using functions lm(), gls() & glm()

Outline. Mixed models in R using the lme4 package Part 5: Generalized linear mixed models. Parts of LMMs carried over to GLMMs

Part III: Linear mixed effects models

Neural networks (not in book)

De-mystifying random effects models

Mixed models in R using the lme4 package Part 2: Longitudinal data, modeling interactions

Non-linear mixed-effects pharmacokinetic/pharmacodynamic modelling in NLME using differential equations

Nonlinear mixed-effects models using Stata

Statistics 203: Introduction to Regression and Analysis of Variance Course review

Longitudinal + Reliability = Joint Modeling

Random and Mixed Effects Models - Part II

Simulating MLM. Paul E. Johnson 1 2. Descriptive 1 / Department of Political Science

Value Added Modeling

[y i α βx i ] 2 (2) Q = i=1

University of Minnesota Duluth

Class Notes: Week 8. Probit versus Logit Link Functions and Count Data

Overview. 1. Independence. 2. Modeling Autocorrelation. 3. Temporal Autocorrelation Example. 4. Spatial Autocorrelation Example

Lab 3: Two levels Poisson models (taken from Multilevel and Longitudinal Modeling Using Stata, p )

Information. Hierarchical Models - Statistical Methods. References. Outline

36-720: Linear Mixed Models

Lecture 22 Mixed Effects Models III Nested designs

Random and Mixed Effects Models - Part III

Linear Mixed Models. One-way layout REML. Likelihood. Another perspective. Relationship to classical ideas. Drawbacks.

Outline. Statistical inference for linear mixed models. One-way ANOVA in matrix-vector form

1. Hypothesis testing through analysis of deviance. 3. Model & variable selection - stepwise aproaches

Longitudinal Data Analysis

variability of the model, represented by σ 2 and not accounted for by Xβ

Open Problems in Mixed Models

Homework 3 - Solution

Non-Gaussian Response Variables

Paper Review: NONSTATIONARY COVARIANCE MODELS FOR GLOBAL DATA

Chapter 1 Statistical Inference

Preliminary Analysis of AASHO Road Test Flexible Pavement Data Using Linear Mix Effects Models

UNIVERSITY OF MASSACHUSETTS Department of Mathematics and Statistics Basic Exam - Applied Statistics January, 2018

Multiple Regression: Example

Generalizing the MCPMod methodology beyond normal, independent data

Additional Notes: Investigating a Random Slope. When we have fixed level-1 predictors at level 2 we show them like this:

PAPER 30 APPLIED STATISTICS

I r j Binom(m j, p j ) I L(, ; y) / exp{ y j + (x j y j ) m j log(1 + e + x j. I (, y) / L(, ; y) (, )

K. Model Diagnostics. residuals ˆɛ ij = Y ij ˆµ i N = Y ij Ȳ i semi-studentized residuals ω ij = ˆɛ ij. studentized deleted residuals ɛ ij =

COVARIANCE ANALYSIS. Rajender Parsad and V.K. Gupta I.A.S.R.I., Library Avenue, New Delhi

Hierarchical Modeling for Univariate Spatial Data

The Common Factor Model. Measurement Methods Lecture 15 Chapter 9

1 The Classic Bivariate Least Squares Model

Multivariate Time Series: VAR(p) Processes and Models

Analysis of means: Examples using package ANOM

Transcription:

Department of Statistics Renmin University of China June 7, 2010

The problem Grouped data, or Hierarchical data: correlations between subunits within subjects.

The problem Grouped data, or Hierarchical data: correlations between subunits within subjects. It arises in many areas as diverse as agriculture, biology, economics, manufacturing, and geophysics.

The problem Grouped data, or Hierarchical data: correlations between subunits within subjects. It arises in many areas as diverse as agriculture, biology, economics, manufacturing, and geophysics. The most popular means to model Grouped data is Mixed Effect Model.

The problem Grouped data, or Hierarchical data: correlations between subunits within subjects. It arises in many areas as diverse as agriculture, biology, economics, manufacturing, and geophysics. The most popular means to model Grouped data is Mixed Effect Model. Mixed Effect Model decomposes the outcome of an observation as fixed effect (population mean) and random effect (group specific), and account for the correlation structure of variations among groups.

Linear Mixed Effect Model General formulation for Linear Mixed Effect Model (LME) described by Laird and Ware (1982): y = X i β + Z i b i + ɛ i where the fixed effects β, random effects b i occur linearly in the model.

Non-linear Mixed Effect Model The non-linear mixed effect model extends from the linearity assumption to allow for more flexible function forms.

Non-linear Mixed Effect Model The non-linear mixed effect model extends from the linearity assumption to allow for more flexible function forms. At the first level, the j-th observation of i-th group is modeled as, y ij = f (t ij, φ i ) At the second level, the parameter φ i is modeled as, φ ij = A ij β + B ij b i, where b i N(0, Ψ),β is a p-dimensional vector of fixed effects and b i is a q-dimensional random effects vector associated with the i-th group.

Carbon Dioxide Uptake Data is contained in the NLME library, from a study of the cold tolerance of a C4 grass species. A total of 12 fourweek-old plants, 6 from Quebec and 6 from Mississippi, were divided into two groups: control plants that were kept at 26 degree and chilled plants that were subject to 14 h of chilling at 7 degree. Uptake rates (in mol/m2s) were measured for each plant at seven concentrations of ambient CO2 (L/L).

Carbon Dioxide Uptake Data is contained in the NLME library, from a study of the cold tolerance of a C4 grass species. A total of 12 fourweek-old plants, 6 from Quebec and 6 from Mississippi, were divided into two groups: control plants that were kept at 26 degree and chilled plants that were subject to 14 h of chilling at 7 degree. Uptake rates (in mol/m2s) were measured for each plant at seven concentrations of ambient CO2 (L/L). The objective of the experiment was to evaluate the effect of plant type and chilling treatment on the CO2 uptake.

> library(nlme) > plot(co2, outer = ~Treatment * Type, layout = c(4, 1)) Figure: CO2 uptake versus ambient CO2 by treatment and type f, 6 from Quebec and 6 from Mississippi. Half the plants of each type were chilled overnight before the measurements were taken.

An asymptotic regression model with an offset is used in Potvin et al (1990) to represent the expected CO2 uptake rate U(c) as a function of the ambient CO2 concentration c: U(c) = φ 1 {1 exp[ exp(φ 2 )(c φ 3 )]}

> x = seq(2.8, 4, 0.01) > f = function(a, b, c, x) { + return(a * (1 - exp(-exp(b) * (x - c)))) + } > y = f(1.5, 2, 3, x) > plot(x, y, type = "l", ylim = c(-2, 3)) > grid(5, 5, lwd = 2) 2 1 0 1 2 3 y 2.8 3.0 3.2 3.4 3.6 3.8 4.0 x

Necessity for Nlme When a standard non-linear model is inadequate for the data, and a mixed effect model is necessary to describe the discrepancy and correlation among the group structure?

Necessity for Nlme When a standard non-linear model is inadequate for the data, and a mixed effect model is necessary to describe the discrepancy and correlation among the group structure? Some exploratory data analysis is indispensable, and R has provide us with a function nlslist() to help us realize this goal.

Necessity for Nlme When a standard non-linear model is inadequate for the data, and a mixed effect model is necessary to describe the discrepancy and correlation among the group structure? Some exploratory data analysis is indispensable, and R has provide us with a function nlslist() to help us realize this goal. nlslist() produce separate fits of a nonlinear model for each group in a groupeddata object. The number of parameters are number of group 3.

Necessity for Nlme When a standard non-linear model is inadequate for the data, and a mixed effect model is necessary to describe the discrepancy and correlation among the group structure? Some exploratory data analysis is indispensable, and R has provide us with a function nlslist() to help us realize this goal. nlslist() produce separate fits of a nonlinear model for each group in a groupeddata object. The number of parameters are number of group 3. These separate fits by group are a powerful tool for model building with nonlinear mixed-effects models, because the individual estimates can suggest the type of random-effects structure to use.

nlslist() Introduction to Hierarchical Data A typical call to nlslist is nlslist(model, data).

nlslist() Introduction to Hierarchical Data A typical call to nlslist is nlslist(model, data). Note that nlslist() requires initial value for the model.

nlslist() Introduction to Hierarchical Data A typical call to nlslist is nlslist(model, data). Note that nlslist() requires initial value for the model. A selfstart() function, which specify the function formula and can automatically generate individual initial estimates for each group, is recommended.(see details in the book <Mixed Effects Models in S and S-Plus> by Pinheiro and Bates).

nlslist() Introduction to Hierarchical Data A typical call to nlslist is nlslist(model, data). Note that nlslist() requires initial value for the model. A selfstart() function, which specify the function formula and can automatically generate individual initial estimates for each group, is recommended.(see details in the book <Mixed Effects Models in S and S-Plus> by Pinheiro and Bates). In nlme library, C02 data has been assigned a SSasympOff.

> CO2.list <- nlslist(ssasympoff, CO2) Call: Model: uptake ~ SSasympOff(conc, Asym, lrc, c0) Plant Data: CO2 Coefficients: Asym lrc c0 Qn1 38.13978-4.380647 51.22324 Qn2 42.87169-4.665728 55.85816 Qn3 44.22800-4.486118 54.64958 Qc1 36.42873-4.861741 31.07538 Qc3 40.68370-4.945218 35.08889 Qc2 39.81950-4.463838 72.09422 Mn3 28.48285-4.591566 46.97188 Mn2 32.12827-4.466157 56.03863 Mn1 34.08481-5.064579 36.40805 Mc2 13.55520-4.560851 13.05675 Mc3 18.53506-3.465158 67.84877 Mc1 21.78723-5.142256-20.39998 Degrees of freedom: 84 total; 48 residual Residual standard error: 1.79822

intervals() function returns the information about confidence intervals of estimates. > plot(intervals(co2.list)) Figure: Confidence Intervals for parameters Asym, lrc.

nlslist Introduction to Hierarchical Data The plot of the individual confidence intervals from fm1co2.lis indicates that there is substantial between-plant variation in the parameter φ 1 = Asym, and only moderate variation among φ 2 = lrc, and φ 3 = c0.

nlslist Introduction to Hierarchical Data The plot of the individual confidence intervals from fm1co2.lis indicates that there is substantial between-plant variation in the parameter φ 1 = Asym, and only moderate variation among φ 2 = lrc, and φ 3 = c0. Fitting Nonlinear Mixed-Effects Models is approriate.

nlslist Introduction to Hierarchical Data The plot of the individual confidence intervals from fm1co2.lis indicates that there is substantial between-plant variation in the parameter φ 1 = Asym, and only moderate variation among φ 2 = lrc, and φ 3 = c0. Fitting Nonlinear Mixed-Effects Models is approriate. However, we cannot decide the structure of random effects, so we fit a full mixed effect model with all the parameters as mixed effect. The model can be written: uij = φ 1i 1 exp[ exp(φ 2i )(c ij φ 3i )] + ε ij φ 1i = β 1 + b 1i, φ 2i = β 2 + b 2i, φ 3i = β 3 + b 3i b i N(0, Ψ), ε ij N(0, σ 2 )

the object produced by nlslist() CO2.list can be used to implement a full mixed effect model. > CO2.nlme <- nlme(fm1co2.lis) > CO2.nlme Nonlinear mixed-effects model fit by maximum likelihood Model: uptake ~ SSasympOff(conc, Asym, lrc, c0)...... Random effects: Formula: list(asym ~ 1, lrc ~ 1, c0 ~ 1) Level: Plant Structure: General positive-definite, Log-Cholesky parametrization StdDev Corr Asym 9.5105877 Asym lrc lrc 0.1285620-0.162 c0 10.3742988 1.000-0.140 Residual 1.7665298

A strong correlation between c0 and lrc, suggests that only one of the random effects is needed. > CO2.nlme2 <- update(co2.nlme, random = Asym + lrc ~ 1) Nonlinear mixed-effects model fit by maximum likelihood Model: uptake ~ SSasympOff(conc, Asym, lrc, c0) Data: CO2 Log-likelihood: -202.7583 Fixed: list(asym ~ 1, lrc ~ 1, c0 ~ 1) Asym lrc c0 32.411764-4.560265 49.343573 Random effects: Formula: list(asym ~ 1, lrc ~ 1) Level: Plant Structure: General positive-definite, Log-Cholesky parametrization StdDev Corr Asym 9.6593926 Asym lrc 0.1995124-0.777 Residual 1.8079224

> anova(co2.nlme, CO2.nlme2) Model df AIC BIC loglik Test L.Ratio p-value CO2.nlme 1 10 422.6212 446.9293-201.3106 CO2.nlme2 2 7 419.5167 436.5324-202.7583 1 vs 2 2.89549 0.408

Add covariates into mixed effect model Now the random effects accommodate individual deviations from the fixed effects.

Add covariates into mixed effect model Now the random effects accommodate individual deviations from the fixed effects. The primary question of interest for the CO2 data is the effect of plant type and chilling treatment on the individual model parameters φ i.

Add covariates into mixed effect model Now the random effects accommodate individual deviations from the fixed effects. The primary question of interest for the CO2 data is the effect of plant type and chilling treatment on the individual model parameters φ i. So, we want to know whether the variation between groups can be attributed as the plant type and chilling treatment.

Add covariates into mixed effect model Now the random effects accommodate individual deviations from the fixed effects. The primary question of interest for the CO2 data is the effect of plant type and chilling treatment on the individual model parameters φ i. So, we want to know whether the variation between groups can be attributed as the plant type and chilling treatment. A plot of predicted random effects of parameters against covariates is appropriate to excavate the correlation.

> CO2.nlmeRE <- ranef(co2.nlme2, augframe = T) Asym lrc Type Treatment conc uptake Qn1 6.1715987 0.048361985 Quebec nonchilled 435 33.22857 Qn2 10.5325882-0.172842971 Quebec nonchilled 435 35.15714 Qn3 12.2180908-0.057987100 Quebec nonchilled 435 37.61429 Qc1 3.3521234-0.075586358 Quebec chilled 435 29.97143 Qc3 7.4743083-0.192416381 Quebec chilled 435 32.58571 Qc2 7.9284657-0.180323624 Quebec chilled 435 32.70000 Mn3-4.0733486 0.033449394 Mississippi nonchilled 435 24.11429 Mn2-0.1419773 0.005645756 Mississippi nonchilled 435 27.34286 Mn1 0.2406596-0.193859245 Mississippi nonchilled 435 26.40000 Mc2-18.7991627 0.319367709 Mississippi chilled 435 12.14286 Mc3-13.1168244 0.299428913 Mississippi chilled 435 17.30000 Mc1-11.7865217 0.166761922 Mississippi chilled 435 18.00000 Use the general function plot(). A onesided formula on the right-hand side, with covariates separated by the * operator, results in a dotplot of the estimated random effects versus all combinations of the unique values of the variables named in the formula.

> plot(co2.nlmere, form = ~ Type * Treatment ) Figure: Predicted random effects Virsus Covariates

Add covariates into mixed effect model The figure shows a strong relationship between the parameter asym and the covariates: Asym decreases when the plants are chilled and is higher among Quebec plants than Mississippi plants.

Add covariates into mixed effect model The figure shows a strong relationship between the parameter asym and the covariates: Asym decreases when the plants are chilled and is higher among Quebec plants than Mississippi plants. The increase in Asym from chilled to nonchilled plants is larger among Mississippi plants than Quebec plants, suggesting an interaction between Type and Treatment.

Add covariates into mixed effect model The figure shows a strong relationship between the parameter asym and the covariates: Asym decreases when the plants are chilled and is higher among Quebec plants than Mississippi plants. The increase in Asym from chilled to nonchilled plants is larger among Mississippi plants than Quebec plants, suggesting an interaction between Type and Treatment. We include both covariates in the model to explain the Asym plant-to-plant variation.

> CO2.nlme3 <- update(co2.nlme2, fixed = list(asym ~ Type * + Treatment, lrc + c0 ~ 1), start = c(32.412, 0, 0, 0, -4.5603, + 49.344)) > summary(co2.nlme3) Nonlinear mixed-effects model fit by maximum likelihood Model: uptake ~ SSasympOff(conc, Asym, lrc, c0) Data: CO2 AIC BIC loglik 393.6765 417.9847-186.8383 Random effects: Formula: list(asym ~ 1, lrc ~ 1) Level: Plant Structure: General positive-definite, Log-Cholesky parametrization StdDev Corr Asym.(Intercept) 2.9298913 As.(I) lrc 0.1637446-0.906 Residual 1.8495592

Fixed effects: list(asym ~ Type * Treatment, lrc + c0 ~ 1) Value Std.Error DF t-value Asym.(Intercept) 42.17337 1.345946 67 31.33364 Asym.TypeMississippi -11.82431 1.537304 67-7.69159 Asym.Treatmentchilled -5.23756 1.464784 67-3.57565 Asym.TypeMississippi:Treatmentchilled -4.78084 2.353801 67-2.03111 lrc -4.58925 0.084821 67-54.10511 c0 49.48163 4.456630 67 11.10293 p-value Asym.(Intercept) 0.0000 Asym.TypeMississippi 0.0000 Asym.Treatmentchilled 0.0007 Asym.TypeMississippi:Treatmentchilled 0.0462 lrc 0.0000 c0 0.0000 As.(I) Asy.TM Asym.T A.TM:T lrc Asym.TypeMississippi -0.559 Asym.Treatmentchilled -0.540 0.471 Asym.TypeMississippi:Treatmentchilled 0.252-0.640-0.622 lrc -0.540 0.056-0.016 0.132 c0-0.086-0.001-0.036 0.063 0.653

> CO2.nlmeRE3 <- ranef( CO2.nlme3, aug = T ) > plot( CO2.nlmeRE3, form = ~ Type * Treatment ) Figure: Predicted random effect Virsus Covariate

After covariates have been introduced in the model to account for intergroup variation, a natural question is which random effects are still needed.

After covariates have been introduced in the model to account for intergroup variation, a natural question is which random effects are still needed. The ratio between a random-effects standard deviation and the absolute value of the corresponding fixed effect gives an idea of the relative intergroup variability for the coefficient, which is often useful in deciding which random effects should be tested for deletion from the model.

A final assessment of the quality of the fitted model is provided by the plot of the augmented predictions. > plot( augpred(co2.nlme3, level = 0:1),layout = c(6,2) ) Figure: Predicted value of uptake by groups

Thank you for your listening!