Analysis of means: Examples using package ANOM

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

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

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

36-463/663: Multilevel & Hierarchical Models

Generalized Linear. Mixed Models. Methods and Applications. Modern Concepts, Walter W. Stroup. Texts in Statistical Science.

Generalized linear models

Sleep data, two drugs Ch13.xls

McGill University. Faculty of Science. Department of Mathematics and Statistics. Statistics Part A Comprehensive Exam Methodology Paper

Aedes egg laying behavior Erika Mudrak, CSCU November 7, 2018

Randomized Block Designs with Replicates

Statistical Methods III Statistics 212. Problem Set 2 - Answer Key

The First Thing You Ever Do When Receive a Set of Data Is

Repeated Measures ANOVA Multivariate ANOVA and Their Relationship to Linear Mixed Models

Hierarchical Generalized Linear Models. ERSH 8990 REMS Seminar on HLM Last Lecture!

Introduction to Mixed Models in R

Checking model assumptions with regression diagnostics

Fitting mixed models in R

Chapter 4 Multi-factor Treatment Designs with Multiple Error Terms 93

Preface Introduction to Statistics and Data Analysis Overview: Statistical Inference, Samples, Populations, and Experimental Design The Role of

R-squared for Bayesian regression models

Overdispersion Workshop in generalized linear models Uppsala, June 11-12, Outline. Overdispersion

WU Weiterbildung. Linear Mixed Models

Introducing Generalized Linear Models: Logistic Regression

Ron Heck, Fall Week 8: Introducing Generalized Linear Models: Logistic Regression 1 (Replaces prior revision dated October 20, 2011)

Introduction to Within-Person Analysis and RM ANOVA

Chapter 1 Statistical Inference

Coping with Additional Sources of Variation: ANCOVA and Random Effects

Experimental Design and Data Analysis for Biologists

Stat 579: Generalized Linear Models and Extensions

1 Introduction. 2 Example

Ch. 7: Estimates and Sample Sizes

General Principles Within-Cases Factors Only Within and Between. Within Cases ANOVA. Part One

Correlated Data: Linear Mixed Models with Random Intercepts

Tento projekt je spolufinancován Evropským sociálním fondem a Státním rozpočtem ČR InoBio CZ.1.07/2.2.00/

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

Regression models. Generalized linear models in R. Normal regression models are not always appropriate. Generalized linear models. Examples.

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

Step-down FDR Procedures for Large Numbers of Hypotheses

Longitudinal Data Analysis of Health Outcomes

Non-Gaussian Response Variables

psyc3010 lecture 2 factorial between-ps ANOVA I: omnibus tests

Package HGLMMM for Hierarchical Generalized Linear Models

A (Brief) Introduction to Crossed Random Effects Models for Repeated Measures Data

Supplemental Materials. In the main text, we recommend graphing physiological values for individual dyad

Introduction to Crossover Trials

Notes for week 4 (part 2)

Introduction to Random Effects of Time and Model Estimation

Poisson Regression. James H. Steiger. Department of Psychology and Human Development Vanderbilt University

An Introduction to Multilevel Models. PSYC 943 (930): Fundamentals of Multivariate Modeling Lecture 25: December 7, 2012

Structural Nested Mean Models for Assessing Time-Varying Effect Moderation. Daniel Almirall

Lecture 14: Introduction to Poisson Regression

Modelling counts. Lecture 14: Introduction to Poisson Regression. Overview

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

PAPER 218 STATISTICAL LEARNING IN PRACTICE

STAT 501 EXAM I NAME Spring 1999

Review: what is a linear model. Y = β 0 + β 1 X 1 + β 2 X 2 + A model of the following form:

SPH 247 Statistical Analysis of Laboratory Data

Reaction Days

Generalized Linear Models for Non-Normal Data

Multinomial Logistic Regression Models

Normal distribution We have a random sample from N(m, υ). The sample mean is Ȳ and the corrected sum of squares is S yy. After some simplification,

Parametric Empirical Bayes Methods for Microarrays

Describing Change over Time: Adding Linear Trends

Multivariable Fractional Polynomials

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

Small Area Estimation in R with Application to Mexican Income Data

Sociology 6Z03 Review II

Statistics 572 Semester Review

Modeling Overdispersion

The linear mixed model: introduction and the basic model

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

Introduction and Background to Multilevel Analysis

APPENDICES TO Protest Movements and Citizen Discontent. Appendix A: Question Wordings

Generalised linear models. Response variable can take a number of different formats

Genetic Networks. Korbinian Strimmer. Seminar: Statistical Analysis of RNA-Seq Data 19 June IMISE, Universität Leipzig

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

Logistic Regression. James H. Steiger. Department of Psychology and Human Development Vanderbilt University

