outline mixed models in r using the lme4 package part 4
play

Outline Mixed models in R using the lme4 package Part 4: Inference - PowerPoint PPT Presentation

Outline Mixed models in R using the lme4 package Part 4: Inference based on profiled deviance Profiling the deviance Plotting the profiled deviance Douglas Bates Profile pairs University of Wisconsin - Madison and R Development Core Team


  1. Outline Mixed models in R using the lme4 package Part 4: Inference based on profiled deviance Profiling the deviance Plotting the profiled deviance Douglas Bates Profile pairs University of Wisconsin - Madison and R Development Core Team <Douglas.Bates@R-project.org> Profiling models with fixed-effects for covariates UseR!2010, Gaithersburg, MD, USA July 20, 2010 Likelihood ratio tests and deviance Profiling the deviance versus one parameter ◮ In section 2 we described the use of likelihood ratio tests ◮ There is a close relationship between confidence intervals and (LRTs) to compare a reduced model (say, one that omits a hypothesis tests on a single parameter. When, e.g. random-effects term) to the full model. H 0 : β 1 = β 1 , 0 versus H a : β 1 � = β 1 , 0 is not rejected at level α ◮ The test statistic in an LRT is the change in the deviance, then β 1 , 0 is in a 1 − α confidence interval on the parameter β 1 . which is negative twice the log-likelihood. ◮ For linear fixed-effects models it is possible to determine the ◮ We always use maximum likelihood fits (i.e. REML=FALSE ) to change in the deviance from fitting the full model only. For evaluate the deviance. mixed-effects models we need to fit the full model and all the ◮ In general we calculate p-values for a LRT from a χ 2 reduced models to perform the LRTs. distribution with degrees of freedom equal to the difference in ◮ In practice we fit some of them and use interpolation. The the number of parameters in the models. profile function evaluates such a “profile” of the change in ◮ The important thing to note is that a likelihood ratio test is the deviance versus each of the parameters in the model. based on fitting the model under each set of conditions.

  2. Transforming the LRT statistic Evaluating and plotting the profile ◮ The LRT statistic for a test of a fixed value of a single > pr1 <- profile(fm1M <- lmer(Yield ~ 1 + (1 | Batch), + Dyestuff, REML = FALSE)) parameter would have a χ 2 1 distribution, which is the square of > xyplot(pr1, aspect = 1.3) a standard normal. .sig01 .lsig (Intercept) ◮ If a symmetric confidence interval were appropriate for the parameter, the LRT statistic would be quadratic with respect 2 to the parameter. 1 ◮ We plot the square root of the LRT statistic because it is ζ 0 easier to assess whether the plot looks like a straight line than −1 it is to assess if it looks like a quadratic. −2 ◮ To accentuate the straight line behavior we use the signed 0 20 40 60 80 100 3.6 3.8 4.0 4.2 1500 1550 square root transformation which returns the negative square root to the left of the estimate and the positive square root to ◮ The parameters are σ b , log( σ ) ( σ is the residual standard the right. deviation) and µ . The vertical lines delimit 50%, 80%, 90%, ◮ This quantity can be compared to a standard normal. We 95% and 99% confidence intervals. write it as ζ Alternative profile plot Interpreting the univariate plots ◮ A univariate profile ζ plot is read like a normal probability plot > xyplot(pr1, aspect = 0.7, absVal = TRUE) ◮ a sigmoidal (elongated “S”-shaped) pattern like that for the (Intercept) parameter indicates overdispersion relative to 2.5 2.0 the normal distribution. (Intercept) .sig01 1.5 .lsig ◮ a bending pattern, usually flattening to the right of the | ζ | 1.0 estimate, indicates skewness of the estimator and warns us 0.5 that the confidence intervals will be asymmetric 0.0 ◮ a straight line indicates that the confidence intervals based on 0 20 40 60 80 100 3.6 3.8 4.0 4.2 1500 1550 the quantiles of the standard normal distribution are suitable > confint(pr1) ◮ Note that the only parameter providing a more-or-less straight 2.5 % 97.5 % line is σ and this plot is on the scale of log( σ ) not σ or, even .sig01 12.201753 84.06289 worse, σ 2 . .lsig 3.643622 4.21446 ◮ We should expect confidence intervals on σ 2 to be (Intercept) 1486.451500 1568.54849 asymmetric. In the simplest case of a variance estimate from > confint(pr1, level = 0.99) an i.i.d. normal sample the confidence interval is derived from 0.5 % 99.5 % quantiles of a χ 2 distribution which is quite asymmetric. .sig01 NA 113.692643 ◮ Yet many software packages provide standard errors of .lsig 3.571293 4.326347 variance component estimates as if they were meaningful. (Intercept) 1465.874011 1589.126022

  3. Profile ζ plots for log( σ ) , σ and σ 2 Profile ζ plots for log( σ 1 ) , σ 1 and σ 2 1 log ( σ 1 ) σ 1 σ 1 2 log ( σ ) σ σ 2 2 2 1 1 0 ζ 0 ζ −1 −1 −2 −2 2 3 4 0 20 40 60 80 100 0 5000 10000 3.6 3.8 4.0 4.2 40 50 60 70 2000 3000 4000 5000 ◮ For σ 1 the situation is more complicated because 0 is within ◮ We can see moderate asymmetry on the scale of σ and the range of reasonable values. The profile flattens as σ → 0 stronger asymmetry on the scale of σ 2 . which means that intervals on log( σ ) are unbounded. ◮ The issue of which of the ML or REML estimates of σ 2 are ◮ Obviously the estimator of σ 2 1 is terribly skewed yet most closer to being unbiased is a red herring. σ 2 is not a sensible software ignores this and provides standard errors on variance scale on which to evaluate the expected value of an estimator. component estimates. Profile pairs plots Profile pairs for model fm1 > splom(pr1) ◮ The information from the profile can be used to produce pairwise projections of likelihood contours. These correspond 1600 to pairwise joint confidence regions. 1550 (Intercept) ◮ Such a plot (next slide) can be somewhat confusing at first 1500 glance. 0 1 2 3 1450 ◮ Concentrate initially on the panels above the diagonal where 4.4 4.0 4.2 4.4 4.2 the axes are the parameters in the scale shown in the diagonal 4.0 .lsig panels. The contours correspond to 50%, 80%, 90%, 95% 3.8 and 99% pairwise confidence regions. 3.6 0 1 2 3 ◮ The two lines in each panel are “profile traces”, which are the 0 50 100 150 conditional estimate of one parameter given a value of the other. .sig01 0 −1 ◮ The actual interpolation of the contours is performed on the ζ −2 −3 scale which is shown in the panels below the diagonal. Scatter Plot Matrix

  4. About those p-values Hypothesis tests versus confidence intervals ◮ As mentioned earlier, hypothesis tests and confidence intervals ◮ Statisticians have been far too successful in propagating are two sides of the same coin. concepts of hypothesis testing and p-values, to the extent that ◮ For a categorical covariate, it often makes sense to ask “Is quoting p-values is essentially a requirement for publication in there a signficant effect for this factor?” which we could some disciplines. answer with a p-value. We may, in addition, want to know ◮ When models were being fit by hand calculation it was how large the effect is and how precisely we have estimated it, important to use any trick we could come up with to simplify i.e. a confidence interval. the calculation. Often the results were presented in terms of ◮ For a continuous covariate we generally want to know the the simplified calculation without reference to the original idea coefficient estimate and its precision (i.e. a confidence of comparing models. interval) in preference to a p-value for a hypothesis test. ◮ We often still present model comparisons as properties of ◮ When we have many observations and only a moderate “terms” in the model without being explicit about the number of fixed and random effects, the distribution of the underlying comparison of models with the term and without fixed-effects coefficients’ estimators is well-approximated by a the term. multivariate normal derived from the estimates, their standard ◮ The approach I recommend for assessing the importance of errors and correlations. particular terms in the fixed-effects part of the model is to fit ◮ With comparatively few observations it is worthwhile using with and without then use a likelihood ratio test (the anova profiling to check on the sensistivity of the fit to the values of function). the coefficients. Profiling a model for the classroom data Profile pairs for many parameters > pr8 <- profile(fm8 <- lmer(mathgain ~ mathkind + 8 + minority + ses + (1 | classid) + (1 | schoolid), 6 ses 4 + classroom, REML = FALSE)) 0 1 2 3 2 −10 −5 −5 2.5 (Intercept) mathkind minorityY minorityY 2.0 −10 ses 1.5 0 1 2 3 1.0 −15 0.5 −0.40 0.0 −0.45 | ζ | −0.45 260 280 300 −0.52 −0.48 −0.44 −14 −10 −6 −4 −2 2 4 6 8 mathkind 2.5 −0.50 2.0 .sig01 .sig02 0 1 2 3 .lsig 1.5 1.0 0.5 280 300 300 0.0 (Intercept) 280 4 6 8 10 12 4 6 8 10 12 3.24 3.28 3.32 3.36 0 1 2 3 260 3.35 3.30 3.35 ◮ The fixed-effects coefficient estimates (top row) have good .lsig 3.30 0 1 2 3 3.25 normal approximations (i.e. a 95% confidence intervals will be 12 8 1012 closely approximated by estimate ± 1.96 × standard error). 10 .sig02 8 6 0 1 2 3 ◮ The estimators of σ 1 , σ 2 and log( σ ) are also well 4 4 6 8 101214 approximated by a normal. If anything, the estimators of σ 1 .sig01 0 −1 −2 and σ 2 are skewed to the left rather than skewed to the right. −3 Scatter Plot Matrix

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend