Random Effects ANOVA

Similar documents
Two Way ANOVA in R Solutions

Let us assume that we are measuring the yield of a crop plant on 5 different plots at 4 different observation times.

MixedModR2 Erika Mudrak Thursday, August 30, 2018

Study 2: data analysis. Example analysis using R

Step 1: Load the appropriate R package. Step 2: Fit a separate mixed model for each independence claim in the basis set.

GGraph. Males Only. Premium. Experience. GGraph. Gender. 1 0: R 2 Linear = : R 2 Linear = Page 1

Chapter 10 Exercises 1. The final two sentences of Exercise 1 are challenging! Exercises 1 & 2 should be asterisked.

Parameter Estimation

Lecture 1: Empirical Properties of Returns

> > is.factor(scabdata$trt) [1] TRUE > is.ordered(scabdata$trt) [1] FALSE > scabdata$trtord <- ordered(scabdata$trt, +

Topic 30: Random Effects Modeling

Tests for Intraclass Correlation

Economics 424/Applied Mathematics 540. Final Exam Solutions

Stat 401XV Exam 3 Spring 2017

Final Exam Suggested Solutions

MODEL SELECTION CRITERIA IN R:

The SAS System 11:03 Monday, November 11,

Parametric Statistics: Exploring Assumptions.

Regression Review and Robust Regression. Slides prepared by Elizabeth Newton (MIT)

Chapter 6 Part 3 October 21, Bootstrapping

Problem Set 4 Answer Key

> attach(grocery) > boxplot(sales~discount, ylab="sales",xlab="discount")

Maximum Likelihood Estimation

Statistical Models of Stocks and Bonds. Zachary D Easterling: Department of Economics. The University of Akron

An Introduction to R 2.1 Descriptive statistics

Regression and Simulation

Copyright 2005 Pearson Education, Inc. Slide 6-1

LAMPIRAN PERHITUNGAN EVIEWS

6 Multiple Regression

Multiple regression - a brief introduction

2018 AAPM: Normal and non normal distributions: Why understanding distributions are important when designing experiments and analyzing data

Ordinal Multinomial Logistic Regression. Thom M. Suhy Southern Methodist University May14th, 2013

Generalized Linear Models

COMPREHENSIVE WRITTEN EXAMINATION, PAPER III FRIDAY AUGUST 18, 2006, 9:00 A.M. 1:00 P.M. STATISTICS 174 QUESTIONS

Graduate School of Business, University of Chicago Business 41202, Spring Quarter 2007, Mr. Ruey S. Tsay. Midterm

Financial Econometrics: Problem Set # 3 Solutions

Economics 483. Midterm Exam. 1. Consider the following monthly data for Microsoft stock over the period December 1995 through December 1996:

Mixed models in R using the lme4 package Part 3: Inference based on profiled deviance

Brief Sketch of Solutions: Tutorial 1. 2) descriptive statistics and correlogram. Series: LGCSI Sample 12/31/ /11/2009 Observations 2596

STA258 Analysis of Variance

Question 1a 1b 1c 1d 1e 1f 2a 2b 2c 2d 3a 3b 3c 3d M ult:choice Points

Chapter 7. Inferences about Population Variances

STA218 Analysis of Variance

Stat 328, Summer 2005

The Two-Sample Independent Sample t Test

NHY examples. Bernt Arne Ødegaard. 23 November Estimating dividend growth in Norsk Hydro 8

Power in Mixed Effects

STA2601. Tutorial letter 105/2/2018. Applied Statistics II. Semester 2. Department of Statistics STA2601/105/2/2018 TRIAL EXAMINATION PAPER

Hypothesis Tests: One Sample Mean Cal State Northridge Ψ320 Andrew Ainsworth PhD

Key Objectives. Module 2: The Logic of Statistical Inference. Z-scores. SGSB Workshop: Using Statistical Data to Make Decisions

Valid Missing Total. N Percent N Percent N Percent , ,0% 0,0% 2 100,0% 1, ,0% 0,0% 2 100,0% 2, ,0% 0,0% 5 100,0%

Study of one-way ANOVA with a fixed-effect factor

Copyright 2011 Pearson Education, Inc. Publishing as Addison-Wesley.

Model Construction & Forecast Based Portfolio Allocation:

7. For the table that follows, answer the following questions: x y 1-1/4 2-1/2 3-3/4 4

R is a collaborative project with many contributors. Type contributors() for more information.

Determination of the Optimal Stratum Boundaries in the Monthly Retail Trade Survey in the Croatian Bureau of Statistics

