Outline for today. Two-way analysis of variance with random effects

Size: px
Start display at page:

Download "Outline for today. Two-way analysis of variance with random effects"

Transcription

1 Outline for today Two-way analysis of variance with random effects Rasmus Waagepetersen Department of Mathematics Aalborg University Denmark Two-way ANOVA using orthogonal projections March 4, / 28 2 / 28 Two-way ANOVA Consider two factors: T (treatment) and P (plot) with number of levels d T and d P. Moreover let P T be the cross-factor (has d P d T levels - one for each combination of levels of P and T ). Assume P T is balanced with n P T = m observations for each level. Then P and T balanced too with numbers of observations n P = md T and n T = md P for each level. Similar to one-way anova define: V 0 = L 0 V T = L T V 0 V P = L P V 0 Since P T balanced it follows that P T P P = P P P T = P 0 which implies Q T Q p = 0 where Q T = P T P 0 and Q P = P P P 0. Hence V T and V P are orthogonal and L P + L T = V 0 V P V T. Define further Model with random P and P T effects (e.g. to account for soil variation) y ptr = ξ + β t + U p + U pt + ɛ ptr p = 1,..., d P, t = 1,..., d T, r = 1,..., m V P T = L P T (L P + L T ) Orthogonal decomposition: V I = R n L P T In vector form: R n = V 0 V P V T V P T V I where µ L T = spanx T. y = µ + Z P U P + Z P T U P T + ɛ 3 / 28 Dimensions of V spaces: f 0 = 1, f P = d P 1, f T = d T 1, f P T = d P d T d P d T + 1 = (d P 1)(d T 1), f I = n d P d T. 4 / 28

2 Orthogonal projections on V spaces: Q 0 = P 0, Q P = P P Q 0, Q T = P T Q 0, Q P T = P P T Q P Q T Q 0 and Q I = I P P T. Covariance structure: CovY = σ 2 P n PP P + σ 2 P T n P T P P T + σ 2 I Q s are orthogonal projections on Ṽ P = V 0 + V P Ṽ P T = V P T + Q T Ṽ I = V I where and = λ P Q P + λ P T Q P T + σ 2 Q I λ I = σ 2 λ P T = σ 2 + n P T σp T 2 λ P = σ 2 + n P T σp T 2 + n PσP 2 This corresponds to orthogonal decomposition R n = ṼP ṼP T ṼI based on model without systematic effects ( V -spaces aggregated into Ṽ -spaces). Q P = Q 0 + Q P = P P Q P T = Q P T + Q T Q I = Q I 5 / 28 6 / 28 Orthogonal decomposition of data vector: Y = Q 0 Y + Q P Y + Q T Y + Q P T Y + Q I Y = Q P Y + Q P T Y + Q I Y Decomposition of mean vector µ L T = V 0 V T : µ = Q P µ + Q P T µ + Q I µ = Q 0 µ + Q T µ + 0 = µ 0 + µ T where µ 0 L 0 and µ T V T. Note: one-to-one correspondence between µ and (µ 0,µ T ) (reparametrization) 7 / 28 As for one-way anova Y is decomposed into independent normal vectors Q P Y N(µ 0, λ P QP ) QP T Y N(µ T, λ P T QP T ) Q I Y N(0, λ I QI ) Density for Y factorizes into product of densities for Q P Y, Q P T Y and Q I Y. Hence ˆµ 0 = P 0 Q P Y = P 0 Y = Ȳ 1 n ˆµ T = Q T Q P T Y = Q T Y ˆµ = ˆµ 0 + ˆµ T = P T Y ˆλ P = Q P Y P 0 Y 2 /d P = Q P Y 2 /d P ˆλ P T = Q P T Y Q T Y 2 /(d P d T d P ) = Q P T Y 2 /(d P d T d P ) ˆλ I = ˆσ 2 = Q I Y 2 /(n d P d T ) NB: since V P and V P T have dimensions f P = d P 1 and f P T = (d P 1)(d T 1) we often use these denominators instead of d P and d P d T d P for λ P and λ P T (REML). Note: MLE for µ is identical to MLE in the linear model with µ L T and no random effects. 8 / 28

3 Strata Crucial common point one- and two-way anova models considered: we are able to decompose covariance matrix as linear combination of scaled projections on orthogonal Ṽ -subspaces where coefficients are in one-to-one correspondence with the variance components (the variances of random effects). This enables factorization of likelihood based! Fixed factors assigned to strata corresponding to Ṽ spaces for the random factors Rule: fixed factor F belongs to B strata (B random factor) if B is the coarsest random factor which is finer than F (assuming that we work with designs where this rule gives unique allocation of each fixed factors to one random factor). NB: F is finer than G (or G coarser than F ) if levels of G can be obtained by merging levels of F. We then write G F. 9 / 28 Structure diagram I PxT P T Arrow from F to G if G is coarser than F and there is no intermediate factor which is coarser than F and finer than G. Note: three strata (black, green and red) corresponding to random factors I, P T and P. NB: here we can not have both P and T random unless O random too (if O systematic no unique allocation to random factor strata). Also want to respect hierarchical principle so P T can not be fixed if P random. O 10 / 28 Paper pulp example: two-way analysis of variance without treatment effect P: card board with d P = 5. T: position within cardboard (not a treatment) with d T = 4. Number of replications m = 4. Model: Variances σ 2 P, σ2 P T y ptr = ξ + U p + U pt + ɛ ptr and σ2 We can use exactly the same orthogonal decomposition as before. Only difference is that Q T µ = Q T 1 n ξ = 0 which means Q P T Y N(0, λ P T Q P T ) and REML and ML estimates for λ P T coincide and are equal to ˆλ P T = Q P T Y 2 /(d P d T d P ) NB: in ANOVA table (next slide), SSP= Q P Y 2, SST= Q T Y 2, SSPT= Q P T Y 2 and SSE= Q I Y / 28 ANOVA table Analysis of Variance Table Response: Reflektans factor(sted) < 2.2e-16 *** #SST factor(pap.nr.) < 2.2e-16 *** #SSP factor(sted):factor(pap.nr.) < 2.2e-16 *** #SSPT Residuals #SSE ˆσ 2 = ˆλ P T = ( )/15 = ˆλ P = /5 = (or ˆλ P = /4 = = ). 12 / 28

