Exam4.1: Example 4.1 from Generalized Linear Mixed Models: Modern...

Exam4.1R Documentation

Example 4.1 from Generalized Linear Mixed Models: Modern Concepts, Methods and Applications by Walter W. Stroup(p-138)

Description

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

Author(s)

  1. Muhammad Yaseen (myaseen208@gmail.com)

  2. Adeela Munawar (adeela.uaf@gmail.com)

References

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

See Also

DataSet4.1

Examples


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(lmerTest)

Exam4.1REML  <- lmer(formula = y~ trt +( 1|block ), data = DataSet4.1)
library(parameters)
model_parameters(Exam4.1REML)
print(VarCorr(x = Exam4.1REML), 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)
model_parameters(Exam4.1ML)
print(VarCorr(x =  Exam4.1ML), comp = c("Variance"))

Exam4.1.lm <- lm(formula  = y~ trt + block, data = DataSet4.1)
anova(object = Exam4.1.lm)

StroupGLMM documentation built on Oct. 2, 2024, 1:07 a.m.