Poisson regression: Further topics

Multivariable Fractional Polynomials

One-Way Repeated Measures Contrasts

Mixed effects models

Compare Predicted Counts between Groups of Zero Truncated Poisson Regression Model based on Recycled Predictions Method

Review of CLDP 944: Multilevel Models for Longitudinal Data

STAT 501 Assignment 2 NAME Spring Chapter 5, and Sections in Johnson & Wichern.

Summary and discussion of: Controlling the False Discovery Rate: A Practical and Powerful Approach to Multiple Testing

Kruskal-Wallis and Friedman type tests for. nested effects in hierarchical designs 1

Review. Timothy Hanson. Department of Statistics, University of South Carolina. Stat 770: Categorical Data Analysis

Repeated measures, part 1, simple methods

FERMENTATION BATCH PROCESS MONITORING BY STEP-BY-STEP ADAPTIVE MPCA. Ning He, Lei Xie, Shu-qing Wang, Jian-ming Zhang

Statistical Distribution Assumptions of General Linear Models

High-Throughput Sequencing Course

Ron Heck, Fall Week 3: Notes Building a Two-Level Model

An Introduction to Path Analysis

STAT 302 Introduction to Probability Learning Outcomes. Textbook: A First Course in Probability by Sheldon Ross, 8 th ed.

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

Propensity Score Weighting with Multilevel Data

Math Review Sheet, Fall 2008

Generalized Linear Models

Unbalanced Data in Factorials Types I, II, III SS Part 1

4.1. Introduction: Comparing Means

Transcription:

Analysis of means: Examples using package ANOM Philip Pallmann February 15, 2016 Contents 1 Introduction 1 2 ANOM in a two-way layout 2 3 ANOM with (overdispersed) count data 4 4 ANOM with linear mixed-effects models 6 4.1 Using nlme............................................ 6 4.2 Using lme4............................................ 6 4.3 Ignoring the repeated structure................................. 8 1 Introduction The analysis of means (ANOM) is a graphical method for presenting multiple group comparisons with an overall mean ( grand mean ). Ever since Ott published his pioneering paper (Ott 1967), ANOM has enjoyed great popularity in quality control, and piles of extensions and applications have been discussed. A nice SAS-based overview of ANOM is given in the book by Nelson et al. (2005). The purpose of this vignette is to illustrate how R s broad functionality can be exploited for ANOMtype data analysis. We have already elaborated on various real-world data applications of ANOM in the tutorial publication accompanying this package (Pallmann and Hothorn 2016). In the following we want to delve into some further non-trivial data scenarios: ANOM with more than one factor e.g., in a two-way layout (Section 2), ANOM with non-normal data e.g., (overdispersed) Poisson count data using generalized linear models (Section 3), ANOM with correlated data in clustered, nested, hierarchical, or multilevel structures e.g., repeated measures with multiple raters using linear mixed-effects models (Section 4). All comparisons are performed at a familywise type I error level of 5%. 1

17 p=0.999 p=0.837 p<0.001 p=0.059 p=0.051 p=0.986 Hemoglobin Level 16 15 14 13 12 n=5 n=5 n=5 n=5 n=5 n=5 Chem:1 Chem:2 Chem:3 Rdtn:1 Rdtn:2 Rdtn:3 Treatment Figure 1: ANOM decision chart for the hemoglobin data based one a pseudo-one-way analysis. 2 ANOM in a two-way layout Nelson et al. (2005) describe a trial on 30 male cancer patients in a balanced complete two-way layout. Each patient was treated with one therapy (chemo or radiation) and one out of three drugs (named 1, 2, and 3), and the level of hemoglobin was measured afterwards. library(anom) data(hemoglobin) The six drug-therapy combinations may be compared in a simplified pseudo-one-way layout where the new factor s levels are the combinations of therapy and drug. hemoglobin$the <- as.factor(abbreviate(hemoglobin$therapy)) hemoglobin$td <- with(hemoglobin, the:drug) hemodel <- lm(level ~ td, hemoglobin) he <- glht(hemodel, mcp(td="grandmean"), alternative="two.sided") ANOM(he, xlabel="treatment", ylabel="hemoglobin Level") We find that chemotherapy together with drug 3 leads to hemoglobin levels that are significantly above the grand mean (Figure 1). On the contrary, if radiation therapy is combined with either drug 1 or 2, the levels of hemoglobin are very close to the lower decision limit. Acting on the assumption that the two treatment factors therapy and drug do not interact, we may also investigate the marginal drug effects across both therapies. An analysis of variance suggests that the interaction effect is negligible. 2

