Stat 579: Generalized Linear Models and Extensions

Size: px
Start display at page:

Download "Stat 579: Generalized Linear Models and Extensions"

Transcription

1 Stat 579: Generalized Linear Models and Extensions Linear Mixed Models for Longitudinal Data Yan Lu April, 2018, week 14 1 / 64

2 Data structure and Model t1 t2 tn i 1st subject y 11 y 12 y 1n1 2nd subject y 21 y 22 y 2n2. mth subject y m1 y m2 y mnm Model: y ij = β i0 + β i1 t ij + ɛ ij = (β 0 + b i0 ) + (β 1 + b i1 )t ij + ɛ ij = β 0 + β 1 t ij + b i0 + b i1 t ij + ɛ ij b i0 and b i1 are random. 2 / 64

3 y i = y i1 y i2. y ini Y i = Z i β i + ɛ i β = = Z i (β + b i ) + ɛ i = Z i β + Z i b i + ɛ i (1) [ ] [ ] β0 bi0, b i = β 1 1 t i1 1 t i2, Z i =.. 1 t ini b i1, ɛ i = ɛ 1 ɛ 2. ɛ m 3 / 64

4 β is average of intercepts and slopes across subjects in population b i is subject specific deviation of intercept and slope from population average values. -we think of b i as random effects that describe how much the ith subjects regression coefficients differ from population values Usually assume that E(b i ) = 0 and Var(b i ) = g, where g specifies how regression effect vary and covary across subjects in population. 4 / 64

5 E(Y i ) = E {Z i β + Z i b i + ɛ i } = Z i β + Z i E(b i ) + E(ɛ i ) = Z i β or alternative, E(Y ij ) = β 0 + β 1 t ij, j = 1, 2,, n i -assume that b i and ɛ i are independent (the deviations in regression coefficients are independent of the within individual deviations) var(y i ) = var(z i β + Z i b i + ɛ i ) = var(z i b i + ɛ i ) = var(z i b i ) + var(ɛ i ) = Z i gz i + R i 5 / 64

6 We also typically assume normality of ɛ i and b i, that is which implies ɛ i N(0, R i ), b i N(0, g) Y i = Z i β + Z i b i + ɛ i N(Z i β, Z i gz i + R i ) Y i Z i, β i N(Z i β i, R i ), i.e., Y i = Z i β i + ɛ i with ɛ i N(0, R i ) β i Z i N(β, g) Y i Z i N(Z i β, Z i gz i + R i ) 6 / 64

7 Remarks: Assuming a linear relationship within individuals implies that the population mean response changes linearly with time, where the population regression line has an intercept and slope that are averages of subject specific intercepts and slopes. How do I think about var(b i ) = g if the specific lines are parallel to the population mean line with different intercepts, var(b i0 ) > var(b i1 ) 0 if the specific lines display a funnel shape opening to right, individual slopes increase as intercepts increase, so cov(b i0, b i1 ) > 0 if the specific lines interacted with each other, individual slopes decrease as intercepts increase, so that cov(b i0, b i1 ) < 0 7 / 64

8 The marginal models in week 13 allow the mean to vary with time, but assumed that whereas here we have var(y i ) = Σ i Var(Y i ) = Z i gz i + R i since Z i depends on times t ij (more specifically Z i gz i has elements that are quadratic in time) - only very special cases where our current model reduces to models considered in week13. -if var(b i1 ) = 0, (implies a model with random intercepts but fixed slopes), and if R i = σ 2 I ni, we get var(y i ) having a homogeneous intraclass structure 8 / 64

9 Multiple groups Recall Y i = Z i β + Z i b i + ɛ i has a fixed effect component β and a random effect component b i plus an independent residual component ɛ i. Thus mixed effects model is the endproduct of a random coefficient regression model. Because the design matrices for β and b i are both Z i, it is easy to recognize that the random effect piece just specifies subject deviations from Z i β, i.e., Z i (β + b i ) = Z i β + Z i b i 9 / 64

10 Recall Y i = Z i β + Z i b i + ɛ i y i = y i1 y i2. y ini β = [ β0 β 1 ] [ bi0, b i = 1 t i1 1 t i2, Z i =.. 1 t ini b i1 ], ɛ i = ɛ 1 ɛ 2. ɛ m 10 / 64

11 More generally, a mixed model has structure Y i = X i β + Z i b i + ɛ i (2) where X i and Z i need not have the same number of columns, or any of the same effects. Therefore, b i N(0, g) indep ɛ i N(0, R i ) Y i N(X i β, Z i gz i + R i ) we can use this more general structure so that our model (1) can handle multiple groups i.e., boys and girls in the dental data. The key to generalizing (1) to multiple groups is to modify th fixed effects portion of the model so populations of boys and girls have their own regression line, but they have the subject specific deviation alone. 11 / 64