4 Using lmer and ML By relations λ P T = σ 2 + n P T σ 2 P T λ P = σ 2 + n P T σ 2 P T + n Pσ 2 P we obtain ˆσ P 2 = ( )/16 = ˆσ P T 2 = ( )/4 = (or = ( )/16 = ) ˆσ 2 P Recall: balanced design required - and difficult to remember rules for calculating variance components. > out2=lmer(reflektans~(1 StedPap.nr.)+(1 Pap.nr.),REML=F) > summary(out2) Linear mixed model fit by maximum likelihood Formula: Reflektans ~ (1 StedPap.nr.) + (1 Pap.nr.) AIC BIC loglik deviance REMLdev Random effects: Groups Name Variance Std.Dev. StedPap.nr. (Intercept) e Pap.nr. (Intercept) e Residual e Number of obs: 80, groups: StedPap.nr., 20; Pap.nr., 5 13 / / 28 Using lmer and REML > out2=lmer(reflektans~(1 StedPap.nr.)+(1 Pap.nr.)) > summary(out2) Linear mixed-effects model fit by REML Formula: Reflektans ~ (1 StedPap.nr.) + (1 Pap.nr.) AIC BIC loglik MLdeviance REMLdeviance Random effects: Groups Name Variance Std.Dev. StedPap.nr. (Intercept) e Pap.nr. (Intercept) e Residual e number of obs: 80, groups: StedPap.nr., 20; Pap.nr., 5 Explanation of Reflektans~(1 StedPap.nr.)+(1 Pap.nr.)): no fixed formula: intercept always included as default (1 StedPap.nr.) random intercepts for groups identified by variable StedPap.nr. (1 Pap.nr.) random intercepts for groups identified by variable Pap.nr. random effects specified by different terms independent. Note REML and ML estimates for σ 2 and σp T 2 rounding error) coincide (up to 15 / / 28

5 A more complicated example: gene-expression Gene (DNA string) composed of substrings (exons) which may be more or less expressed according to treatment. Note: P E T = I is balanced so every sub-factor (E, E T etc.) is balanced. This implies orthogonal decomposition (see a following slide): Expression measured as intensities on micro-array (chip). One chip pr. patient-treatment. R 160 = V 0 V P V E V T V P T V E T V P E V I Structure diagram with random factors P, P V, I : P PxT Factors: E (exon 8 levels), P (patient, 10 levels), T (treatment, 2 levels) Y : vector of intensities (how much is exon expressed). I ExT T E O Model: y ept = ξ + α e + β t + γ et + U p + U pt + ɛ ept U pt and U p random chip and patient effects. PxE Decomposition with respect to random factors: R 160 = Ṽ P Ṽ P T Ṽ I Main question: are exons differentially expressed - i.e. are γ et 0 or not (we will return to this question later) 17 / 28 where Ṽ P = V 0 V P, Ṽ P T = V T V P T and Ṽ I = V E V E T V P E V I. 18 / 28 Decomposition of CovY : CovY = n P σ 2 P P P+n P T σ 2 P T P P T +σ 2 I = λ P Q P +λ P T Q P T +λ I Q I Decomposition of µ: µ = Q P µ + Q P T µ + Q I µ = Q 0 µ + Q T µ + Q E µ + Q E T µ As before decomposition of Y into independent Gaussian vectors: Q P Y N(Q 0 µ, λ P QP ) QP T Y N(Q T µ, λ P T QP T ) Q I Y N ( (Q E + Q E T )µ, λ I Q I ) Orthogonality of V -spaces We use results of exercise 5 to deduce that P P E P E T = P E Q P P E T = P P P E T P 0 P E T = P 0 P 0 = 0 The second equality shows that V P and V E T are orthogonal. Further: Q P E = P P E Q P Q E Q 0 Q E T = P P E Q E Q T Q 0 Using the result in the upper equation and pairwise orthogonality of Q P, Q E, Q T, Q 0 we get Q P E Q E T = 0 Thus V P E and V E T are orthogonal too. Orthogonality of V P T, V P and V T was shown for two-way ANOVA. 19 / 28 Proceeding this way all V spaces orthogonal. 20 / 28

6 Anova table: > fit1=lm(intensity~treat*factor(exon)+factor(patient)+ factor(patient):treat,data=gene1) > anova(fit1) Analysis of Variance Table Response: intensity treat *** factor(exon) < 2.2e-16 *** factor(patient) e-09 *** treat:factor(exon) treat:factor(patient) *** Residuals ˆσ 2 = ˆλ I = λ P T = 8.19/9 = 0.91 λ P = /9 = ˆσ P T 2 = ( )/8 = ˆσ P 2 = ( )/16 = / 28 Using lmer: > fit1=lmer(intensity~treat*factor(exon)+ (1 patient)+(1 pattreat),data=gene1) > summary(fit1) Linear mixed model fit by REML Data: gene1 AIC BIC loglik deviance REMLdev Random effects: Groups Name Variance Std.Dev. pattreat (Intercept) patient (Intercept) Residual Number of obs: 160, groups: repltreat, 20; patient, / 28 With aov() > fit1=aov(intensity~treatment*factor(exon)+error(factor(patient)+factor(patient):t > summary(fit1) Error: factor(patient) Residuals Error: factor(patient):treatment treatment Residuals Signif. codes: 0 *** ** 0.01 * Error: Within factor(exon) <2e-16 *** treatment:factor(exon) Residuals Signif. codes: 0 *** ** 0.01 * Conveniently organizes factors into strata! K-way ANOVA Assume K factors F 1,..., F K so that F 1... F K balanced. Let D be the set of 0, I, F 1,..., F K and all cross-combinations of F 1,..., F K. Then, in analogy with three-way, all V spaces orthogonal. Let B D be the set of factors with random effects. We then have and we want Σ = B B σ 2 B n BP B and P B = P B = B B:B B F D:F B Q F Q B (1) where Q B orthogonal projections on some spaces Ṽ B where R n = B B Ṽ B. 22 / / 28

7 K-way ANOVA continued Given (1) we have required decomposition of Σ into sum of scaled orthogonal projections: Σ = B B σ 2 B n BP B = B B λ B QB where λ B = B B:B B n B σ 2 B. A sufficient (and necessary) condition for (1) is that: for all F D there exists a B B such that F B and B B for all other B with F B. (this must be checked for a given model. Note this implies I B and that B = B(F ) is unique). K-way ANOVA continued Thus we can again obtain decomposition Y of into independent Ỹ B = Q B Y, B B. See also more details in note Analysis of variance using orthogonal projections. Even more general set-up can be found in Jesper Møller: Centrale statistiske modeller og likelihood baserede metoder. Then we define Ṽ B = V F and Q B = F D:B(F )=B F D:B(F )=B Each F D belongs to precisely one Ṽ B so R n = B B Ṽ B. Q F 25 / / 28 Exercises 1. Check that P T P P = P Check that L T + L P = V 0 V P V T. 3. Write down factorization of likelihood for balanced two-way. Derive estimates of mean and variance parameters. 4. Install the R-package faraway which contains the data set penicillin. The response variable is yield of penicillin for four different production processes (the treatment ). The raw material for the production comes in batches ( blends ). The four production processes were applied to each of the 5 blends. Fit anova models with production process as a fixed factor and blend as random factor. Try to use both the anova table and lmer. 5. In a balanced three-way design with factors F 1, F 2, and F 3 show that P F1 F 2 P F2 F 3 = P F2 P F1 F 2 P F3 = P 0 Explain how this can be generalized to the following result: P i A F i P i B F i = P i A B F i for a K-way balanced design with factors F i, i = 1,..., K and A, B {1,..., K} (taking P i F i = P 0 ). 27 / / 28

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

Outline. Statistical inference for linear mixed models. One-way ANOVA in matrix-vector form Outline Statistical inference for linear mixed models Rasmus Waagepetersen Department of Mathematics Aalborg University Denmark general form of linear mixed models examples of analyses using linear mixed

More information

Analysis of variance using orthogonal projections

Analysis of variance using orthogonal projections Analysis of variance using orthogonal projections Rasmus Waagepetersen Abstract The purpose of this note is to show how statistical theory for inference in balanced ANOVA models can be conveniently developed

More information

Course topics (tentative) The role of random effects

Course topics (tentative) The role of random effects Course topics (tentative) random effects linear mixed models analysis of variance frequentist likelihood-based inference (MLE and REML) prediction Bayesian inference The role of random effects Rasmus Waagepetersen

More information

Random and Mixed Effects Models - Part III

Random and Mixed Effects Models - Part III Random and Mixed Effects Models - Part III Statistics 149 Spring 2006 Copyright 2006 by Mark E. Irwin Quasi-F Tests When we get to more than two categorical factors, some times there are not nice F tests

More information

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

20. REML Estimation of Variance Components. Copyright c 2018 (Iowa State University) 20. Statistics / 36 20. REML Estimation of Variance Components Copyright c 2018 (Iowa State University) 20. Statistics 510 1 / 36 Consider the General Linear Model y = Xβ + ɛ, where ɛ N(0, Σ) and Σ is an n n positive definite

More information

Outline for today. Maximum likelihood estimation. Computation with multivariate normal distributions. Multivariate normal distribution

Outline for today. Maximum likelihood estimation. Computation with multivariate normal distributions. Multivariate normal distribution Outline for today Maximum likelihood estimation Rasmus Waageetersen Deartment of Mathematics Aalborg University Denmark October 30, 2007 the multivariate normal distribution linear and linear mixed models

More information

Homework 3 - Solution

Homework 3 - Solution STAT 526 - Spring 2011 Homework 3 - Solution Olga Vitek Each part of the problems 5 points 1. KNNL 25.17 (Note: you can choose either the restricted or the unrestricted version of the model. Please state

More information

Linear models. Rasmus Waagepetersen Department of Mathematics Aalborg University Denmark. October 5, 2016

Linear models. Rasmus Waagepetersen Department of Mathematics Aalborg University Denmark. October 5, 2016 Linear models Rasmus Waagepetersen Department of Mathematics Aalborg University Denmark October 5, 2016 1 / 16 Outline for today linear models least squares estimation orthogonal projections estimation

More information

Random and Mixed Effects Models - Part II

Random and Mixed Effects Models - Part II Random and Mixed Effects Models - Part II Statistics 149 Spring 2006 Copyright 2006 by Mark E. Irwin Two-Factor Random Effects Model Example: Miles per Gallon (Neter, Kutner, Nachtsheim, & Wasserman, problem

More information

A brief introduction to mixed models

A brief introduction to mixed models A brief introduction to mixed models University of Gothenburg Gothenburg April 6, 2017 Outline An introduction to mixed models based on a few examples: Definition of standard mixed models. Parameter estimation.

More information

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

Outline. Mixed models in R using the lme4 package Part 3: Longitudinal data. Sleep deprivation data. Simple longitudinal data Outline Mixed models in R using the lme4 package Part 3: Longitudinal data Douglas Bates Longitudinal data: sleepstudy A model with random effects for intercept and slope University of Wisconsin - Madison

More information

Workshop 9.3a: Randomized block designs

Workshop 9.3a: Randomized block designs -1- Workshop 93a: Randomized block designs Murray Logan November 23, 16 Table of contents 1 Randomized Block (RCB) designs 1 2 Worked Examples 12 1 Randomized Block (RCB) designs 11 RCB design Simple Randomized

More information

Multiple Regression: Example

Multiple Regression: Example Multiple Regression: Example Cobb-Douglas Production Function The Cobb-Douglas production function for observed economic data i = 1,..., n may be expressed as where O i is output l i is labour input c

More information

Prediction. is a weighted least squares estimate since it minimizes. Rasmus Waagepetersen Department of Mathematics Aalborg University Denmark

Prediction. is a weighted least squares estimate since it minimizes. Rasmus Waagepetersen Department of Mathematics Aalborg University Denmark Prediction Rasmus Waagepetersen Department of Mathematics Aalborg University Denmark March 22, 2017 WLS and BLUE (prelude to BLUP) Suppose that Y has mean β and known covariance matrix V (but Y need not

More information

Topic 17 - Single Factor Analysis of Variance. Outline. One-way ANOVA. The Data / Notation. One way ANOVA Cell means model Factor effects model

Topic 17 - Single Factor Analysis of Variance. Outline. One-way ANOVA. The Data / Notation. One way ANOVA Cell means model Factor effects model Topic 17 - Single Factor Analysis of Variance - Fall 2013 One way ANOVA Cell means model Factor effects model Outline Topic 17 2 One-way ANOVA Response variable Y is continuous Explanatory variable is

More information

Stat 5303 (Oehlert): Balanced Incomplete Block Designs 1

Stat 5303 (Oehlert): Balanced Incomplete Block Designs 1 Stat 5303 (Oehlert): Balanced Incomplete Block Designs 1 > library(stat5303libs);library(cfcdae);library(lme4) > weardata

More information

Introduction and Background to Multilevel Analysis

Introduction and Background to Multilevel Analysis Introduction and Background to Multilevel Analysis Dr. J. Kyle Roberts Southern Methodist University Simmons School of Education and Human Development Department of Teaching and Learning Background and

More information

Linear models and their mathematical foundations: Simple linear regression

Linear models and their mathematical foundations: Simple linear regression Linear models and their mathematical foundations: Simple linear regression Steffen Unkel Department of Medical Statistics University Medical Center Göttingen, Germany Winter term 2018/19 1/21 Introduction

More information

Correlated Data: Linear Mixed Models with Random Intercepts

Correlated Data: Linear Mixed Models with Random Intercepts 1 Correlated Data: Linear Mixed Models with Random Intercepts Mixed Effects Models This lecture introduces linear mixed effects models. Linear mixed models are a type of regression model, which generalise

More information

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

lme4 Luke Chang Last Revised July 16, Fitting Linear Mixed Models with a Varying Intercept lme4 Luke Chang Last Revised July 16, 2010 1 Using lme4 1.1 Fitting Linear Mixed Models with a Varying Intercept We will now work through the same Ultimatum Game example from the regression section and

More information

Outline. Example and Model ANOVA table F tests Pairwise treatment comparisons with LSD Sample and subsample size determination

Outline. Example and Model ANOVA table F tests Pairwise treatment comparisons with LSD Sample and subsample size determination Outline 1 The traditional approach 2 The Mean Squares approach for the Completely randomized design (CRD) CRD and one-way ANOVA Variance components and the F test Inference about the intercept Sample vs.

More information

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

R Output for Linear Models using functions lm(), gls() & glm() LM 04 lm(), gls() &glm() 1 R Output for Linear Models using functions lm(), gls() & glm() Different kinds of output related to linear models can be obtained in R using function lm() {stats} in the base

More information

Stat 5303 (Oehlert): Randomized Complete Blocks 1

Stat 5303 (Oehlert): Randomized Complete Blocks 1 Stat 5303 (Oehlert): Randomized Complete Blocks 1 > library(stat5303libs);library(cfcdae);library(lme4) > immer Loc Var Y1 Y2 1 UF M 81.0 80.7 2 UF S 105.4 82.3 3 UF V 119.7 80.4 4 UF T 109.7 87.2 5 UF

More information

Intruction to General and Generalized Linear Models

Intruction to General and Generalized Linear Models Intruction to General and Generalized Linear Models Mixed Effects Models IV Henrik Madsen Anna Helga Jónsdóttir hm@imm.dtu.dk April 30, 2012 Henrik Madsen Anna Helga Jónsdóttir (hm@imm.dtu.dk) Intruction

More information

WLS and BLUE (prelude to BLUP) Prediction

WLS and BLUE (prelude to BLUP) Prediction WLS and BLUE (prelude to BLUP) Prediction Rasmus Waagepetersen Department of Mathematics Aalborg University Denmark April 21, 2018 Suppose that Y has mean X β and known covariance matrix V (but Y need

More information

Matrices and vectors A matrix is a rectangular array of numbers. Here s an example: A =

Matrices and vectors A matrix is a rectangular array of numbers. Here s an example: A = Matrices and vectors A matrix is a rectangular array of numbers Here s an example: 23 14 17 A = 225 0 2 This matrix has dimensions 2 3 The number of rows is first, then the number of columns We can write

More information

Lecture 9 STK3100/4100

Lecture 9 STK3100/4100 Lecture 9 STK3100/4100 27. October 2014 Plan for lecture: 1. Linear mixed models cont. Models accounting for time dependencies (Ch. 6.1) 2. Generalized linear mixed models (GLMM, Ch. 13.1-13.3) Examples

More information

Hierarchical Random Effects

Hierarchical Random Effects enote 5 1 enote 5 Hierarchical Random Effects enote 5 INDHOLD 2 Indhold 5 Hierarchical Random Effects 1 5.1 Introduction.................................... 2 5.2 Main example: Lactase measurements in

More information

Coping with Additional Sources of Variation: ANCOVA and Random Effects

Coping with Additional Sources of Variation: ANCOVA and Random Effects Coping with Additional Sources of Variation: ANCOVA and Random Effects 1/49 More Noise in Experiments & Observations Your fixed coefficients are not always so fixed Continuous variation between samples

More information

Simple Linear Regression

Simple Linear Regression Simple Linear Regression In simple linear regression we are concerned about the relationship between two variables, X and Y. There are two components to such a relationship. 1. The strength of the relationship.

More information

Mixed Model Theory, Part I

Mixed Model Theory, Part I enote 4 1 enote 4 Mixed Model Theory, Part I enote 4 INDHOLD 2 Indhold 4 Mixed Model Theory, Part I 1 4.1 Design matrix for a systematic linear model.................. 2 4.2 The mixed model.................................

More information

36-463/663: Hierarchical Linear Models

36-463/663: Hierarchical Linear Models 36-463/663: Hierarchical Linear Models Lmer model selection and residuals Brian Junker 132E Baker Hall brian@stat.cmu.edu 1 Outline The London Schools Data (again!) A nice random-intercepts, random-slopes

More information

MODELS WITHOUT AN INTERCEPT

MODELS WITHOUT AN INTERCEPT Consider the balanced two factor design MODELS WITHOUT AN INTERCEPT Factor A 3 levels, indexed j 0, 1, 2; Factor B 5 levels, indexed l 0, 1, 2, 3, 4; n jl 4 replicate observations for each factor level

More information

Applied Regression. Applied Regression. Chapter 2 Simple Linear Regression. Hongcheng Li. April, 6, 2013

Applied Regression. Applied Regression. Chapter 2 Simple Linear Regression. Hongcheng Li. April, 6, 2013 Applied Regression Chapter 2 Simple Linear Regression Hongcheng Li April, 6, 2013 Outline 1 Introduction of simple linear regression 2 Scatter plot 3 Simple linear regression model 4 Test of Hypothesis

More information

Ch 2: Simple Linear Regression

Ch 2: Simple Linear Regression Ch 2: Simple Linear Regression 1. Simple Linear Regression Model A simple regression model with a single regressor x is y = β 0 + β 1 x + ɛ, where we assume that the error ɛ is independent random component

More information

Longitudinal Data Analysis

Longitudinal Data Analysis Longitudinal Data Analysis Mike Allerhand This document has been produced for the CCACE short course: Longitudinal Data Analysis. No part of this document may be reproduced, in any form or by any means,

More information

Latent random variables

Latent random variables Latent random variables Imagine that you have collected egg size data on a fish called Austrolebias elongatus, and the graph of egg size on body size of the mother looks as follows: Egg size (Area) 4.6

More information

Subject-specific observed profiles of log(fev1) vs age First 50 subjects in Six Cities Study

Subject-specific observed profiles of log(fev1) vs age First 50 subjects in Six Cities Study Subject-specific observed profiles of log(fev1) vs age First 50 subjects in Six Cities Study 1.4 0.0-6 7 8 9 10 11 12 13 14 15 16 17 18 19 age Model 1: A simple broken stick model with knot at 14 fit with

More information

Value Added Modeling

Value Added Modeling Value Added Modeling Dr. J. Kyle Roberts Southern Methodist University Simmons School of Education and Human Development Department of Teaching and Learning Background for VAMs Recall from previous lectures

More information

Stat/F&W Ecol/Hort 572 Review Points Ané, Spring 2010

Stat/F&W Ecol/Hort 572 Review Points Ané, Spring 2010 1 Linear models Y = Xβ + ɛ with ɛ N (0, σ 2 e) or Y N (Xβ, σ 2 e) where the model matrix X contains the information on predictors and β includes all coefficients (intercept, slope(s) etc.). 1. Number of

More information

One-Way ANOVA Model. group 1 y 11, y 12 y 13 y 1n1. group 2 y 21, y 22 y 2n2. group g y g1, y g2, y gng. g is # of groups,

One-Way ANOVA Model. group 1 y 11, y 12 y 13 y 1n1. group 2 y 21, y 22 y 2n2. group g y g1, y g2, y gng. g is # of groups, One-Way ANOVA Model group 1 y 11, y 12 y 13 y 1n1 group 2 y 21, y 22 y 2n2 group g y g1, y g2, y gng g is # of groups, n i denotes # of obs in the i-th group, and the total sample size n = g i=1 n i. 1

More information

Exploring Hierarchical Linear Mixed Models

Exploring Hierarchical Linear Mixed Models Exploring Hierarchical Linear Mixed Models 1/49 Last time... A Greenhouse Experiment testing C:N Ratios Sam was testing how changing the C:N Ratio of soil affected plant leaf growth. He had 3 treatments.

More information

Repeated measures, part 2, advanced methods

Repeated measures, part 2, advanced methods enote 12 1 enote 12 Repeated measures, part 2, advanced methods enote 12 INDHOLD 2 Indhold 12 Repeated measures, part 2, advanced methods 1 12.1 Intro......................................... 3 12.2 A

More information

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

Hierarchical Linear Models (HLM) Using R Package nlme. Interpretation. 2 = ( x 2) u 0j. e ij Hierarchical Linear Models (HLM) Using R Package nlme Interpretation I. The Null Model Level 1 (student level) model is mathach ij = β 0j + e ij Level 2 (school level) model is β 0j = γ 00 + u 0j Combined

More information

Topic 20: Single Factor Analysis of Variance

Topic 20: Single Factor Analysis of Variance Topic 20: Single Factor Analysis of Variance Outline Single factor Analysis of Variance One set of treatments Cell means model Factor effects model Link to linear regression using indicator explanatory

More information

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 A Handbook of Statistical Analyses Using R 2nd Edition Brian S. Everitt and Torsten Hothorn CHAPTER 12 Analysing Longitudinal Data I: Computerised Delivery of Cognitive Behavioural Therapy Beat the Blues

More information

Mixed models with correlated measurement errors

Mixed models with correlated measurement errors Mixed models with correlated measurement errors Rasmus Waagepetersen October 9, 2018 Example from Department of Health Technology 25 subjects where exposed to electric pulses of 11 different durations

More information

SPH 247 Statistical Analysis of Laboratory Data

SPH 247 Statistical Analysis of Laboratory Data SPH 247 Statistical Analysis of Laboratory Data March 31, 2015 SPH 247 Statistical Analysis of Laboratory Data 1 ANOVA Fixed and Random Effects We will review the analysis of variance (ANOVA) and then

More information

Simple and Multiple Linear Regression

Simple and Multiple Linear Regression Sta. 113 Chapter 12 and 13 of Devore March 12, 2010 Table of contents 1 Simple Linear Regression 2 Model Simple Linear Regression A simple linear regression model is given by Y = β 0 + β 1 x + ɛ where

More information

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

A Handbook of Statistical Analyses Using R. Brian S. Everitt and Torsten Hothorn A Handbook of Statistical Analyses Using R Brian S. Everitt and Torsten Hothorn CHAPTER 10 Analysing Longitudinal Data I: Computerised Delivery of Cognitive Behavioural Therapy Beat the Blues 10.1 Introduction

More information

Inference for Regression

Inference for Regression Inference for Regression Section 9.4 Cathy Poliak, Ph.D. cathy@math.uh.edu Office in Fleming 11c Department of Mathematics University of Houston Lecture 13b - 3339 Cathy Poliak, Ph.D. cathy@math.uh.edu

More information

Lecture 6 Multiple Linear Regression, cont.

Lecture 6 Multiple Linear Regression, cont. Lecture 6 Multiple Linear Regression, cont. BIOST 515 January 22, 2004 BIOST 515, Lecture 6 Testing general linear hypotheses Suppose we are interested in testing linear combinations of the regression

More information

Introduction to Within-Person Analysis and RM ANOVA

Introduction to Within-Person Analysis and RM ANOVA Introduction to Within-Person Analysis and RM ANOVA Today s Class: From between-person to within-person ANOVAs for longitudinal data Variance model comparisons using 2 LL CLP 944: Lecture 3 1 The Two Sides

More information

The linear mixed model: introduction and the basic model

The linear mixed model: introduction and the basic model The linear mixed model: introduction and the basic model Analysis of Experimental Data AED The linear mixed model: introduction and the basic model of 39 Contents Data with non-independent observations

More information

Introduction to General and Generalized Linear Models

Introduction to General and Generalized Linear Models Introduction to General and Generalized Linear Models Mixed effects models - II Henrik Madsen, Jan Kloppenborg Møller, Anders Nielsen April 16, 2012 H. Madsen, JK. Møller, A. Nielsen () Chapman & Hall

More information

Stat 502 Design and Analysis of Experiments General Linear Model

Stat 502 Design and Analysis of Experiments General Linear Model 1 Stat 502 Design and Analysis of Experiments General Linear Model Fritz Scholz Department of Statistics, University of Washington December 6, 2013 2 General Linear Hypothesis We assume the data vector

More information

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,

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, Likelihood Let P (D H) be the probability an experiment produces data D, given hypothesis H. Usually H is regarded as fixed and D variable. Before the experiment, the data D are unknown, and the probability

More information

Multivariate Statistics in Ecology and Quantitative Genetics Summary

Multivariate Statistics in Ecology and Quantitative Genetics Summary Multivariate Statistics in Ecology and Quantitative Genetics Summary Dirk Metzler & Martin Hutzenthaler http://evol.bio.lmu.de/_statgen 5. August 2011 Contents Linear Models Generalized Linear Models Mixed-effects

More information

Mixed effects models

Mixed effects models Mixed effects models The basic theory and application in R Mitchel van Loon Research Paper Business Analytics Mixed effects models The basic theory and application in R Author: Mitchel van Loon Research

More information

Multiple Linear Regression

Multiple Linear Regression Multiple Linear Regression Simple linear regression tries to fit a simple line between two variables Y and X. If X is linearly related to Y this explains some of the variability in Y. In most cases, there

More information

Factorial and Unbalanced Analysis of Variance

Factorial and Unbalanced Analysis of Variance Factorial and Unbalanced Analysis of Variance Nathaniel E. Helwig Assistant Professor of Psychology and Statistics University of Minnesota (Twin Cities) Updated 04-Jan-2017 Nathaniel E. Helwig (U of Minnesota)

More information

Chapter 14. Linear least squares

Chapter 14. Linear least squares Serik Sagitov, Chalmers and GU, March 5, 2018 Chapter 14 Linear least squares 1 Simple linear regression model A linear model for the random response Y = Y (x) to an independent variable X = x For a given

More information

Mixed models in R using the lme4 package Part 3: Linear mixed models with simple, scalar random effects

Mixed models in R using the lme4 package Part 3: Linear mixed models with simple, scalar random effects Mixed models in R using the lme4 package Part 3: Linear mixed models with simple, scalar random effects Douglas Bates University of Wisconsin - Madison and R Development Core Team

More information

Multiple Predictor Variables: ANOVA

Multiple Predictor Variables: ANOVA What if you manipulate two factors? Multiple Predictor Variables: ANOVA Block 1 Block 2 Block 3 Block 4 A B C D B C D A C D A B D A B C Randomized Controlled Blocked Design: Design where each treatment

More information

Model checking overview. Checking & Selecting GAMs. Residual checking. Distribution checking

Model checking overview. Checking & Selecting GAMs. Residual checking. Distribution checking Model checking overview Checking & Selecting GAMs Simon Wood Mathematical Sciences, University of Bath, U.K. Since a GAM is just a penalized GLM, residual plots should be checked exactly as for a GLM.

More information

Lecture 2. The Simple Linear Regression Model: Matrix Approach

Lecture 2. The Simple Linear Regression Model: Matrix Approach Lecture 2 The Simple Linear Regression Model: Matrix Approach Matrix algebra Matrix representation of simple linear regression model 1 Vectors and Matrices Where it is necessary to consider a distribution

More information

13. October p. 1

13. October p. 1 Lecture 8 STK3100/4100 Linear mixed models 13. October 2014 Plan for lecture: 1. The lme function in the nlme library 2. Induced correlation structure 3. Marginal models 4. Estimation - ML and REML 5.

More information

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

Mixed models in R using the lme4 package Part 7: Generalized linear mixed models Mixed models in R using the lme4 package Part 7: Generalized linear mixed models Douglas Bates University of Wisconsin - Madison and R Development Core Team University of

More information

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 A Handbook of Statistical Analyses Using R 2nd Edition Brian S. Everitt and Torsten Hothorn CHAPTER 12 Analysing Longitudinal Data I: Computerised Delivery of Cognitive Behavioural Therapy Beat the Blues

More information

Two Hours. Mathematical formula books and statistical tables are to be provided THE UNIVERSITY OF MANCHESTER. 26 May :00 16:00

Two Hours. Mathematical formula books and statistical tables are to be provided THE UNIVERSITY OF MANCHESTER. 26 May :00 16:00 Two Hours MATH38052 Mathematical formula books and statistical tables are to be provided THE UNIVERSITY OF MANCHESTER GENERALISED LINEAR MODELS 26 May 2016 14:00 16:00 Answer ALL TWO questions in Section

More information

Non-Gaussian Response Variables

Non-Gaussian Response Variables Non-Gaussian Response Variables What is the Generalized Model Doing? The fixed effects are like the factors in a traditional analysis of variance or linear model The random effects are different A generalized

More information

Multiple Predictor Variables: ANOVA

Multiple Predictor Variables: ANOVA Multiple Predictor Variables: ANOVA 1/32 Linear Models with Many Predictors Multiple regression has many predictors BUT - so did 1-way ANOVA if treatments had 2 levels What if there are multiple treatment

More information

Mixed models in R using the lme4 package Part 1: Linear mixed models with simple, scalar random

Mixed models in R using the lme4 package Part 1: Linear mixed models with simple, scalar random Mixed models in R using the lme4 package Part 1: Linear mixed models with simple, scalar random effects Douglas Bates 8 th International Amsterdam Conference on Multilevel Analysis

More information

Linear Regression Models P8111

Linear Regression Models P8111 Linear Regression Models P8111 Lecture 25 Jeff Goldsmith April 26, 2016 1 of 37 Today s Lecture Logistic regression / GLMs Model framework Interpretation Estimation 2 of 37 Linear regression Course started

More information

Hypothesis Testing hypothesis testing approach

Hypothesis Testing hypothesis testing approach Hypothesis Testing In this case, we d be trying to form an inference about that neighborhood: Do people there shop more often those people who are members of the larger population To ascertain this, we

More information

Concordia University (5+5)Q 1.

Concordia University (5+5)Q 1. (5+5)Q 1. Concordia University Department of Mathematics and Statistics Course Number Section Statistics 360/1 40 Examination Date Time Pages Mid Term Test May 26, 2004 Two Hours 3 Instructor Course Examiner

More information

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

These slides illustrate a few example R commands that can be useful for the analysis of repeated measures data. These slides illustrate a few example R commands that can be useful for the analysis of repeated measures data. We focus on the experiment designed to compare the effectiveness of three strength training

More information

STAT 350: Geometry of Least Squares

STAT 350: Geometry of Least Squares The Geometry of Least Squares Mathematical Basics Inner / dot product: a and b column vectors a b = a T b = a i b i a b a T b = 0 Matrix Product: A is r s B is s t (AB) rt = s A rs B st Partitioned Matrices

More information

BIO5312 Biostatistics Lecture 13: Maximum Likelihood Estimation

BIO5312 Biostatistics Lecture 13: Maximum Likelihood Estimation BIO5312 Biostatistics Lecture 13: Maximum Likelihood Estimation Yujin Chung November 29th, 2016 Fall 2016 Yujin Chung Lec13: MLE Fall 2016 1/24 Previous Parametric tests Mean comparisons (normality assumption)

More information

STAT5044: Regression and Anova. Inyoung Kim

STAT5044: Regression and Anova. Inyoung Kim STAT5044: Regression and Anova Inyoung Kim 2 / 47 Outline 1 Regression 2 Simple Linear regression 3 Basic concepts in regression 4 How to estimate unknown parameters 5 Properties of Least Squares Estimators:

More information

over Time line for the means). Specifically, & covariances) just a fixed variance instead. PROC MIXED: to 1000 is default) list models with TYPE=VC */

over Time line for the means). Specifically, & covariances) just a fixed variance instead. PROC MIXED: to 1000 is default) list models with TYPE=VC */ CLP 944 Example 4 page 1 Within-Personn Fluctuation in Symptom Severity over Time These data come from a study of weekly fluctuation in psoriasis severity. There was no intervention and no real reason

More information

Hands on cusp package tutorial

Hands on cusp package tutorial Hands on cusp package tutorial Raoul P. P. P. Grasman July 29, 2015 1 Introduction The cusp package provides routines for fitting a cusp catastrophe model as suggested by (Cobb, 1978). The full documentation

More information

ANOVA (Analysis of Variance) output RLS 11/20/2016

ANOVA (Analysis of Variance) output RLS 11/20/2016 ANOVA (Analysis of Variance) output RLS 11/20/2016 1. Analysis of Variance (ANOVA) The goal of ANOVA is to see if the variation in the data can explain enough to see if there are differences in the means.

More information

Statistical Distribution Assumptions of General Linear Models

Statistical Distribution Assumptions of General Linear Models Statistical Distribution Assumptions of General Linear Models Applied Multilevel Models for Cross Sectional Data Lecture 4 ICPSR Summer Workshop University of Colorado Boulder Lecture 4: Statistical Distributions

More information

Mixed models in R using the lme4 package Part 1: Linear mixed models with simple, scalar random effects

Mixed models in R using the lme4 package Part 1: Linear mixed models with simple, scalar random effects Mixed models in R using the lme4 package Part 1: Linear mixed models with simple, scalar random effects Douglas Bates 2011-03-16 Contents 1 Packages 1 2 Dyestuff 2 3 Mixed models 5 4 Penicillin 10 5 Pastes

More information

Lecture 15. Hypothesis testing in the linear model

Lecture 15. Hypothesis testing in the linear model 14. Lecture 15. Hypothesis testing in the linear model Lecture 15. Hypothesis testing in the linear model 1 (1 1) Preliminary lemma 15. Hypothesis testing in the linear model 15.1. Preliminary lemma Lemma

More information

Lecture 10. Factorial experiments (2-way ANOVA etc)

Lecture 10. Factorial experiments (2-way ANOVA etc) Lecture 10. Factorial experiments (2-way ANOVA etc) Jesper Rydén Matematiska institutionen, Uppsala universitet jesper@math.uu.se Regression and Analysis of Variance autumn 2014 A factorial experiment

More information

Answer to exercise: Blood pressure lowering drugs

Answer to exercise: Blood pressure lowering drugs Answer to exercise: Blood pressure lowering drugs The data set bloodpressure.txt contains data from a cross-over trial, involving three different formulations of a drug for lowering of blood pressure:

More information

Model comparison and selection

Model comparison and selection BS2 Statistical Inference, Lectures 9 and 10, Hilary Term 2008 March 2, 2008 Hypothesis testing Consider two alternative models M 1 = {f (x; θ), θ Θ 1 } and M 2 = {f (x; θ), θ Θ 2 } for a sample (X = x)

More information

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

Mixed models in R using the lme4 package Part 5: Generalized linear mixed models Mixed models in R using the lme4 package Part 5: Generalized linear mixed models Douglas Bates Madison January 11, 2011 Contents 1 Definition 1 2 Links 2 3 Example 7 4 Model building 9 5 Conclusions 14

More information

Random Intercept Models

Random Intercept Models Random Intercept Models Edps/Psych/Soc 589 Carolyn J. Anderson Department of Educational Psychology c Board of Trustees, University of Illinois Spring 2019 Outline A very simple case of a random intercept

More information

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

Mixed models in R using the lme4 package Part 2: Longitudinal data, modeling interactions Mixed models in R using the lme4 package Part 2: Longitudinal data, modeling interactions Douglas Bates Department of Statistics University of Wisconsin - Madison Madison January 11, 2011

More information

Mixed models in R using the lme4 package Part 4: Theory of linear mixed models

Mixed models in R using the lme4 package Part 4: Theory of linear mixed models Mixed models in R using the lme4 package Part 4: Theory of linear mixed models Douglas Bates 8 th International Amsterdam Conference on Multilevel Analysis 2011-03-16 Douglas Bates

More information

Stat 5303 (Oehlert): Tukey One Degree of Freedom 1

Stat 5303 (Oehlert): Tukey One Degree of Freedom 1 Stat 5303 (Oehlert): Tukey One Degree of Freedom 1 > catch

More information

Final Review. Yang Feng. Yang Feng (Columbia University) Final Review 1 / 58

Final Review. Yang Feng.   Yang Feng (Columbia University) Final Review 1 / 58 Final Review Yang Feng http://www.stat.columbia.edu/~yangfeng Yang Feng (Columbia University) Final Review 1 / 58 Outline 1 Multiple Linear Regression (Estimation, Inference) 2 Special Topics for Multiple

More information

Multilevel Models in Matrix Form. Lecture 7 July 27, 2011 Advanced Multivariate Statistical Methods ICPSR Summer Session #2

Multilevel Models in Matrix Form. Lecture 7 July 27, 2011 Advanced Multivariate Statistical Methods ICPSR Summer Session #2 Multilevel Models in Matrix Form Lecture 7 July 27, 2011 Advanced Multivariate Statistical Methods ICPSR Summer Session #2 Today s Lecture Linear models from a matrix perspective An example of how to do

More information

Maximum Likelihood Estimation

Maximum Likelihood Estimation Maximum Likelihood Estimation Merlise Clyde STA721 Linear Models Duke University August 31, 2017 Outline Topics Likelihood Function Projections Maximum Likelihood Estimates Readings: Christensen Chapter

More information

Day 4: Shrinkage Estimators

Day 4: Shrinkage Estimators Day 4: Shrinkage Estimators Kenneth Benoit Data Mining and Statistical Learning March 9, 2015 n versus p (aka k) Classical regression framework: n > p. Without this inequality, the OLS coefficients have

More information

Applied Multivariate and Longitudinal Data Analysis

Applied Multivariate and Longitudinal Data Analysis Applied Multivariate and Longitudinal Data Analysis Chapter 2: Inference about the mean vector(s) II Ana-Maria Staicu SAS Hall 5220; 919-515-0644; astaicu@ncsu.edu 1 1 Compare Means from More Than Two

More information

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

Outline. Mixed models in R using the lme4 package Part 5: Generalized linear mixed models. Parts of LMMs carried over to GLMMs Outline Mixed models in R using the lme4 package Part 5: Generalized linear mixed models Douglas Bates University of Wisconsin - Madison and R Development Core Team UseR!2009,

More information