15 p=0.146 p=0.34 p=0.006 Hemoglobin Level 14 13 n=10 n=10 n=10 1 2 3 Drug Figure 2: ANOM decision chart for the hemoglobin data based on a two-way analysis. hemodel2 <- lm(level ~ drug * therapy, hemoglobin) anova(hemodel2) Analysis of Variance Table Response: level Df Sum Sq Mean Sq F value Pr(>F) drug 2 23.369 11.684 5.5385 0.0105262 * therapy 1 44.408 44.408 21.0499 0.0001184 *** drug:therapy 2 2.245 1.122 0.5320 0.5941993 Residuals 24 50.632 2.110 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 This result clears the way for making reasonable inferences for drugs pooled over both types of therapy. hemodel3 <- lm(level ~ drug + therapy, hemoglobin) he3 <- glht(hemodel3, mcp(drug="grandmean"), alternative="two.sided") ANOM(he3, xlabel="drug", ylabel="hemoglobin Level") Figure 2 shows that drug 3 raises hemoglobin levels significantly compared to the grand mean. Keep in mind that this type of pooled analysis would be inept in the presence of a therapy-drug interaction; here one should rather perform separate drug comparisons for radiation and for chemotherapy. 3

3 ANOM with (overdispersed) count data Beall (1942) reports a study on the effectiveness of six insect sprays to control the tomato hornworm Manduca quinquemaculata (formerly called Phlegethontius quinquemaculatus), which is a common pest of solanaceae. The experiment was carried out in a randomized complete block design: each spray was applied to plants in each of six blocks, and the number of insects found after treatment was counted and recorded (taking two random samples per block and spray). The data is stored in R s basic datasets package, but this version is incomplete as the block structure of the experiment was missed out for some reason. We include a block variable according to Table 7 in Beall s original publication. data(insectsprays) InsectSprays$block <- as.factor(rep(1:6, each=2)) A common distributional assumption for count data is Poisson, so it sounds like a good idea to fit a Poisson generalized linear model with a logarithmic link function to the data. However, recall that the variance of a Poisson random variable equals its expected value. This basic assumption is more often than not violated with real-world data, and we usually include a variance inflation factor φ in the model to cope with this overdispersion (or extra-poisson variability). insmodel1 <- glm(count ~ spray + block, data=insectsprays, family=quasipoisson(link="log")) summary(insmodel1)$dispersion [1] 1.198022 In our case the estimated variance inflation of 19.8% is negligible, hence we will most likely not harm our analysis when using a simple Poisson GLM without an overdispersion parameter. An analysis of deviance reveals that both treatment and block bring about highly significant effects. insmodel2 <- glm(count ~ spray + block, data=insectsprays, family=poisson(link="log")) anova(insmodel2, test="chisq") Analysis of Deviance Table Model: poisson, link: log Response: count Terms added sequentially (first to last) Df Deviance Resid. Df Resid. Dev Pr(>Chi) NULL 71 409.04 spray 5 310.71 66 98.33 < 2.2e-16 *** block 5 25.34 61 72.99 0.0001198 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 We perform an ANOM to find out which insect sprays lead to lower or higher counts of insects compared to average. The logarithmic transformation of the counts is automatically reversed to simplify interpretation of the resulting graph. ins <- glht(insmodel2, mcp(spray="grandmean")) ANOM(ins) Figure 3 shows that all six treatments are significantly different from the grand mean: more insects were counted after applying sprays A, B, and F, and fewer with sprays C through E. The varying widths of the gray band (upped minus lower decision limit) just reflect the dependence of the Poisson variance on the expected value. 4

25 p<0.001 p<0.001 p<0.001 p=0.01 p<0.001 p<0.001 20 count 15 10 5 n=12 n=12 n=12 n=12 n=12 n=12 A B C D E F spray Figure 3: ANOM decision chart for the insect spray data based on a Poisson GLM. 5

