Example: quiz answers

Fitting Linear Mixed-Effects Models using lme4

Fitting Linear Mixed-Effects Models using lme4 Douglas BatesUniversity of Wisconsin-MadisonMartin M chlerETH ZurichBenjamin M. BolkerMcMaster UniversitySteven C. WalkerMcMaster UniversityAbstractMaximum likelihood or restricted maximum likelihood (REML) estimates of the pa-rameters in Linear Mixed-Effects Models can be determined using thelmerfunction in thelme4package forR. As for most model - Fitting functions inR, the model is described inanlmercall by a formula, in this case including both fixed- and random -effects formula and data together determine a numerical representation of the model fromwhich the profiled deviance or the profiled REML criterion can be evaluated as a functionof some of the model parameters.

1.1. Linear mixed models Just as a linear model is described by the distribution of a vector-valued random response variable, Y, whose observed value is y obs, a linear mixed model is described by the distribution of two vector-valued random variables: Y, the response, and B, the vector of random effects.

Tags:

  Linear, Model, Mixed, Effect, Random, Mixed linear, Effects models, Linear mixed models

Information

Domain:

Source:

Link to this page:

Please notify us if you found a problem with this document:

Other abuse

Transcription of Fitting Linear Mixed-Effects Models using lme4

1 Fitting Linear Mixed-Effects Models using lme4 Douglas BatesUniversity of Wisconsin-MadisonMartin M chlerETH ZurichBenjamin M. BolkerMcMaster UniversitySteven C. WalkerMcMaster UniversityAbstractMaximum likelihood or restricted maximum likelihood (REML) estimates of the pa-rameters in Linear Mixed-Effects Models can be determined using thelmerfunction in thelme4package forR. As for most model - Fitting functions inR, the model is described inanlmercall by a formula, in this case including both fixed- and random -effects formula and data together determine a numerical representation of the model fromwhich the profiled deviance or the profiled REML criterion can be evaluated as a functionof some of the model parameters.

2 The appropriate criterion is optimized, using one ofthe constrained optimization functions inR, to provide the parameter estimates. We de-scribe the structure of the model , the steps in evaluating the profiled deviance or REML criterion, and the structure of classes or types that represents such a model . Sufficientdetail is included to allow specialization of these structures by users who wish to writefunctions to fit specialized Linear mixed Models , such as Models incorporating pedigrees orsmoothing splines, that are not easily expressible in the formula language used : sparse matrix methods, Linear mixed Models , penalized least squares, version of this manuscript has been published online in theJournal of Statistical Soft-ware, on Oct.

3 2015, with , IntroductionThelme4package (Bates, Maechler, Bolker, and Walker 2014a) forR(RCore Team 2015)provides functions to fit and analyze Linear mixed Models , generalized Linear mixed modelsand nonlinear mixed Models . In each of these names, the term mixed or, more fully, mixedeffects , denotes a model that incorporates both fixed- and random -effects terms in a linearpredictor expression from which the conditional mean of the response can be evaluated. In thispaper we describe the formulation and representation of Linear mixed Models . The techniquesused for generalized Linear and nonlinear mixed Models will be described separately, in afuture present, the main alternative tolme4for mixed modeling inRis thenlmepackage (Pin-heiro, Bates, DebRoy, Sarkar, andRCore Team 2014).

4 The main features distinguishinglme4fromnlmeare (1) more efficient Linear algebra tools, giving improved performance onlarge problems; (2) simpler syntax and more efficient implementation for Fitting Models withcrossed random effects; (3) the implementation of profile likelihood confidence intervals onrandom-effects parameters; and (4) the ability to fit generalized Linear mixed Models (al-2 Linear mixed Models with lme4though in this paper we restrict ourselves to Linear mixed Models ). The main advantage ofnlmerelative tolme4is a user interface for Fitting Models with structure in the residuals (var-ious forms of heteroscedasticity and autocorrelation) and in the random -effects covariancematrices ( , compound symmetric Models ).