Chapter 11: Inference for Distributions Inference for Means of a Population 11.2 Comparing Two Means

Lampiran 1 : Grafik Data HIV Asli

Tests for Two ROC Curves

2009/2010 CAIA Prerequisite Diagnostic Review (PDR) And Answer Key

Chapter 7 Sampling Distributions and Point Estimation of Parameters

Financial Risk, Liquidity Risk and their Effect on the Listed Jordanian Islamic Bank's Performance

Appendixes Appendix 1 Data of Dependent Variables and Independent Variables Period

11/28/2018. Overview. Multiple Linear Regression Analysis. Multiple regression. Multiple regression. Multiple regression. Multiple regression

Quantitative Techniques Term 2

ECO220Y, Term Test #2

1.017/1.010 Class 19 Analysis of Variance

Lampiran 1 Lampiran 1 Data Keuangan Bank konvensional

Generalized Multilevel Regression Example for a Binary Outcome

Appendix. A.1 Independent Random Effects (Baseline)

Non-linearities in Simple Regression

Tests for Two Means in a Multicenter Randomized Design

9. Appendixes. Page 73 of 95

Projects for Bayesian Computation with R

Handout seminar 6, ECON4150

Statistics & Statistical Tests: Assumptions & Conclusions

BEcon Program, Faculty of Economics, Chulalongkorn University Page 1/7

Honor Code: By signing my name below, I pledge my honor that I have not violated the Booth Honor Code during this examination.

ST 350 Lecture Worksheet #33 Reiland

Simple Descriptive Statistics

Diploma Part 2. Quantitative Methods. Examiner s Suggested Answers

Stat 101 Exam 1 - Embers Important Formulas and Concepts 1

Analysis of the Influence of the Annualized Rate of Rentability on the Unit Value of the Net Assets of the Private Administered Pension Fund NN

P2.T8. Risk Management & Investment Management. Jorion, Value at Risk: The New Benchmark for Managing Financial Risk, 3rd Edition.

ORDERED MULTINOMIAL LOGISTIC REGRESSION ANALYSIS. Pooja Shivraj Southern Methodist University

Random Effects... and more about pigs G G G G G G G G G G G

Fall 2004 Social Sciences 7418 University of Wisconsin-Madison Problem Set 5 Answers

Homework Assignment Section 3

Topic 8: Model Diagnostics

Example 1 of econometric analysis: the Market Model

Lampiran 1. Tabulasi Data

Session 178 TS, Stats for Health Actuaries. Moderator: Ian G. Duncan, FSA, FCA, FCIA, FIA, MAAA. Presenter: Joan C. Barrett, FSA, MAAA

Management Science Letters

Module 3: Sampling Distributions and the CLT Statistics (OA3102)

Review: Population, sample, and sampling distributions

Financial Econometrics Jeffrey R. Russell Midterm 2014

Negative Binomial Model for Count Data Log-linear Models for Contingency Tables - Introduction

Jaime Frade Dr. Niu Interest rate modeling

The relationship between GDP, labor force and health expenditure in European countries

Transcription:

Random Effects ANOVA Grant B. Morgan Baylor University This post contains code for conducting a random effects ANOVA. Make sure the following packages are installed: foreign, lme4, lsr, lattice. library(foreign) library(lsr) library(lme4) Loading required package: Matrix raneff<-read.spss("/users/grant_morgan/box Sync/Teaching/EDP 6360 - Experimental Design/Data/Ra Warning in read.spss("/users/grant morgan/box Sync/Teaching/EDP 6360 - Experimental Design/Data/Random Effect.sav", : /Users/grant morgan/box Sync/Teaching/EDP 6360 - Experimental Design/Data/Random Effect.sav: Unrecognized record type 7, subtype 18 encountered in system file re-encoding from CP1252 First, we should generate some descriptive statistics for the outcome variable, Score, for each of the randomly selected raters. library(psych) describeby(raneff$score, raneff$rater) Descriptive statistics by group group: 1 vars n mean sd median trimmed mad min max range skew kurtosis se X1 1 7 13.86 3.13 13 13.86 1.48 10 19 9 0.45-1.45 1.18 -------------------------------------------------------- group: 2 vars n mean sd median trimmed mad min max range skew kurtosis se X1 1 7 9.57 2.07 10 9.57 1.48 6 12 6-0.47-1.35 0.78 -------------------------------------------------------- group: 3 vars n mean sd median trimmed mad min max range skew kurtosis se X1 1 7 10 3.46 11 10 1.48 5 15 10-0.19-1.49 1.31 -------------------------------------------------------- group: 4 1

vars n mean sd median trimmed mad min max range skew kurtosis se X1 1 7 10.14 2.27 11 10.14 1.48 6 12 6-0.66-1.19 0.86 The null hypothesis in the random effects ANOVA states that the variance of the means is equal to zero. Let s generate some plots to see how the distribution of scores for each of the randomly selected raters overlaps. library(lattice) xyplot(raneff$score ~ raneff$rater, pch = 16, col = "blue") boxplot(raneff$score ~ raneff$rater, pch = 16, col = "blue") 2

6 8 10 12 14 16 18 1 2 3 4 Both of these plots indicates that the variability seems pretty similar for each rater, but the scores appear to be centered at different locations for each rater. We also see this from the descriptive statistics. Next, let s estimate the random effects ANOVA model. raneff$rater<-as.factor(raneff$rater) raneff.out<-aov(raneff$score ~ Error(raneff$Rater), data=raneff) summary(raneff.out) Error: raneff$rater Df Sum Sq Mean Sq F value Pr(>F) 3

Residuals 3 83.25 27.75 Error: Within Df Sum Sq Mean Sq F value Pr(>F) Residuals 24 187.4 7.81 raneff.out Call: aov(formula = raneff$score ~ Error(raneff$Rater), data = raneff) Grand Mean: 10.89286 Stratum 1: raneff$rater Terms: Residuals Sum of Squares 83.25 Deg. of Freedom 3 Residual standard error: 5.267827 Stratum 2: Within Terms: Residuals Sum of Squares 187.4286 Deg. of Freedom 24 Residual standard error: 2.794553 sum((raneff.out$"within"$residuals)**2) [1] 187.4286 sum((raneff.out$"raneff$rater"$residuals)**2) [1] 83.25 raneff.out$"within"$df.residual [1] 24 raneff.f<-(sum((raneff.out$"raneff$rater"$residuals)**2)/raneff.out$"raneff$rater"$df.residual) (sum((raneff.out$"within"$residuals)**2)/raneff.out$"within"$df.residual) raneff.f [1] 3.553354 4

raneff.p<-pf(raneff.f,raneff.out$"raneff$rater"$df.residual,raneff.out$"within"$df.residual,low raneff.p [1] 0.0293461 raneff.results<-matrix(c((sum((raneff.out$"raneff$rater"$residuals)**2)/raneff.out$"raneff$rate pf(raneff.f,raneff.out$"raneff$rater"$df.residual,raneff.out$"within"$df.residual,lower.tail= colnames(raneff.results)<-c("f","p-value") raneff.results F p-value [1,] 3.553354 0.0293461 For some reason, the aov function in R does provide not the p-value for random effects ANOVA so I have computed it. According to the results, there is sufficient evidence to conclude that the variance of the means of the raters is nonzero. There is no post hoc analysis because we are not dealing with specific (i.e., fixed) values of the raters. If we replicated the sudy, the raters would likely be different. We can get a better understanding of the random effect by computing the variance components and effect size. We can compute the intraclass correlation coefficient. This estimates the proportion of variance in the outcome variable that is explained by the random effect in the population. raneff.vc<-lmer(raneff$score ~ 1 + (1 raneff$rater), data = raneff) summary(raneff.vc) Linear mixed model fit by REML ['lmermod'] Formula: raneff$score ~ 1 + (1 raneff$rater) Data: raneff REML criterion at convergence: 139.3 Scaled residuals: Min 1Q Median 3Q Max -1.8791-0.4845 0.1257 0.5890 2.1388 Random effects: Groups Name Variance Std.Dev. raneff$rater (Intercept) 2.849 1.688 Residual 7.810 2.795 Number of obs: 28, groups: raneff$rater, 4 Fixed effects: Estimate Std. Error t value (Intercept) 10.8929 0.9955 10.94 raneff.varexp<-as.numeric(varcorr(raneff.vc)) / (as.numeric(varcorr(raneff.vc))+attr(varcorr(ra raneff.varexp [1] 0.267273 5

The variance components are 2.85 for the rater effect and 7.81 for the residual. The ICC is computed by dividing the rater effect by the sum of the two variance components: ICC = σ 2 Rater σ 2 Rater + σ2 Residual = 2.85 2.85 + 7.81 The ICC for this study is.27, which indicates that the raters explained 27% of the variability in the scores in the population. 6