Skip to contents

Exam2.B.6 is related to multi batch regression data assuming different forms of linear models keeping batch effect random.

References

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

See also

Author

  1. Muhammad Yaseen (myaseen208@gmail.com)

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

Examples

#-----------------------------------------------------------------------------------
## Nested Model with no intercept
#-----------------------------------------------------------------------------------

data(Table1.2)
Table1.2$Batch <- factor(x = Table1.2$Batch)
library(nlme)
Exam2.B.6fm1 <- lme(
      fixed       = Y ~ X
    , data        = Table1.2
    , random      = list(Batch = pdDiag(~1), X = pdDiag(~1))
    , method      = c("REML", "ML")[1]
    )
Exam2.B.6fm1
#> Linear mixed-effects model fit by REML
#>   Data: Table1.2 
#>   Log-restricted-likelihood: -87.76411
#>   Fixed: Y ~ X 
#> (Intercept)           X 
#>  96.4894724   0.1241651 
#> 
#> Random effects:
#>  Formula: ~1 | Batch
#>         (Intercept)
#> StdDev:    2.511884
#> 
#>  Formula: ~1 | X %in% Batch
#>         (Intercept)  Residual
#> StdDev:    2.192282 0.9529553
#> 
#> Number of Observations: 36
#> Number of Groups: 
#>        Batch X %in% Batch 
#>            4           36 
library(broom.mixed)
tidy(Exam2.B.6fm1)
#> Warning: ran_pars not yet implemented for multiple levels of nesting
#> # A tibble: 2 × 7
#>   effect term        estimate std.error    df statistic  p.value
#>   <chr>  <chr>          <dbl>     <dbl> <dbl>     <dbl>    <dbl>
#> 1 fixed  (Intercept)   96.5      1.39      31     69.2  1.52e-35
#> 2 fixed  X              0.124    0.0263    31      4.72 4.76e- 5