Example 5.3 from Generalized Linear Mixed Models: Modern Concepts, Methods and Applications by Walter W. Stroup(p-172)
Source:R/Exam5.3.R
Exam5.3.Rd
Exam5.3 Inference using empirical standard error with different Bias connection
References
Stroup, W. W. (2012). Generalized Linear Mixed Models: Modern Concepts, Methods and Applications. CRC Press.
Author
Muhammad Yaseen (myaseen208@gmail.com)
Adeela Munawar (adeela.uaf@gmail.com)
Examples
data(DataSet4.1)
DataSet4.1$trt <- factor(x = DataSet4.1$trt)
DataSet4.1$block <- factor( x = DataSet4.1$block)
##---REML estimates on page 172
library(lmerTest)
Exam5.3REML <- lmerTest::lmer(formula = y ~ trt + (1|block), data = DataSet4.1, REML = TRUE)
Exam5.3REML
#> Linear mixed model fit by REML ['lmerModLmerTest']
#> Formula: y ~ trt + (1 | block)
#> Data: DataSet4.1
#> REML criterion at convergence: 259.2176
#> Random effects:
#> Groups Name Std.Dev.
#> block (Intercept) 2.157
#> Residual 2.925
#> Number of obs: 60, groups: block, 15
#> Fixed Effects:
#> (Intercept) trt2 trt3 trt4 trt5 trt6
#> 28.1752 -4.1221 -3.6258 -0.3369 -0.1262 0.9317
#> trt7 trt8 trt9 trt10 trt11 trt12
#> -0.2854 -0.3592 0.7379 -3.2646 0.8118 2.3530
#> trt13 trt14 trt15
#> -1.9975 -3.2621 0.4171
library(parameters)
model_parameters(Exam5.3REML)
#> # Fixed Effects
#>
#> Parameter | Coefficient | SE | 95% CI | t(43) | p
#> ------------------------------------------------------------------
#> (Intercept) | 28.18 | 1.66 | [24.82, 31.53] | 16.93 | < .001
#> trt [2] | -4.12 | 2.22 | [-8.60, 0.36] | -1.86 | 0.070
#> trt [3] | -3.63 | 2.22 | [-8.10, 0.85] | -1.63 | 0.110
#> trt [4] | -0.34 | 2.22 | [-4.82, 4.14] | -0.15 | 0.880
#> trt [5] | -0.13 | 2.22 | [-4.60, 4.35] | -0.06 | 0.955
#> trt [6] | 0.93 | 2.27 | [-3.65, 5.51] | 0.41 | 0.684
#> trt [7] | -0.29 | 2.22 | [-4.76, 4.19] | -0.13 | 0.898
#> trt [8] | -0.36 | 2.22 | [-4.84, 4.12] | -0.16 | 0.872
#> trt [9] | 0.74 | 2.22 | [-3.74, 5.22] | 0.33 | 0.741
#> trt [10] | -3.26 | 2.22 | [-7.74, 1.21] | -1.47 | 0.149
#> trt [11] | 0.81 | 2.27 | [-3.77, 5.39] | 0.36 | 0.723
#> trt [12] | 2.35 | 2.22 | [-2.13, 6.83] | 1.06 | 0.295
#> trt [13] | -2.00 | 2.22 | [-6.48, 2.48] | -0.90 | 0.373
#> trt [14] | -3.26 | 2.22 | [-7.74, 1.22] | -1.47 | 0.149
#> trt [15] | 0.42 | 2.22 | [-4.06, 4.90] | 0.19 | 0.852
#>
#> # Random Effects
#>
#> Parameter | Coefficient | SE | 95% CI
#> ---------------------------------------------------------
#> SD (Intercept: block) | 2.16 | 0.66 | [1.18, 3.93]
#> SD (Residual) | 2.93 | 0.37 | [2.28, 3.75]
#>
#> Uncertainty intervals (equal-tailed) and p-values (two-tailed) computed
#> using a Wald t-distribution approximation.
##---Standard Error Type "Model Based" with no Bias Connection
anova(object = Exam5.3REML)
#> Type III Analysis of Variance Table with Satterthwaite's method
#> Sum Sq Mean Sq NumDF DenDF F value Pr(>F)
#> trt 183.41 13.1 14 36.234 1.5312 0.1491
anova(object = Exam5.3REML, ddf = "Satterthwaite")
#> Type III Analysis of Variance Table with Satterthwaite's method
#> Sum Sq Mean Sq NumDF DenDF F value Pr(>F)
#> trt 183.41 13.1 14 36.234 1.5312 0.1491
##---Standard Error Type "Model Based" with "Kenward-Roger approximation" Bias Connection
anova(object = Exam5.3REML, ddf = "Kenward-Roger")
#> Type III Analysis of Variance Table with Kenward-Roger's method
#> Sum Sq Mean Sq NumDF DenDF F value Pr(>F)
#> trt 177.28 12.663 14 35.876 1.4799 0.1689
##---ML estimates on page 172
Exam5.3ML <- lmerTest::lmer(formula = y ~ trt + ( 1|block ), data = DataSet4.1, REML = FALSE)
Exam5.3ML
#> Linear mixed model fit by maximum likelihood ['lmerModLmerTest']
#> Formula: y ~ trt + (1 | block)
#> Data: DataSet4.1
#> AIC BIC logLik deviance df.resid
#> 332.8808 368.4846 -149.4404 298.8808 43
#> Random effects:
#> Groups Name Std.Dev.
#> block (Intercept) 2.122
#> Residual 2.457
#> Number of obs: 60, groups: block, 15
#> Fixed Effects:
#> (Intercept) trt2 trt3 trt4 trt5 trt6
#> 28.2268 -4.1617 -3.6804 -0.5774 -0.1739 0.8665
#> trt7 trt8 trt9 trt10 trt11 trt12
#> -0.3725 -0.3544 0.7644 -3.2707 0.6753 2.2244
#> trt13 trt14 trt15
#> -1.9513 -3.2356 0.3458
library(parameters)
model_parameters(Exam5.3ML)
#> # Fixed Effects
#>
#> Parameter | Coefficient | SE | 95% CI | t(43) | p
#> ------------------------------------------------------------------
#> (Intercept) | 28.23 | 1.44 | [25.33, 31.12] | 19.66 | < .001
#> trt [2] | -4.16 | 1.88 | [-7.95, -0.37] | -2.21 | 0.032
#> trt [3] | -3.68 | 1.88 | [-7.47, 0.11] | -1.96 | 0.057
#> trt [4] | -0.58 | 1.88 | [-4.37, 3.21] | -0.31 | 0.760
#> trt [5] | -0.17 | 1.88 | [-3.96, 3.62] | -0.09 | 0.927
#> trt [6] | 0.87 | 1.93 | [-3.02, 4.75] | 0.45 | 0.655
#> trt [7] | -0.37 | 1.88 | [-4.16, 3.42] | -0.20 | 0.844
#> trt [8] | -0.35 | 1.88 | [-4.14, 3.44] | -0.19 | 0.851
#> trt [9] | 0.76 | 1.88 | [-3.03, 4.55] | 0.41 | 0.686
#> trt [10] | -3.27 | 1.88 | [-7.06, 0.52] | -1.74 | 0.089
#> trt [11] | 0.68 | 1.93 | [-3.21, 4.56] | 0.35 | 0.728
#> trt [12] | 2.22 | 1.88 | [-1.57, 6.01] | 1.18 | 0.243
#> trt [13] | -1.95 | 1.88 | [-5.74, 1.84] | -1.04 | 0.305
#> trt [14] | -3.24 | 1.88 | [-7.03, 0.55] | -1.72 | 0.092
#> trt [15] | 0.35 | 1.88 | [-3.44, 4.14] | 0.18 | 0.855
#>
#> # Random Effects
#>
#> Parameter | Coefficient | SE | 95% CI
#> ---------------------------------------------------------
#> SD (Intercept: block) | 2.12 | 0.52 | [1.31, 3.44]
#> SD (Residual) | 2.46 | 0.26 | [2.00, 3.02]
#>
#> Uncertainty intervals (equal-tailed) and p-values (two-tailed) computed
#> using a Wald t-distribution approximation.
##---Standard Error Type "Model Based" with no Bias Connection
anova(object = Exam5.3ML )
#> Type III Analysis of Variance Table with Satterthwaite's method
#> Sum Sq Mean Sq NumDF DenDF F value Pr(>F)
#> trt 175.26 12.518 14 49.043 2.0736 0.03067 *
#> ---
#> Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
anova(object = Exam5.3ML, ddf = "Satterthwaite")
#> Type III Analysis of Variance Table with Satterthwaite's method
#> Sum Sq Mean Sq NumDF DenDF F value Pr(>F)
#> trt 175.26 12.518 14 49.043 2.0736 0.03067 *
#> ---
#> Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1