4 ANOM with linear mixed-effects models Pinheiro and Bates (2000) describe data from an investigation of ergonomic stools performed by Wretenberg et al. (1993). They had nine people assess the physical effort to rise from each of four stool types: a stool of ordinary height, a low ordinary stool, a one-legged stool, and a pneumatic stool. Each subject tested each stool type once and rated the perceived exertion on the so-called Borg scale, which takes values from 6 to 20. We wish to detect types of stools that are significantly more or less difficult to rise from in comparison to average. library(nlme) data(ergostool) This is a complete block design; each of the four stools under study is evaluated nine times. One challenge is that the scoring is clearly subjective e.g., a person suffering from chronic back pain is more likely to assign lower ratings than a healthy individual. To account for this variability between raters, a linear mixed-effects model is our method of choice. The model for the ith individual has the general form y i = X i β + Z i b i + ɛ i where y i are the outcomes, β the fixed and b i the random effects, X i and Z i the design matrices for the fixed and random effects, and ɛ i the residuals. We assume that b i N (0, D) and e i N (0, R i ), and additionally cov(b i, e i ) = 0. In our ergonomic stools example, we model fixed stool effects and treat the test persons as random. We hereby make the assumption that the testers are representative of all people who could sit on these stools and that their scorings are normally distributed with between-rater variance σ b. There are several concurrent and (in part) complementary frameworks for mixed-effects modeling which coexist in the R world. Here we illustrate ANOM using two of the most popular and best-established packages, nlme (Pinheiro et al. 2013) and lme4 (Bates et al. 2013). 4.1 Using nlme We model the perceived effort to rise (on the Borg scale) as a function of the type of stool and include a random subject effect to acknowledge between-rater variability. library(nlme) esmodel1 <- lme(effort ~ Type, random=~1 Subject, data=ergostool) es1 <- glht(esmodel1, mcp(type="grandmean"), alternative="two.sided") ANOM(es1, xlabel="stool Type", ylabel="exertion (Borg Scale)") Figure 4 displays that it is significantly more difficult to rise from stools of type 2. On the contrary, the perceived exertion is significantly below the grand mean for stool types 1 and 4. 4.2 Using lme4 An identical graphic can be generated with the functionality in lme4. library(lme4) esmodel2 <- lmer(effort ~ Type + (1 Subject), data=ergostool) es2 <- glht(esmodel2, mcp(type="grandmean"), alternative="two.sided") ANOM(es2, xlabel="stool Type", ylabel="exertion (Borg Scale)") Note that there are instances when the two mixed-effects model packages cannot be used interchangeably. Only nlme supports imposing a pattern like compound symmetry or AR(1) on the covariance matrix of the random effects and/or residuals whereas lme4 s strong points are sophisticated random effects hierarchies and nested structures, and it also fits generalized linear mixed-effects models. 6

13 p<0.001 p<0.001 p=0.297 p=0.005 Exertion (Borg Scale) 12 11 10 9 8 n=9 n=9 n=9 n=9 1 2 3 4 Stool Type Figure 4: ANOM decision chart for the ergonomic stool data based on a linear mixed-effects model. 7

13 p=0.007 p<0.001 p=0.678 p=0.156 Exertion (Borg Scale) 12 11 10 9 8 n=9 n=9 n=9 n=9 T1 T2 T3 T4 Stool Type Figure 5: ANOM decision chart for the ergonomic stool data based on a standard linear model. 4.3 Ignoring the repeated structure One may wonder what would happen if we did not account for the fact that each chair was tested by several individuals. We fit a simple linear model and observe that the decision limits drift apart so that stool type 4 is no longer significant (Figure 5). esmodel3 <- lm(effort ~ Type, ergostool) es3 <- glht(esmodel3, mcp(type="grandmean"), alternative="two.sided") ANOM(es3, xlabel="stool Type", ylabel="exertion (Borg Scale)") The reason is quite simple: when fitting a mixed-effects model, we partition the total variance of the data into a component explained by the variability among the nine raters and a residual component. If we ignore the clustered structure of the data and fit a standard linear model, all variability is summed up in the residual variance, thus making it harder to detect significant stool effects. 8

References D. Bates, M. Maechler, B. Bolker, and S. Walker. lme4: Linear mixed-effects models using Eigen and S4, 2013. URL http://cran.r-project.org/package=lme4. R package version 1.0-5. G. Beall. The transformation of data from entomological field experiments so that the analysis of variance becomes applicable. Biometrika, 32(3-4):243 262, 1942. P. R. Nelson, P. S. Wludyka, and K. A. F. Copeland. The Analysis of Means: A Graphical Method for Comparing Means, Rates, and Proportions. ASA-SIAM Series on Statistics and Applied Probability. SIAM, Philadelphia, PA, and ASA, Alexandria, VA, 2005. ISBN 0-89871-592-X. E. R. Ott. Analysis of means - a graphical procedure. Industrial Quality Control, 24:101 109, 1967. P. Pallmann and L. A. Hothorn. Analysis of means (ANOM): A generalized approach using R. Journal of Applied Statistics, 2016. doi:10.1080/02664763.2015.1117584. J. Pinheiro, D. Bates, S. DebRoy, D. Sarkar, and R Core Team. nlme: Linear and nonlinear mixed effects models, 2013. URL http://cran.r-project.org/package=nlme. R package version 3.1-111. J. C. Pinheiro and D. M. Bates. Mixed-Effects Models in S and S-PLUS. Springer, New York, NY, 2000. ISBN 0-387-98957-9. P. Wretenberg, U. P. Arborelius, and F. Lindberg. The effects of a pneumatic stool and a one-legged stool on lower limb joint load and muscular activity during sitting and rising. Ergonomics, 36(5): 519 535, 1993. 9