Description Format Source Examples
The Multilocation
data frame has 108 rows and 7 columns.
This data frame contains the following columns:
a numeric vector
an ordered factor with levels
B
< D
< E
< I
< G
<
A
< C
< F
< H
a factor
with levels 1
to 3
a factor with levels 1
to 4
a numeric vector
a numeric vector
an ordered
factor with levels
B/1
< B/2
< B/3
< D/1
<
D/2
< D/3
< E/1
< E/2
<
E/3
< I/1
< I/2
< I/3
<
G/1
< G/2
< G/3
< A/1
<
A/2
< A/3
< C/1
< C/2
<
C/3
< F/1
< F/2
< F/3
<
H/1
< H/2
< H/3
Littel, R. C., Milliken, G. A., Stroup, W. W., and Wolfinger, R. D. (1996), SAS System for Mixed Models, SAS Institute (Data Set 2.8.1).
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | str(Multilocation)
if (require("lme4", quietly = TRUE, character = TRUE)) {
options(contrasts = c(unordered = "contr.SAS", ordered = "contr.poly"))
### Create a Block %in% Location factor
Multilocation$Grp <- with(Multilocation, Block:Location)
print(fm1Mult <- lmer(Adj ~ Location * Trt + (1|Grp), Multilocation))
print(anova(fm1Mult))
print(fm2Mult <- lmer(Adj ~ Location + Trt + (1|Grp), Multilocation), corr=FALSE)
print(fm3Mult <- lmer(Adj ~ Location + (1|Grp), Multilocation), corr=FALSE)
print(fm4Mult <- lmer(Adj ~ Trt + (1|Grp), Multilocation))
print(fm5Mult <- lmer(Adj ~ 1 + (1|Grp), Multilocation))
print(anova(fm2Mult))
print(anova(fm1Mult, fm2Mult, fm3Mult, fm4Mult, fm5Mult))
### Treating the location as a random effect
print(fm1MultR <- lmer(Adj ~ Trt + (1|Location/Trt) + (1|Grp), Multilocation))
print(anova(fm1MultR))
fm2MultR <- lmer(Adj ~ Trt + (Trt - 1|Location) + (1|Block), Multilocation)
## Warning (not error ?!): Convergence failure in 10000 iter %% __FIXME__
print(fm2MultR)# does not mention previous conv.failure %% FIXME ??
print(anova(fm1MultR, fm2MultR))
## Not run:
confint(fm1MultR)
## End(Not run)
}
|
'data.frame': 108 obs. of 7 variables:
$ obs : num 3 4 6 7 9 10 12 16 19 20 ...
$ Location: Factor w/ 9 levels "A","B","C","D",..: 1 1 1 1 1 1 1 1 1 1 ...
$ Block : Factor w/ 3 levels "1","2","3": 1 1 1 1 2 2 2 2 3 3 ...
$ Trt : Factor w/ 4 levels "1","2","3","4": 3 4 2 1 2 1 3 4 1 2 ...
$ Adj : num 3.16 3.12 3.16 3.25 2.71 ...
$ Fe : num 7.1 6.68 6.83 6.53 8.25 ...
$ Grp : Factor w/ 27 levels "A/1","A/2","A/3",..: 1 1 1 1 2 2 2 2 3 3 ...
- attr(*, "ginfo")=List of 7
..$ formula :Class 'formula' language Adj ~ 1 | Location/Block
.. .. ..- attr(*, ".Environment")=<environment: R_GlobalEnv>
..$ order.groups:List of 2
.. ..$ Location: logi TRUE
.. ..$ Block : logi TRUE
..$ FUN :function (x)
..$ outer : NULL
..$ inner :List of 1
.. ..$ Block:Class 'formula' language ~Trt
.. .. .. ..- attr(*, ".Environment")=<environment: R_GlobalEnv>
..$ labels :List of 1
.. ..$ Adj: chr "Adjusted yield"
..$ units : list()
Linear mixed model fit by REML ['lmerMod']
Formula: Adj ~ Location * Trt + (1 | Grp)
Data: Multilocation
REML criterion at convergence: 10.6462
Random effects:
Groups Name Std.Dev.
Grp (Intercept) 0.07496
Residual 0.18595
Number of obs: 108, groups: Grp, 27
Fixed Effects:
(Intercept) LocationA LocationB LocationC LocationD
2.35923 0.64930 0.06643 0.54533 0.37413
LocationE LocationF LocationG LocationH Trt1
0.55000 0.99810 0.36057 1.01403 0.22720
Trt2 Trt3 LocationA:Trt1 LocationB:Trt1 LocationC:Trt1
-0.00140 0.42323 -0.18853 -0.27523 -0.04000
LocationD:Trt1 LocationE:Trt1 LocationF:Trt1 LocationG:Trt1 LocationH:Trt1
-0.53513 -0.26297 -0.27153 0.20323 -0.14953
LocationA:Trt2 LocationB:Trt2 LocationC:Trt2 LocationD:Trt2 LocationE:Trt2
-0.09347 -0.32273 0.08960 -0.29693 -0.30693
LocationF:Trt2 LocationG:Trt2 LocationH:Trt2 LocationA:Trt3 LocationB:Trt3
-0.30993 -0.10860 -0.33060 -0.40247 -0.56550
LocationC:Trt3 LocationD:Trt3 LocationE:Trt3 LocationF:Trt3 LocationG:Trt3
-0.12247 -0.54840 -0.32863 -0.46257 -0.25297
LocationH:Trt3
-0.37203
Analysis of Variance Table
Df Sum Sq Mean Sq F value
Location 8 6.9475 0.86843 25.1147
Trt 3 1.2217 0.40725 11.7774
Location:Trt 24 0.9966 0.04152 1.2008
Linear mixed model fit by REML ['lmerMod']
Formula: Adj ~ Location + Trt + (1 | Grp)
Data: Multilocation
REML criterion at convergence: -6.0011
Random effects:
Groups Name Std.Dev.
Grp (Intercept) 0.07131
Residual 0.19161
Number of obs: 108, groups: Grp, 27
Fixed Effects:
(Intercept) LocationA LocationB LocationC LocationD LocationE
2.53296 0.47818 -0.22443 0.52712 0.02902 0.32537
LocationF LocationG LocationH Trt1 Trt2 Trt3
0.73709 0.32098 0.80099 0.05834 -0.18802 0.08379
Linear mixed model fit by REML ['lmerMod']
Formula: Adj ~ Location + (1 | Grp)
Data: Multilocation
REML criterion at convergence: 9.8205
Random effects:
Groups Name Std.Dev.
Grp (Intercept) 0.04067
Residual 0.22459
Number of obs: 108, groups: Grp, 27
Fixed Effects:
(Intercept) LocationA LocationB LocationC LocationD LocationE
2.52149 0.47818 -0.22443 0.52712 0.02902 0.32537
LocationF LocationG LocationH
0.73709 0.32098 0.80099
Linear mixed model fit by REML ['lmerMod']
Formula: Adj ~ Trt + (1 | Grp)
Data: Multilocation
REML criterion at convergence: 31.5057
Random effects:
Groups Name Std.Dev.
Grp (Intercept) 0.3331
Residual 0.1916
Number of obs: 108, groups: Grp, 27
Fixed Effects:
(Intercept) Trt1 Trt2 Trt3
2.86567 0.05834 -0.18802 0.08379
Linear mixed model fit by REML ['lmerMod']
Formula: Adj ~ 1 + (1 | Grp)
Data: Multilocation
REML criterion at convergence: 47.3273
Random effects:
Groups Name Std.Dev.
Grp (Intercept) 0.3279
Residual 0.2246
Number of obs: 108, groups: Grp, 27
Fixed Effects:
(Intercept)
2.854
Analysis of Variance Table
Df Sum Sq Mean Sq F value
Location 8 7.3768 0.92210 25.115
Trt 3 1.2217 0.40725 11.092
refitting model(s) with ML (instead of REML)
Data: Multilocation
Models:
fm5Mult: Adj ~ 1 + (1 | Grp)
fm4Mult: Adj ~ Trt + (1 | Grp)
fm3Mult: Adj ~ Location + (1 | Grp)
fm2Mult: Adj ~ Location + Trt + (1 | Grp)
fm1Mult: Adj ~ Location * Trt + (1 | Grp)
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
fm5Mult 3 49.731 57.777 -21.865 43.731
fm4Mult 6 26.951 43.044 -7.476 14.951 28.780 3 2.491e-06 ***
fm3Mult 11 -0.956 28.547 11.478 -22.956 37.907 5 3.939e-07 ***
fm2Mult 14 -24.504 13.046 26.252 -52.504 29.548 3 1.718e-06 ***
fm1Mult 38 -11.146 90.775 43.573 -87.146 34.642 24 0.07388 .
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Linear mixed model fit by REML ['lmerMod']
Formula: Adj ~ Trt + (1 | Location/Trt) + (1 | Grp)
Data: Multilocation
REML criterion at convergence: 1.6132
Random effects:
Groups Name Std.Dev.
Trt:Location (Intercept) 0.04811
Grp (Intercept) 0.07496
Location (Intercept) 0.33776
Residual 0.18595
Number of obs: 108, groups: Trt:Location, 36; Grp, 27; Location, 9
Fixed Effects:
(Intercept) Trt1 Trt2 Trt3
2.86567 0.05834 -0.18802 0.08379
Analysis of Variance Table
Df Sum Sq Mean Sq F value
Trt 3 1.0174 0.33914 9.8078
Linear mixed model fit by REML ['lmerMod']
Formula: Adj ~ Trt + (Trt - 1 | Location) + (1 | Block)
Data: Multilocation
REML criterion at convergence: 1.4071
Random effects:
Groups Name Std.Dev. Corr
Location Trt1 0.3687
Trt2 0.3271 0.99
Trt3 0.3451 1.00 1.00
Trt4 0.3378 0.93 0.97 0.95
Block (Intercept) 0.0000
Residual 0.1943
Number of obs: 108, groups: Location, 9; Block, 3
Fixed Effects:
(Intercept) Trt1 Trt2 Trt3
2.86567 0.05834 -0.18802 0.08379
refitting model(s) with ML (instead of REML)
Data: Multilocation
Models:
fm1MultR: Adj ~ Trt + (1 | Location/Trt) + (1 | Grp)
fm2MultR: Adj ~ Trt + (Trt - 1 | Location) + (1 | Block)
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
fm1MultR 8 2.3564 23.813 6.8218 -13.644
fm2MultR 16 18.5537 61.468 6.7231 -13.446 0 8 1
Computing profile confidence intervals ...
2.5 % 97.5 %
.sig01 0.00000000 0.10557384
.sig02 0.00000000 0.14575568
.sig03 0.20609880 0.55772322
.sigma 0.15571811 0.22097994
(Intercept) 2.62121582 3.11011759
Trt1 -0.04789322 0.16458211
Trt2 -0.29425988 -0.08178456
Trt3 -0.02245248 0.19002285
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.