##Stat222, week3 > > #NC residual plots > week3NC = read.table(file="http://rogosateaching.com/stat222/ncLong_data", header = T) > week3NC$timeInt = week3NC$time -1 > ncUnc = lmer(Y ~ timeInt + ( 1 + timeInt | ID), data = week3NC) > summary(ncUnc) Linear mixed model fit by REML ['lmerMod'] Formula: Y ~ timeInt + (1 + timeInt | ID) Data: week3NC REML criterion at convergence: 20677.8 Scaled residuals: Min 1Q Median 3Q Max -3.6596 -0.6056 -0.0257 0.5941 3.2018 Random effects: Groups Name Variance Std.Dev. Corr ## elements of Cov(alpha_0, alpha_1) ID (Intercept) 326.06 18.057 timeInt 46.23 6.799 0.65 ## .65 is mle estimate of Cor(alpha_0, alpha_1) Residual 403.49 20.087 Number of obs: 2216, groups: ID, 277 Fixed effects: Estimate Std. Error t value (Intercept) 342.300 1.336 256.27 timeInt 36.448 0.449 81.18 Correlation of Fixed Effects: (Intr) timeInt 0.279 ## .28 is sample value of Cor(alpha_hat_0, alpha_hat_1) > plot(ncUnc, id = .01) #see plot > ncCon2 = lmer(Y ~ Z*timeInt + ( 1 + timeInt | ID), data = week3NC) # incl Z in level,slope L2 > summary(ncCon2) Linear mixed model fit by REML ['lmerMod'] Formula: Y ~ Z * timeInt + (1 + timeInt | ID) Data: week3NC REML criterion at convergence: 20485.2 Scaled residuals: Min 1Q Median 3Q Max -3.5617 -0.6065 -0.0352 0.5934 3.1665 Random effects: Groups Name Variance Std.Dev. Corr ID (Intercept) 194.73 13.955 timeInt 24.63 4.963 0.38 Residual 403.49 20.087 Number of obs: 2216, groups: ID, 277 Fixed effects: Estimate Std. Error t value (Intercept) 254.32454 8.83286 28.793 timeInt 0.84389 2.71313 0.311 Z 0.82948 0.08258 10.045 timeInt:Z 0.33569 0.02537 13.235 Correlation of Fixed Effects: (Intr) timInt Z timeInt -0.066 Z -0.992 0.066 timeInt:Z 0.066 -0.992 -0.066 > confint(ncCon2) Computing profile confidence intervals ... 2.5 % 97.5 % .sig01 11.6988560 16.1328515 .sig02 0.1691589 0.6087485 .sig03 4.3873745 5.5462211 .sigma 19.4229852 20.7896705 (Intercept) 237.0150973 271.6339817 timeInt -4.4729277 6.1607130 Z 0.6676501 0.9913026 timeInt:Z 0.2859872 0.3854013 > plot(ncCon2, id = .01) # see plot 2