> cat.mod1 <- aov(y ~ trt + trt/id + timepnt + trt:timepnt) > summary(cat.mod1) Df Sum Sq Mean Sq F value Pr(>F) trt 1 382.5 382.5 126.025 < 2e-16 *** timepnt 4 324.1 81.0 26.697 4.14e-16 *** trt:id 32 2132.0 66.6 21.951 < 2e-16 *** trt:timepnt 4 50.6 12.6 4.167 0.00332 ** Residuals 128 388.5 3.0 --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 > > > cat.mod2 <- aov(y ~ trt*timepnt + Error(id)) > > summary(cat.mod2) Error: id Df Sum Sq Mean Sq F value Pr(>F) trt 1 382.5 382.5 5.741 0.0226 * Residuals 32 2132.0 66.6 --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 Error: Within Df Sum Sq Mean Sq F value Pr(>F) timepnt 4 324.1 81.03 26.697 4.14e-16 *** trt:timepnt 4 50.6 12.65 4.167 0.00332 ** Residuals 128 388.5 3.04 --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 > > summary(cat.mod2,split=list(timepnt=list(linear=1, quadratic=2, + cubic=3, quartic=4))) Error: id Df Sum Sq Mean Sq F value Pr(>F) trt 1 382.5 382.5 5.741 0.0226 * Residuals 32 2132.0 66.6 --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 Error: Within Df Sum Sq Mean Sq F value Pr(>F) timepnt 4 324.1 81.0 26.697 4.14e-16 *** timepnt: linear 1 318.4 318.4 104.891 < 2e-16 *** timepnt: quadratic 1 4.6 4.6 1.529 0.218523 timepnt: cubic 1 1.0 1.0 0.314 0.576232 timepnt: quartic 1 0.2 0.2 0.055 0.814338 trt:timepnt 4 50.6 12.6 4.167 0.003316 ** trt:timepnt: linear 1 47.4 47.4 15.630 0.000127 *** trt:timepnt: quadratic 1 2.6 2.6 0.848 0.358874 trt:timepnt: cubic 1 0.6 0.6 0.190 0.663706 trt:timepnt: quartic 1 0.0 0.0 0.000 1.000000 Residuals 128 388.5 3.0 --- > cat.mod3 <- lmer(y ~ trt + timepnt + trt:timepnt + (1|trt:id)) > summary(cat.mod3) Linear mixed model fit by REML t-tests use Satterthwaite approximations to degrees of freedom [merModLmerTest] Formula: y ~ trt + timepnt + trt:timepnt + (1 | trt:id) REML criterion at convergence: 762.1 Scaled residuals: Min 1Q Median 3Q Max -3.2178 -0.5142 -0.0442 0.7121 2.3197 Random effects: Groups Name Variance Std.Dev. trt:id (Intercept) 12.718 3.566 Residual 3.035 1.742 Number of obs: 170, groups: trt:id, 34 Fixed effects: Estimate Std. Error df t value Pr(>|t|) (Intercept) 1.059e+01 8.853e-01 3.200e+01 11.960 2.40e-13 *** trt1 3.000e+00 1.252e+00 3.200e+01 2.396 0.022590 * timepnt.L 1.879e+00 4.225e-01 1.280e+02 4.446 1.87e-05 *** timepnt.Q -6.446e-01 4.225e-01 1.280e+02 -1.525 0.129605 timepnt.C -3.720e-02 4.225e-01 1.280e+02 -0.088 0.929976 timepnt^4 -7.031e-02 4.225e-01 1.280e+02 -0.166 0.868109 trt1:timepnt.L 2.362e+00 5.976e-01 1.280e+02 3.953 0.000127 *** trt1:timepnt.Q 5.502e-01 5.976e-01 1.280e+02 0.921 0.358874 trt1:timepnt.C -2.604e-01 5.976e-01 1.280e+02 -0.436 0.663706 trt1:timepnt^4 -6.955e-15 5.976e-01 1.280e+02 0.000 1.000000 --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 Correlation of Fixed Effects: (Intr) trt1 tmpn.L tmpn.Q tmpn.C tmpn^4 tr1:.L tr1:.Q tr1:.C trt1 -0.707 timepnt.L 0.000 0.000 timepnt.Q 0.000 0.000 0.000 timepnt.C 0.000 0.000 0.000 0.000 timepnt^4 0.000 0.000 0.000 0.000 0.000 trt1:tmpn.L 0.000 0.000 -0.707 0.000 0.000 0.000 trt1:tmpn.Q 0.000 0.000 0.000 -0.707 0.000 0.000 0.000 trt1:tmpn.C 0.000 0.000 0.000 0.000 -0.707 0.000 0.000 0.000 trt1:tmpn^4 0.000 0.000 0.000 0.000 0.000 -0.707 0.000 0.000 0.000 > anova(cat.mod3) Analysis of Variance Table of type 3 with Satterthwaite approximation for degrees of freedom Sum Sq Mean Sq NumDF DenDF F.value Pr(>F) trt 17.43 17.425 1 32 5.7412 0.022590 * timepnt 324.12 81.029 4 128 26.6974 4.441e-16 *** trt:timepnt 50.59 12.647 4 128 4.1669 0.003316 ** - ######################## Multivariate Analysis ################## > library(car) Warning message: package ‘car’ was built under R version 3.1.2 > cat.mod5 <- Anova(dayModel, idata=dayFrame, idesign = ~dayFactor) > summary(cat.mod5) Type II Repeated Measures MANOVA Tests: ------------------------------------------ Term: (Intercept) Response transformation matrix: (Intercept) es1 1 es2 1 es3 1 es4 1 es5 1 Sum of squares and products for the hypothesis: (Intercept) (Intercept) 124206.6 Sum of squares and products for error: (Intercept) (Intercept) 10659.88 Multivariate Tests: (Intercept) Df test stat approx F num Df den Df Pr(>F) Pillai 1 0.92096 372.857 1 32 < 2.22e-16 *** Wilks 1 0.07904 372.857 1 32 < 2.22e-16 *** Hotelling-Lawley 1 11.65178 372.857 1 32 < 2.22e-16 *** Roy 1 11.65178 372.857 1 32 < 2.22e-16 *** --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 ------------------------------------------ Term: trt Response transformation matrix: (Intercept) es1 1 es2 1 es3 1 es4 1 es5 1 Sum of squares and products for the hypothesis: (Intercept) (Intercept) 1912.5 Sum of squares and products for error: (Intercept) (Intercept) 10659.88 Multivariate Tests: trt Df test stat approx F num Df den Df Pr(>F) Pillai 1 0.1521191 5.741152 1 32 0.02259 * Wilks 1 0.8478809 5.741152 1 32 0.02259 * Hotelling-Lawley 1 0.1794110 5.741152 1 32 0.02259 * Roy 1 0.1794110 5.741152 1 32 0.02259 * --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 ------------------------------------------ Term: dayFactor Response transformation matrix: dayFactor1 dayFactor2 dayFactor3 dayFactor4 es1 1 0 0 0 es2 0 1 0 0 es3 0 0 1 0 es4 0 0 0 1 es5 -1 -1 -1 -1 Sum of squares and products for the hypothesis: dayFactor1 dayFactor2 dayFactor3 dayFactor4 dayFactor1 481.88235 335.05882 195.76471 60.235294 dayFactor2 335.05882 232.97059 136.11765 41.882353 dayFactor3 195.76471 136.11765 79.52941 24.470588 dayFactor4 60.23529 41.88235 24.47059 7.529412 Sum of squares and products for error: dayFactor1 dayFactor2 dayFactor3 dayFactor4 dayFactor1 412.35294 255.5882 143.23529 57.17647 dayFactor2 255.58824 237.0588 122.88235 45.00000 dayFactor3 143.23529 122.8824 120.47059 42.52941 dayFactor4 57.17647 45.0000 42.52941 48.94118 Multivariate Tests: dayFactor Df test stat approx F num Df den Df Pr(>F) Pillai 1 0.5502801 8.871144 4 29 8.3347e-05 *** Wilks 1 0.4497199 8.871144 4 29 8.3347e-05 *** Hotelling-Lawley 1 1.2236061 8.871144 4 29 8.3347e-05 *** Roy 1 1.2236061 8.871144 4 29 8.3347e-05 *** --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 ------------------------------------------ Term: trt:dayFactor Response transformation matrix: dayFactor1 dayFactor2 dayFactor3 dayFactor4 es1 1 0 0 0 es2 0 1 0 0 es3 0 0 1 0 es4 0 0 0 1 es5 -1 -1 -1 -1 Sum of squares and products for the hypothesis: dayFactor1 dayFactor2 dayFactor3 dayFactor4 dayFactor1 67.76471 66.35294 48 22.588235 dayFactor2 66.35294 64.97059 47 22.117647 dayFactor3 48.00000 47.00000 34 16.000000 dayFactor4 22.58824 22.11765 16 7.529412 Sum of squares and products for error: dayFactor1 dayFactor2 dayFactor3 dayFactor4 dayFactor1 412.35294 255.5882 143.23529 57.17647 dayFactor2 255.58824 237.0588 122.88235 45.00000 dayFactor3 143.23529 122.8824 120.47059 42.52941 dayFactor4 57.17647 45.0000 42.52941 48.94118 Multivariate Tests: trt:dayFactor Df test stat approx F num Df den Df Pr(>F) Pillai 1 0.2539872 2.468332 4 29 0.066885 . Wilks 1 0.7460128 2.468332 4 29 0.066885 . Hotelling-Lawley 1 0.3404597 2.468332 4 29 0.066885 . Roy 1 0.3404597 2.468332 4 29 0.066885 . --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 Univariate Type II Repeated-Measures ANOVA Assuming Sphericity SS num Df Error SS den Df F Pr(>F) (Intercept) 24841.3 1 2131.98 32 372.8570 < 2.2e-16 *** trt 382.5 1 2131.98 32 5.7412 0.022590 * dayFactor 324.1 4 388.49 128 26.6974 4.137e-16 *** trt:dayFactor 50.6 4 388.49 128 4.1669 0.003316 ** --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 Mauchly Tests for Sphericity Test statistic p-value dayFactor 0.13744 1.2302e-09 trt:dayFactor 0.13744 1.2302e-09 Greenhouse-Geisser and Huynh-Feldt Corrections for Departure from Sphericity GG eps Pr(>F[GG]) dayFactor 0.47389 8.6e-09 *** trt:dayFactor 0.47389 0.02189 * --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 HF eps Pr(>F[HF]) dayFactor 0.5028585 3.380776e-09 trt:dayFactor 0.5028585 1.969249e-02 >