12 The simplest means to this end is to define boy and girl population mean regression coefficients β g = and write [ βg0 β g1 ] [ βb0, β B = β B1 ] [ βg, β = β B ] = { Zi β Y i = g + Z i b i + ɛ i child i is a girl Z i β B + Z i b i + ɛ i child i is a boy β g0 β g1 β B0 β B1 12 / 64

13 Define Recall that So that [ ] A i = [ ] β = [ βg β B ] = child i is a girl child i is a boy β g0 β g1 β B0 β B1 { βg girls A i β = boys All A i does is pick out elements for boys and girls in β. Thus we can more compactly write the model as β B Y i = Z i A i β + Z i b i + ɛ i = X i β + Z i b i + ɛ i 13 / 64

14 X i = Z i A i 1 t [ ] i t i2 =.. [ ] t ini t i t i girls 1 t = ini 0 0 = t i t i2.... boys t ini where δ i = { 1 girls 0 boys child i is a girl child i is a boy δ i δ i t i1 (1 δ i ) (1 δ i )t i1 δ i δ i t i2 (1 δ i ) (1 δ i )t i2.... δ i δ i t ini (1 δ i ) (1 δ i )t ini X i is simply the SGP design matrix used earlier. We could have perhaps written down the model directly without ever defining A i 14 / 64

15 Discussion POPULATION-AVERAGED VS. SUBJECT-SPECIFIC : population-averaged approach: the focus of modeling is on the averages (means) across the population of units at each time point, and how these averages are related over time. subject-specific approach: the focus of modeling is on individual units. In the case where the models considered are linear, the two perspectives ultimately lead to the same type of model for the mean, so that either interpretation is valid. But this is not the case with non-linear models or models for non-normal data. 15 / 64

16 The subject-specific, random coefficient approach has the additional feature that it automatically leads to a particular assumption about the structure of the covariance matrix of a data vector, which naturally acknowledges within and among-unit variation separately. In contrast, the population-averaged approach forces the data analyst to model this covariance, thinking about the two sources of variation together. As a result, the subject-specific approach of the random coefficient model, and, more generally, the linear mixed effects models has become incredibly popular. ALTERNATIVE TERMINOLOGY: The random coefficient model, allowing for the possibility of different groups, is sometimes referred to as a growth curve model in the statistical and subject-matter literature. 16 / 64

17 CHOICE OF COVARIANCE STRUCTURE: One may in principle take the covariance matrix R i, corresponding to within-unit variation, to be one of a variety of structures according to knowledge of the data collection process. If the main source of within-unit variation is measurement error, or if it is instead fluctuation but observations are far apart in time taking R i diagonal may be reasonable. One may in principle take the covariance matrix var(b i ), characterizing variation among units (through how the parameters in the individual trajectories vary) to be the same for all groups or different, depending on the belief about the pattern of variation for each group. 17 / 64

18 The most commonly-used form of the random coefficient model is that where R i = σ 2 I ni, var(b i ) = g = same for all groups Often this structure is suitable; e.g. units tend to vary similarly for each group, although the means may be different. This same kind of assumption (means differ, variance the same) is standard in usual analysis of variance models and methods. This model is considered extensively and almost exclusively in much of the literature. It is certainly possible to relax these assumptions; for example, we can take g to be different for each gender group in the dental data example. 18 / 64

19 One pitfall of trying to get too fancy with modeling of R i and var(b i ) is that it is quite likely that one will end up with a model that is too complicated to be sorted out given the data at hand. Identifiability becomes a problem. Many people are willing to risk the possibility that they may incorrectly specify R i and/or g by, for example, assuming that the var(b i ) = g is common to all groups when it may not be. The form of the model Σ i = Z i gz i + R i is sufficiently general that, even if the two components g and R i are not exactly correctly chosen, the resulting Σ i matrix will differ very little from that one would obtain if they were. Thus, if one s main interest is in estimating β and tests about it, this may be okay. 19 / 64

20 However, if interest is focused on b i and R i themselves, then obviously one would want to investigate all possibilities. However, be aware that fitting very fancy models may lead to difficulties and over-fitting. 20 / 64

21 Example: dental data Orthodontic distance is measured at ages t i1 = 8, t i2 = 10, t i3 = 12, t i4 = 14 (n i = 4) for each subject from 2 groups (boys (red) and girls (black)) > ex.data obs subject age distance gender / 64

22 > aa<-aggregate(distance~age+gender, data=ex.data, mean) #cell means > aa age gender distance / 64

23 #interaction plots par(mfrow=c(1,1),oma=c(0,0,3,0),pch=42,font.sub=3,adj=0.5) interaction.plot(ex.data$age,ex.data$gender, ex.data$distance, trace.label="gender",xlab="age",ylab="distance", col=c("black","red")) mtext(side=3,outer=t,line=0,cex=1.3,"age Distance Study") par(adj=1) title(sub="interact.ps") saveplot(filename="dentalinteraction", type=c("png"), device=dev.cur()) 23 / 64

24 Figure 1: Sample means at each time across children gender distance age Increasing linear trend with time, males (red) and females (black) have different intercepts and possibly different slopes. 24 / 64

25 par(mfrow=c(1,1),oma=c(0,0,3,0),pch=42,font.sub=3,adj=0.5) interaction.plot(ex.data2$age,ex.data2$child, ex.data2$distance, trace.label="girls",xlab="age", ylab="distance",col=1:11) mtext(side=3,outer=t,line=0,cex=1.3, "Age Distance Study Female") par(adj=1) title(sub="interact2.ps") saveplot(filename="dentalinteraction2", type=c("png"), device=dev.cur()) 25 / 64

26 Figure 2: Sample means at each time across children Increasing linear trend with time 26 / 64

27 par(mfrow=c(1,1),oma=c(0,0,3,0),pch=42,font.sub=3,adj=0.5) interaction.plot(ex.data3$age,ex.data3$child, ex.data3$distance, trace.label="boys",xlab="age",ylab="distance",col=1:16) mtext(side=3,outer=t,line=0,cex=1.3, "Age Distance Study Male") par(adj=1) title(sub="interact3.ps") saveplot(filename="dentalinteraction3", type=c("png"), device=dev.cur()) 27 / 64

28 Figure 3: Sample means at each time across children Increasing linear trend with time, more interactions observed. 28 / 64

29 > ##test if the two covariance matrices are equivalent across the groups > tres <- boxm(d2[, 3:6], d2[, "gender"]) > tres Box s M-test for Homogeneity of Covariance Matrices data: d2[, 3:6] Chi-Sq (approx.) = , df = 10, p-value = Do not reject the null hypothesis of equivalent covariance matrices across the groups. 29 / 64

30 Fit the model, with common g matrix for both genders, using default that diagonal within-child covariance matrix R i with same variance σ 2 for each gender. The random effects structure is specified in parentheses here, we allow for random intercept and slope that are correlated 30 / 64

31 myfit <- lmer(distance ~ -1 + gender + age:gender + (1 + age child), REML=FALSE,data=ex.data) summary(myfit) anova(myfit) 31 / 64

32 > summary(myfit) Linear mixed model fit by maximum likelihood t-tests use Satterthwaite approximations to degrees of freedom [lmermod] Formula: distance ~ -1 + gender + age:gender + (1 + age child) Data: ex.data AIC BIC loglik deviance df.resid Random effects: Groups Name Variance Std.Dev. Corr child (Intercept) age Residual Number of obs: 108, groups: child, / 64

33 [ g = ] 33 / 64

34 Fixed effects: Estimate Std. Error df t value Pr(> t ) gender e-14 * gender e-16 * gender0:age e-05 * gender1:age e-10 * --- Signif. codes: 0 *** ** 0.01 * Correlation of Fixed Effects: gendr0 gendr1 gndr0: gender gender0:age gender1:age / 64

35 > anova(myfit) Analysis of Variance Table of type III with Satterthwaite approximation for degrees of freedom Sum Sq Mean Sq NumDF DenDF F.value Pr(>F) gender < 2.2e-16 *** gender:age e-10 *** --- Signif. codes: 0 *** ** 0.01 * / 64

36 Figure 4: scatter plot of boys after Centering and scaling Age Age 10 Age Age 14 Boys observe positive correlations between times 36 / 64

37 Figure 5: scatter plot of girls after Centering and scaling Age Age 10 Age Age 14 Girls observe positive correlations between times 37 / 64

38 Fit two parameterizations of a regression model Difference group parametrization (DGP) Separate group parametrization (SGP) ex.data$child <- factor(ex.data$child) ex.data$gender <- factor(ex.data$gender) # First do OLS fit ignoring correlation # Assume group difference paramatrization fit.ls.dgp <- lm(distance ~ gender + age+ age:gender, data=ex.data) summary(fit.ls.dgp) # Assume separate intercept and slope by gender fit.ls.sgp <- lm(distance ~ -1 + gender+ age:gender, data=ex.data) summary(fit.ls.sgp) 38 / 64

39 DGP Coefficients: ## Estimate Std. Error t value Pr(> t ) ## (Intercept) < 2e-16 *** ## gender ## age ** ## gender1:age The estimated mean function for girls is AGE. The estimated mean function for boys is ( ) + ( )AGE = AGE. 39 / 64

40 SGP Coefficients: ## Estimate Std. Error t value Pr(> t ) ## gender < 2e-16 *** ## gender < 2e-16 *** ## gender0:age ** ## gender1:age e-08 *** The estimated mean function for girls is AGE. The estimated mean function for boys is AGE. 40 / 64

41 GLS fit, nlme package Model (a): unstructured Σ i Common unstructured correlation Σ i with variances changing over time for both genders Note that gls() defines BIC dfferently from SAS (it uses the total number of observations N while SAS MIXED uses the total number of individuals m The weights statement makes the variances on the diagonal differ over time - the default with no weight statement is that they are the same for all times Note that standard error estimates of ˆβ are not correct, need to use robust.cov function to derive the correct ses. 41 / 64

42 fit.un <- gls(distance ~ -1 + gender + age:gender, data=ex.data,correlation=corsymm(form=~1 child), weights=varident(form=~1 age),method="ml") ##varident: constant variance(s), generally used to allow # different variances according #to the levels of a classification factor. 42 / 64

43 rbind(beta.un,sebeta.un) ## gender0 gender1 gender0:age gender1:age ## beta.un ## sebeta.un sebeta.un.corrected ## gender0 gender1 gender0:age gender1:age ## #marginal covariance and correlation matrices V.un ## Marginal variance covariance matrix ## [,1] [,2] [,3] [,4] ## [1,] ## [2,] ## [3,] ## [4,] ## Standard Deviations: / 64

44 (b2) Compound symmetry with variance different by gender fit.cs2 <- gls(distance ~ -1 + gender + gender:age, data=ex.data,correlation=corcompsymm(form = ~ 1 child), weights = varident(form = ~ 1 gender),method="ml") beta.cs2 <- coef(fit.cs2) sebeta.cs2 <- summary(fit.cs2)$ttable[,"std.error"] V.cs2.girl <- getvarcov(fit.cs2, individual=1) V.cs2.boy <- getvarcov(fit.cs2, individual=12) Gamma.cs2 <- cov2cor(v.cs2.girl) 44 / 64

45 rbind(beta.cs2,sebeta.cs2) ## gender0 gender1 gender0:age gender1:age ## beta.cs ## sebeta.cs V.cs2.girl ## Marginal variance covariance matrix ## [,1] [,2] [,3] [,4] ## [1,] ## [2,] ## [3,] ## [4,] ## Standard Deviations: / 64

46 V.cs2.boy ## Marginal variance covariance matrix ## [,1] [,2] [,3] [,4] ## [1,] ## [2,] ## [3,] ## [4,] ## Standard Deviations: Gamma.cs2 ## Marginal variance covariance matrix ## [,1] [,2] [,3] [,4] ## [1,] ## [2,] ## [3,] ## [4,] ## Standard Deviations: / 64

47 Model selection SAS and R use different conventions to calculate AIC and BIC. We have used ML here, in which case AIC is the same but BIC differs as noted above. If we d used REML, both AIC and BIC values are calculated differently by SAS and R using different conventions regarding the number of observations and number of parameters, so are not comparable, but can be compared within a single implementation (but not across SAS and R). Use the anova() function to compare the models Both AIC and BIC support the common compound symmetric correlation model with different variance for each gender (constant across time). 47 / 64

48 anova(fit.un,fit.cs,fit.cs2,fit.ar1) ## Model df AIC BIC loglik ## fit.un ## fit.cs ## fit.cs ## fit.ar Test L.Ratio p-value 1 vs vs vs < / 64

49 Fitting linear mixed effects models uing the lme() function in nlme A general call to lme() looks like fit.object$ <-$ lme(model formula, random, correlation, weights, data) Correlation is a specification for the within-individual correlation structure R i ; the variable on the right specifies the factor determining sets of observations that are assumed independent/uncorrelated (observations are independent by child here). Visit for more info and visit the corclasses and corstruct link for lists of built-in correlation structures. 49 / 64

50 weights is a specification for the nature of the within-individual variances R i ; the variable on the right specifies a feature by which they can be different. Here, using age specifies that the variances on the diagonal of the overall covariance matrix can be different across age (time); using gender specifies a different variance for each gender (common for all times); and using gender*age gives variances that change over age and are different between genders. In gnenerl, the weights option allows one to make the variance on the diagonal of the overall covariance model be different depending on a group factor by weights = varident(form = 1 groupvar ) or to change over time by weights = varident(form = 1 timevar ) 50 / 64

51 Model (a): Common g or D matrix for both genders default diagonal within-child covariance matrix R i with same variance σ 2 for each gender. Thus, σ 2 is the sum of realization process and measurement error variance 51 / 64

52 dental.lme.a <- lme(distance ~ -1 + gender + age:gender, data=thedat,random = ~ age child,method="ml") beta.a <- fixed.effects(dental.lme.a) # beta, also fixef(dental.lme.a) b.a <- random.effects(dental.lme.a) # posterior modes bi, also ranef(dental.lme.a) sebeta.a <- summary(dental.lme.a)$ttable[,"std.error"] # these SEs are "off" by a factor very close to 1 D.a <- getvarcov(dental.lme.a, type="random.effects") # sigma2.a <- dental.lme.a$sigma^2 # sigma^2 V.a <- getvarcov(dental.lme.a,type="marginal", individual=1) # V_i R.a <- getvarcov(dental.lme.a,type="conditional", individual=1) # R_i 52 / 64

53 sebeta.a <- summary(dental.lme.a)$ttable[,"std.error"] # these SEs are "off" by a factor very close to 1, DON T # The attribute varfix returns the CORRECT # model-based covariance matrix! # Thus, the square roots of its diagonal elements are # model-based standard errors (compare to SAS) # USE THE FOLLOWING ONE FOR SEs sebeta.model.a <- sqrt(diag(dental.lme.a$varfix)) > sebeta.a gender0 gender1 gender0:age gender1:age > sebeta.model.a gender0 gender1 gender0:age gender1:age / 64

54 # Compare the fitted models via AIC and BIC; model (b), # with diagonal R_i with gender-specific within-child # variances and common random effects covariance # matrix D is preferred dental.lme.b <- lme(distance ~ -1 + gender + age:gender, data=thedat, random = ~ age child, weights = varident(form = ~ 1 gender), method="ml") 54 / 64

55 # Refit model (b) using REML and get dental.lme.b.reml <- lme(distance ~ -1 + gender + age:gender,data=thedat, random = ~ age child, weights = varident(form = ~ 1 gender)) beta.b.reml <- fixed.effects(dental.lme.b.reml) # beta sebeta.model.b.reml <- sqrt(diag(dental.lme.b$varfix)) b.b.reml <- random.effects(dental.lme.b.reml) # posterior modes bi D.b.reml <- getvarcov(dental.lme.b.reml, type="random.effects") # D 55 / 64

56 #Random effects empirical Bayes estimates bhat_i for first 5 girls b.b.reml[1:20,] ## (Intercept) age ## ## ## ## ## ## ## ## ## ## ## ## ## / 64

57 # PA predicted values X_i betahat are produced by level=0; #SS predicted values X_i betahat + Z_i bhat_i are produced # by level =1; both are gotten by level = 0:1 fitted(dental.lme.b.reml,level=0:1)[1:20,] ## fixed child ## ## ## ## ## ## ## ## ## ## ## / 64

58 # Plot SS residuals vs. predicted values #pdf("dental.residplot.pdf",width=10) plot(dental.lme.b.reml, resid(., type="p",level=1) ~ fitted(.,level=1) ) qqnorm(dental.lme.b.reml, ~ resid(., type="p",level=1), abline=c(0,1)) # One can also make QQ plots and histograms of # the bhat_i themselves to assess the normality of # the random effects, but remember that # these are "shrunken" so could be misleading. qqnorm(dental.lme.b.reml, ~ ranef(.)) 58 / 64

59 Figure 6: Plot SS residuals vs. predicted values Fitted values Standardized residuals Didn t notice obvious pattern. 59 / 64

60 Figure 7: QQ plot of SS residuals Standardized residuals Quantiles of standard normal Not too bad. 60 / 64

61 Figure 8: QQ plots for estimated random effects Random effects Quantiles of standard normal (Intercept) age Not too bad. 61 / 64

Stat 579: Generalized Linear Models and Extensions

Stat 579: Generalized Linear Models and Extensions Stat 579: Generalized Linear Models and Extensions Linear Mixed Models for Longitudinal Data Yan Lu April, 2018, week 12 1 / 34 Correlated data multivariate observations clustered data repeated measurement

More information

Stat 579: Generalized Linear Models and Extensions

Stat 579: Generalized Linear Models and Extensions Stat 579: Generalized Linear Models and Extensions Linear Mixed Models for Longitudinal Data Yan Lu April, 2018, week 15 1 / 38 Data structure t1 t2 tn i 1st subject y 11 y 12 y 1n1 Experimental 2nd subject

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

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

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

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

ST 732, Midterm Solutions Spring 2019

ST 732, Midterm Solutions Spring 2019 ST 732, Midterm Solutions Spring 2019 Please sign the following pledge certifying that the work on this test is your own: I have neither given nor received aid on this test. Signature: Printed Name: There

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

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

Covariance Models (*) X i : (n i p) design matrix for fixed effects β : (p 1) regression coefficient for fixed effects

Covariance Models (*) X i : (n i p) design matrix for fixed effects β : (p 1) regression coefficient for fixed effects Covariance Models (*) Mixed Models Laird & Ware (1982) Y i = X i β + Z i b i + e i Y i : (n i 1) response vector X i : (n i p) design matrix for fixed effects β : (p 1) regression coefficient for fixed

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

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

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

22s:152 Applied Linear Regression. Take random samples from each of m populations.

22s:152 Applied Linear Regression. Take random samples from each of m populations. 22s:152 Applied Linear Regression Chapter 8: ANOVA NOTE: We will meet in the lab on Monday October 10. One-way ANOVA Focuses on testing for differences among group means. Take random samples from each

More information

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

Repeated Measures ANOVA Multivariate ANOVA and Their Relationship to Linear Mixed Models Repeated Measures ANOVA Multivariate ANOVA and Their Relationship to Linear Mixed Models EPSY 905: Multivariate Analysis Spring 2016 Lecture #12 April 20, 2016 EPSY 905: RM ANOVA, MANOVA, and Mixed Models

More information

MIXED MODELS FOR REPEATED (LONGITUDINAL) DATA PART 2 DAVID C. HOWELL 4/1/2010

MIXED MODELS FOR REPEATED (LONGITUDINAL) DATA PART 2 DAVID C. HOWELL 4/1/2010 MIXED MODELS FOR REPEATED (LONGITUDINAL) DATA PART 2 DAVID C. HOWELL 4/1/2010 Part 1 of this document can be found at http://www.uvm.edu/~dhowell/methods/supplements/mixed Models for Repeated Measures1.pdf

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

#Alternatively we could fit a model where the rail values are levels of a factor with fixed effects

#Alternatively we could fit a model where the rail values are levels of a factor with fixed effects examples-lme.r Tue Nov 25 12:32:20 2008 1 library(nlme) # The following data shows the results of tests carried over 6 rails. The response # indicated the time needed for a an ultrasonic wave to travel

More information

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

Nature vs. nurture? Lecture 18 - Regression: Inference, Outliers, and Intervals. Regression Output. Conditions for inference.

Nature vs. nurture? Lecture 18 - Regression: Inference, Outliers, and Intervals. Regression Output. Conditions for inference. Understanding regression output from software Nature vs. nurture? Lecture 18 - Regression: Inference, Outliers, and Intervals In 1966 Cyril Burt published a paper called The genetic determination of differences

More information

Biostatistics Workshop Longitudinal Data Analysis. Session 4 GARRETT FITZMAURICE

Biostatistics Workshop Longitudinal Data Analysis. Session 4 GARRETT FITZMAURICE Biostatistics Workshop 2008 Longitudinal Data Analysis Session 4 GARRETT FITZMAURICE Harvard University 1 LINEAR MIXED EFFECTS MODELS Motivating Example: Influence of Menarche on Changes in Body Fat Prospective

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

22s:152 Applied Linear Regression. There are a couple commonly used models for a one-way ANOVA with m groups. Chapter 8: ANOVA

22s:152 Applied Linear Regression. There are a couple commonly used models for a one-way ANOVA with m groups. Chapter 8: ANOVA 22s:152 Applied Linear Regression Chapter 8: ANOVA NOTE: We will meet in the lab on Monday October 10. One-way ANOVA Focuses on testing for differences among group means. Take random samples from each

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

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

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

22s:152 Applied Linear Regression. Returning to a continuous response variable Y...

22s:152 Applied Linear Regression. Returning to a continuous response variable Y... 22s:152 Applied Linear Regression Generalized Least Squares Returning to a continuous response variable Y... Ordinary Least Squares Estimation The classical models we have fit so far with a continuous

More information

Multiple Linear Regression

Multiple Linear Regression Multiple Linear Regression ST 430/514 Recall: a regression model describes how a dependent variable (or response) Y is affected, on average, by one or more independent variables (or factors, or covariates).

More information

Fitting mixed models in R

Fitting mixed models in R Fitting mixed models in R Contents 1 Packages 2 2 Specifying the variance-covariance matrix (nlme package) 3 2.1 Illustration:.................................... 3 2.2 Technical point: why to use as.numeric(time)

More information

22s:152 Applied Linear Regression. In matrix notation, we can write this model: Generalized Least Squares. Y = Xβ + ɛ with ɛ N n (0, Σ)

22s:152 Applied Linear Regression. In matrix notation, we can write this model: Generalized Least Squares. Y = Xβ + ɛ with ɛ N n (0, Σ) 22s:152 Applied Linear Regression Generalized Least Squares Returning to a continuous response variable Y Ordinary Least Squares Estimation The classical models we have fit so far with a continuous response

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

STAT 135 Lab 11 Tests for Categorical Data (Fisher s Exact test, χ 2 tests for Homogeneity and Independence) and Linear Regression

STAT 135 Lab 11 Tests for Categorical Data (Fisher s Exact test, χ 2 tests for Homogeneity and Independence) and Linear Regression STAT 135 Lab 11 Tests for Categorical Data (Fisher s Exact test, χ 2 tests for Homogeneity and Independence) and Linear Regression Rebecca Barter April 20, 2015 Fisher s Exact Test Fisher s Exact Test

More information

3 Repeated Measures Analysis of Variance

3 Repeated Measures Analysis of Variance 3 Repeated Measures Analysis of Variance 3.1 Introduction As we have discussed, many approaches have been taken in the literature to specifying statistical models for longitudinal data. Within the framework

More information

Non-independence due to Time Correlation (Chapter 14)

Non-independence due to Time Correlation (Chapter 14) Non-independence due to Time Correlation (Chapter 14) When we model the mean structure with ordinary least squares, the mean structure explains the general trends in the data with respect to our dependent

More information

Lecture 3 Linear random intercept models

Lecture 3 Linear random intercept models Lecture 3 Linear random intercept models Example: Weight of Guinea Pigs Body weights of 48 pigs in 9 successive weeks of follow-up (Table 3.1 DLZ) The response is measures at n different times, or under

More information

UNIVERSITY OF MASSACHUSETTS. Department of Mathematics and Statistics. Basic Exam - Applied Statistics. Tuesday, January 17, 2017

UNIVERSITY OF MASSACHUSETTS. Department of Mathematics and Statistics. Basic Exam - Applied Statistics. Tuesday, January 17, 2017 UNIVERSITY OF MASSACHUSETTS Department of Mathematics and Statistics Basic Exam - Applied Statistics Tuesday, January 17, 2017 Work all problems 60 points are needed to pass at the Masters Level and 75

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

STAT3401: Advanced data analysis Week 10: Models for Clustered Longitudinal Data

STAT3401: Advanced data analysis Week 10: Models for Clustered Longitudinal Data STAT3401: Advanced data analysis Week 10: Models for Clustered Longitudinal Data Berwin Turlach School of Mathematics and Statistics Berwin.Turlach@gmail.com The University of Western Australia Models

More information

UNIVERSITY OF TORONTO Faculty of Arts and Science

UNIVERSITY OF TORONTO Faculty of Arts and Science UNIVERSITY OF TORONTO Faculty of Arts and Science December 2013 Final Examination STA442H1F/2101HF Methods of Applied Statistics Jerry Brunner Duration - 3 hours Aids: Calculator Model(s): Any calculator

More information

Introduction to Mixed Models in R

Introduction to Mixed Models in R Introduction to Mixed Models in R Galin Jones School of Statistics University of Minnesota http://www.stat.umn.edu/ galin March 2011 Second in a Series Sponsored by Quantitative Methods Collaborative.

More information

Lecture 4 Multiple linear regression

Lecture 4 Multiple linear regression Lecture 4 Multiple linear regression BIOST 515 January 15, 2004 Outline 1 Motivation for the multiple regression model Multiple regression in matrix notation Least squares estimation of model parameters

More information

Introduction to the Analysis of Hierarchical and Longitudinal Data

Introduction to the Analysis of Hierarchical and Longitudinal Data Introduction to the Analysis of Hierarchical and Longitudinal Data Georges Monette, York University with Ye Sun SPIDA June 7, 2004 1 Graphical overview of selected concepts Nature of hierarchical models

More information

Outline. Linear OLS Models vs: Linear Marginal Models Linear Conditional Models. Random Intercepts Random Intercepts & Slopes

Outline. Linear OLS Models vs: Linear Marginal Models Linear Conditional Models. Random Intercepts Random Intercepts & Slopes Lecture 2.1 Basic Linear LDA 1 Outline Linear OLS Models vs: Linear Marginal Models Linear Conditional Models Random Intercepts Random Intercepts & Slopes Cond l & Marginal Connections Empirical Bayes

More information

Lecture 14: Introduction to Poisson Regression

Lecture 14: Introduction to Poisson Regression Lecture 14: Introduction to Poisson Regression Ani Manichaikul amanicha@jhsph.edu 8 May 2007 1 / 52 Overview Modelling counts Contingency tables Poisson regression models 2 / 52 Modelling counts I Why

More information

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

Modelling counts. Lecture 14: Introduction to Poisson Regression. Overview Modelling counts I Lecture 14: Introduction to Poisson Regression Ani Manichaikul amanicha@jhsph.edu Why count data? Number of traffic accidents per day Mortality counts in a given neighborhood, per week

More information

STAT763: Applied Regression Analysis. Multiple linear regression. 4.4 Hypothesis testing

STAT763: Applied Regression Analysis. Multiple linear regression. 4.4 Hypothesis testing STAT763: Applied Regression Analysis Multiple linear regression 4.4 Hypothesis testing Chunsheng Ma E-mail: cma@math.wichita.edu 4.4.1 Significance of regression Null hypothesis (Test whether all β j =

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

Information. Hierarchical Models - Statistical Methods. References. Outline

Information. Hierarchical Models - Statistical Methods. References. Outline Information Hierarchical Models - Statistical Methods Sarah Filippi 1 University of Oxford Hilary Term 2015 Webpage: http://www.stats.ox.ac.uk/~filippi/msc_ hierarchicalmodels_2015.html Lectures: Week

More information

STAT 135 Lab 10 Two-Way ANOVA, Randomized Block Design and Friedman s Test

STAT 135 Lab 10 Two-Way ANOVA, Randomized Block Design and Friedman s Test STAT 135 Lab 10 Two-Way ANOVA, Randomized Block Design and Friedman s Test Rebecca Barter April 13, 2015 Let s now imagine a dataset for which our response variable, Y, may be influenced by two factors,

More information

CO2 Handout. t(cbind(co2$type,co2$treatment,model.matrix(~type*treatment,data=co2)))

CO2 Handout. t(cbind(co2$type,co2$treatment,model.matrix(~type*treatment,data=co2))) CO2 Handout CO2.R: library(nlme) CO2[1:5,] plot(co2,outer=~treatment*type,layout=c(4,1)) m1co2.lis

More information

ST 790, Homework 1 Spring 2017

ST 790, Homework 1 Spring 2017 ST 790, Homework 1 Spring 2017 1. In EXAMPLE 1 of Chapter 1 of the notes, it is shown at the bottom of page 22 that the complete case estimator for the mean µ of an outcome Y given in (1.18) under MNAR

More information

Modeling the Covariance

Modeling the Covariance Modeling the Covariance Jamie Monogan University of Georgia February 3, 2016 Jamie Monogan (UGA) Modeling the Covariance February 3, 2016 1 / 16 Objectives By the end of this meeting, participants should

More information

Mixed Model: Split plot with two whole-plot factors, one split-plot factor, and CRD at the whole-plot level (e.g. fancier split-plot p.

Mixed Model: Split plot with two whole-plot factors, one split-plot factor, and CRD at the whole-plot level (e.g. fancier split-plot p. STAT:5201 Applied Statistic II Mixed Model: Split plot with two whole-plot factors, one split-plot factor, and CRD at the whole-plot level (e.g. fancier split-plot p.422 OLRT) Hamster example with three

More information

Multilevel/Mixed Models and Longitudinal Analysis Using Stata

Multilevel/Mixed Models and Longitudinal Analysis Using Stata Multilevel/Mixed Models and Longitudinal Analysis Using Stata Isaac J. Washburn PhD Research Associate Oregon Social Learning Center Summer Workshop Series July 2010 Longitudinal Analysis 1 Longitudinal

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

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

Introduction to Random Effects of Time and Model Estimation

Introduction to Random Effects of Time and Model Estimation Introduction to Random Effects of Time and Model Estimation Today s Class: The Big Picture Multilevel model notation Fixed vs. random effects of time Random intercept vs. random slope models How MLM =

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

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

Part III: Linear mixed effects models

Part III: Linear mixed effects models Part III: Linear mixed effects models 159 BIO 245, Spring 2018 Dental growth data Females Males Length, mm 16 18 20 22 24 26 28 30 32 11 11 4 3 2 11 4 7 11 4 3 3 2 8 4 8 5 8 58 7 1 7 5 6 9 57 2 1 9 12

More information

UNIVERSITY OF TORONTO. Faculty of Arts and Science APRIL 2010 EXAMINATIONS STA 303 H1S / STA 1002 HS. Duration - 3 hours. Aids Allowed: Calculator

UNIVERSITY OF TORONTO. Faculty of Arts and Science APRIL 2010 EXAMINATIONS STA 303 H1S / STA 1002 HS. Duration - 3 hours. Aids Allowed: Calculator UNIVERSITY OF TORONTO Faculty of Arts and Science APRIL 2010 EXAMINATIONS STA 303 H1S / STA 1002 HS Duration - 3 hours Aids Allowed: Calculator LAST NAME: FIRST NAME: STUDENT NUMBER: There are 27 pages

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

22s:152 Applied Linear Regression. Chapter 8: 1-Way Analysis of Variance (ANOVA) 2-Way Analysis of Variance (ANOVA)

22s:152 Applied Linear Regression. Chapter 8: 1-Way Analysis of Variance (ANOVA) 2-Way Analysis of Variance (ANOVA) 22s:152 Applied Linear Regression Chapter 8: 1-Way Analysis of Variance (ANOVA) 2-Way Analysis of Variance (ANOVA) We now consider an analysis with only categorical predictors (i.e. all predictors are

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 2011-03-16 Contents 1 Generalized Linear Mixed Models Generalized Linear Mixed Models When using linear mixed

More information

Lecture 18: Simple Linear Regression

Lecture 18: Simple Linear Regression Lecture 18: Simple Linear Regression BIOS 553 Department of Biostatistics University of Michigan Fall 2004 The Correlation Coefficient: r The correlation coefficient (r) is a number that measures the strength

More information

Stat 209 Lab: Linear Mixed Models in R This lab covers the Linear Mixed Models tutorial by John Fox. Lab prepared by Karen Kapur. ɛ i Normal(0, σ 2 )

Stat 209 Lab: Linear Mixed Models in R This lab covers the Linear Mixed Models tutorial by John Fox. Lab prepared by Karen Kapur. ɛ i Normal(0, σ 2 ) Lab 2 STAT209 1/31/13 A complication in doing all this is that the package nlme (lme) is supplanted by the new and improved lme4 (lmer); both are widely used so I try to do both tracks in separate Rogosa

More information

Random Coefficients Model Examples

Random Coefficients Model Examples Random Coefficients Model Examples STAT:5201 Week 15 - Lecture 2 1 / 26 Each subject (or experimental unit) has multiple measurements (this could be over time, or it could be multiple measurements on a

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

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

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 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

Introduction to Linear Mixed Models: Modeling continuous longitudinal outcomes

Introduction to Linear Mixed Models: Modeling continuous longitudinal outcomes 1/64 to : Modeling continuous longitudinal outcomes Dr Cameron Hurst cphurst@gmail.com CEU, ACRO and DAMASAC, Khon Kaen University 4 th Febuary, 2557 2/64 Some motivational datasets Before we start, I

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

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

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

1 Multiple Regression

1 Multiple Regression 1 Multiple Regression In this section, we extend the linear model to the case of several quantitative explanatory variables. There are many issues involved in this problem and this section serves only

More information

Longitudinal Data Analysis of Health Outcomes

Longitudinal Data Analysis of Health Outcomes Longitudinal Data Analysis of Health Outcomes Longitudinal Data Analysis Workshop Running Example: Days 2 and 3 University of Georgia: Institute for Interdisciplinary Research in Education and Human Development

More information

Linear Regression. In this lecture we will study a particular type of regression model: the linear regression model

Linear Regression. In this lecture we will study a particular type of regression model: the linear regression model 1 Linear Regression 2 Linear Regression In this lecture we will study a particular type of regression model: the linear regression model We will first consider the case of the model with one predictor

More information

Introduction to LMER. Andrew Zieffler

Introduction to LMER. Andrew Zieffler Introduction to LMER Andrew Zieffler Traditional Regression General form of the linear model where y i = 0 + 1 (x 1i )+ 2 (x 2i )+...+ p (x pi )+ i yi is the response for the i th individual (i = 1,...,

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

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

Statistical Methods III Statistics 212. Problem Set 2 - Answer Key Statistical Methods III Statistics 212 Problem Set 2 - Answer Key 1. (Analysis to be turned in and discussed on Tuesday, April 24th) The data for this problem are taken from long-term followup of 1423

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

6. Multiple Linear Regression

6. Multiple Linear Regression 6. Multiple Linear Regression SLR: 1 predictor X, MLR: more than 1 predictor Example data set: Y i = #points scored by UF football team in game i X i1 = #games won by opponent in their last 10 games X

More information

Figure 1: The fitted line using the shipment route-number of ampules data. STAT5044: Regression and ANOVA The Solution of Homework #2 Inyoung Kim

Figure 1: The fitted line using the shipment route-number of ampules data. STAT5044: Regression and ANOVA The Solution of Homework #2 Inyoung Kim 0.0 1.0 1.5 2.0 2.5 3.0 8 10 12 14 16 18 20 22 y x Figure 1: The fitted line using the shipment route-number of ampules data STAT5044: Regression and ANOVA The Solution of Homework #2 Inyoung Kim Problem#

More information

22s:152 Applied Linear Regression

22s:152 Applied Linear Regression 22s:152 Applied Linear Regression Chapter 7: Dummy Variable Regression So far, we ve only considered quantitative variables in our models. We can integrate categorical predictors by constructing artificial

More information

Simple Linear Regression

Simple Linear Regression Simple Linear Regression ST 430/514 Recall: A regression model describes how a dependent variable (or response) Y is affected, on average, by one or more independent variables (or factors, or covariates)

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

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

Section 4.6 Simple Linear Regression

Section 4.6 Simple Linear Regression Section 4.6 Simple Linear Regression Objectives ˆ Basic philosophy of SLR and the regression assumptions ˆ Point & interval estimation of the model parameters, and how to make predictions ˆ Point and interval

More information

MULTILEVEL MODELS. Multilevel-analysis in SPSS - step by step

MULTILEVEL MODELS. Multilevel-analysis in SPSS - step by step MULTILEVEL MODELS Multilevel-analysis in SPSS - step by step Dimitri Mortelmans Centre for Longitudinal and Life Course Studies (CLLS) University of Antwerp Overview of a strategy. Data preparation (centering

More information

Lectures on Simple Linear Regression Stat 431, Summer 2012

Lectures on Simple Linear Regression Stat 431, Summer 2012 Lectures on Simple Linear Regression Stat 43, Summer 0 Hyunseung Kang July 6-8, 0 Last Updated: July 8, 0 :59PM Introduction Previously, we have been investigating various properties of the population

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

ST505/S697R: Fall Homework 2 Solution.

ST505/S697R: Fall Homework 2 Solution. ST505/S69R: Fall 2012. Homework 2 Solution. 1. 1a; problem 1.22 Below is the summary information (edited) from the regression (using R output); code at end of solution as is code and output for SAS. a)

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

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

Regression: Main Ideas Setting: Quantitative outcome with a quantitative explanatory variable. Example, cont.

Regression: Main Ideas Setting: Quantitative outcome with a quantitative explanatory variable. Example, cont. TCELL 9/4/205 36-309/749 Experimental Design for Behavioral and Social Sciences Simple Regression Example Male black wheatear birds carry stones to the nest as a form of sexual display. Soler et al. wanted

More information

36-707: Regression Analysis Homework Solutions. Homework 3

36-707: Regression Analysis Homework Solutions. Homework 3 36-707: Regression Analysis Homework Solutions Homework 3 Fall 2012 Problem 1 Y i = βx i + ɛ i, i {1, 2,..., n}. (a) Find the LS estimator of β: RSS = Σ n i=1(y i βx i ) 2 RSS β = Σ n i=1( 2X i )(Y i βx

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

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

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