5 With some extra effort, the computationalmachinery oflme4can be used to fit structured Models that the basiclmerfunction cannothandle (see AppendixA).The development of general software for Fitting mixed Models remains an active area of re-search with many open problems. Consequently, thelme4package has evolved since it wasfirst released, and continues to improve as we learn more about mixed Models . However,we recognize the need to maintain stability and backward compatibility oflme4so that itcontinues to be broadly useful. In order to maintain stability while continuing to advancemixed- model computation, we have developed several additional frameworks that draw onthe basic ideas oflme4but modify its structure or implementation in various ways.

6 Thesedescendants include theMixedModelspackage (Bates 2015) inJulia(Bezanson, Karpinski,Shah, and Edelman 2012), thelme4pureRpackage (Bates and Walker 2013) inR, and theflexLambdadevelopment branch oflme4. The current article is largely restricted to describ-ing the current stable version of thelme4package ( ), with AppendixAdescribing hooksinto the computational machinery that are designed for extension development. Thegamm4(Wood and Scheipl 2014) andblme(Dorie 2015;Chung, Rabe-Hesketh, Dorie, Gelman, andLiu 2013) packages currently make use of these goal of this article is to contrast the approach used bylme4with previous formu-lations of mixed Models . The expressions for the profiled log-likelihood and profiled REML(restricted maximum likelihood) criteria derived in similar to those presentedinBates and DebRoy(2004) and, indeed, are closely related to Henderson s mixed -modelequations (Henderson Jr.)

7 1982). Nonetheless there are subtle but important changes inthe formulation of the model and in the structure of the resulting penalized least squares(PLS) problem to be solved ( ). We derive the current version of the PLS problem( ) and contrast this result with earlier formulations ( ).This article is organized into four main sections (Sections2,3,4, and5), each of whichcorresponds to one of the four largely separate modules that compriselme4. Before describingthe details of each module, we describe the general form of the Linear mixed model underlyinglme4( ); introduce thesleepstudydata that will be used as an example throughout( ); and broadly outlinelme4 s modular structure ( ).

8 Linear mixed modelsJust as a Linear model is described by the distribution of a vector-valued random responsevariable,Y, whose observed value isyobs, a Linear mixed model is described by the distributionof two vector-valued random variables:Y, the response, andB, the vector of random a Linear model the distribution ofYis multivariate normal,Y N(X +o, 2W 1),(1)wherenis the dimension of the response vector,Wis a diagonal matrix of known priorweights, is ap-dimensional coefficient vector,Xis ann pmodel matrix, andois a vectorof known prior offset terms. The parameters of the model are the coefficients and the scaleparameter .Douglas Bates, Martin M chler, Ben Bolker, Steve Walker3In a Linear mixed model it is theconditionaldistribution ofYgivenB=bthat has such aform,(Y|B=b) N(X +Zb+o, 2W 1),(2)whereZis then qmodel matrix for theq-dimensional vector-valued random -effects variable,B, whose value we are fixing atb.

9 The unconditional distribution ofBis also multivariatenormal with mean zero and a parameterizedq qvariance-covariance matrix, ,B N(0, ):(3)As a variance-covariance matrix, must be positive semidefinite. It is convenient to expressthe model in terms of arelative covariance factor, , which is aq qmatrix, depending onthevariance-component parameter, , and generating the symmetricq qvariance-covariancematrix, , according to = 2 ,(4)where is the same scale factor as in the conditional distribution (2).Although Equations2,3, and4fully describe the class of Linear mixed Models thatlme4canfit, this terse description hides many important details. Before moving on to these details,we make a few observations: This formulation of Linear mixed Models allows for a relatively compact expression forthe profiled log-likelihood of ( , Equation35).

10 The matrices associated with random effects,Zand , typically have a sparse structurewith a sparsity pattern that encodes various model assumptions. details on these structures, and how to represent them efficiently. The interface provided bylme4 slmerfunction is slightly less general than the modeldescribed by Equations2,3, and4. To take advantage of the entire range of possibili-ties, one may use the modular functions ( AppendixA) or explore theexperimentalflexLambdabranch oflme4on ExampleThroughout our discussion oflme4, we will work with a data set on the average reaction timeper day for subjects in a sleep deprivation study (Belenkyet ). On day 0 the subjectshad their normal amount of sleep.


Related search queries