# Exam4.1: Example 4.1 from Generalized Linear Mixed Models: Modern... In StroupGLMM: R Codes and Datasets for Generalized Linear Mixed Models: Modern Concepts, Methods and Applications by Walter W. Stroup

## Description

Exam4.1 REML vs ML criterion is used keeping block effects random

## References

1. Stroup, W. W. (2012). Generalized Linear Mixed Models: Modern Concepts, Methods and Applications. CRC Press.

`DataSet4.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 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71``` ```DataSet4.1\$trt <- factor(x = DataSet4.1\$trt) DataSet4.1\$block <- factor(x = DataSet4.1\$block) ##---REML estimates on page 138(article 4.4.3.3) library(lme4) Exam4.1REML <- lmer( formula = y~ trt +( 1|block ) , data = DataSet4.1 , REML = TRUE # , control = lmerControl() , start = NULL # , verbose = 0L # , subset # , weights # , na.action # , offset , contrasts = NULL , devFunOnly = FALSE # , ... ) VarCompREML4.1 <- VarCorr(x = Exam4.1REML # , sigma = 1 # , ... ) print(VarCompREML4.1, comp=c("Variance")) ##---ML estimates on page 138(article 4.4.3.3) Exam4.1ML <- lmer( formula = y ~ trt + (1|block) , data = DataSet4.1 , REML = FALSE # , control = lmerControl() , start = NULL # , verbose = 0L # , subset # , weights # , na.action # , offset , contrasts = NULL , devFunOnly = FALSE # , ... ) VarCompML4.1 <- VarCorr(x = Exam4.1ML # , sigma = 1 # , ... ) print(VarCompML4.1,comp=c("Variance")) Exam4.1.lm <- lm( formula = y~ trt + block , data = DataSet4.1 # , subset # , weights # , na.action , method = "qr" , model = TRUE # , x = FALSE # , y = FALSE , qr = TRUE , singular.ok = TRUE , contrasts = NULL # , offset # , ... ) summary(anova(object = Exam4.1.lm)) ```