Exam2.B.5: Example 2.B.5 from Generalized Linear Mixed Models: Modern...

Description Author(s) References See Also Examples

Description

Exam2.B.5 is related to multi batch regression data assuming different forms of linear models.

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

Table1.2

Examples

 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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#-----------------------------------------------------------------------------------
## Nested Model with no intercept
#-----------------------------------------------------------------------------------
data(Table1.2)
Table1.2$Batch <- factor(x = Table1.2$Batch)
Exam2.B.5.lm1 <-
  lm(
         formula     = Y~0+Batch+ Batch/X
       , data        = Table1.2
    #  , subset
    #  , weights
    #  , na.action
       , method      = "qr"
       , model       = TRUE
    #  , x           = FALSE
    #  , y           = FALSE
       , qr          = TRUE
       , singular.ok = TRUE
       , contrasts   = NULL
    #  , offset
    #  , ...
  )
DesignMatrix.lm1 <- model.matrix (object = Exam2.B.5.lm1)
DesignMatrix.lm1
#-----------------------------------------------------------------------------------
## Interaction Model with intercept
#-----------------------------------------------------------------------------------
Exam2.B.5.lm2 <-
  lm(
         formula     = Y~Batch +X+ Batch*X
       , data        = Table1.2
    #  , subset
    #  , weights
    #  , na.action
       , method      = "qr"
       , model       = TRUE
    #  , x           = FALSE
    #  , y           = FALSE
       , qr          = TRUE
       , singular.ok = TRUE
       , contrasts   = NULL
    #  , offset
    #  , ...
  )
DesignMatrix.lm2 <-   model.matrix (object = Exam2.B.5.lm2)
DesignMatrix.lm2
#-----------------------------------------------------------------------------------
## Interaction Model with no intercept
#-----------------------------------------------------------------------------------
Exam2.B.5.lm3 <-
  lm(
         formula     = Y~0 + Batch + Batch*X
       , data        = Table1.2
    #  , subset
    #  , weights
    #  , na.action
       , method      = "qr"
       , model       = TRUE
    #  , x           = FALSE
    #  , y           = FALSE
       , qr          = TRUE
       , singular.ok = TRUE
       , contrasts   = NULL
    #  , offset
    #  , ...
  )
DesignMatrix.lm3 <-   model.matrix(object = Exam2.B.5.lm3)
#-----------------------------------------------------------------------------------
## Interaction Model with intercept  but omitting X term as main effect
#-----------------------------------------------------------------------------------
Exam2.B.5.lm4 <-
  lm(
         formula     = Y~Batch + Batch*X
       , data        = Table1.2
    #  , subset
    #  , weights
    #  , na.action
       , method      = "qr"
       , model       = TRUE
    #  , x           = FALSE
    #  , y           = FALSE
       , qr          = TRUE
       , singular.ok = TRUE
       , contrasts   = NULL
    #  , offset
    #  , ...
  )
DesignMatrix.lm4 <-   model.matrix(object = Exam2.B.5.lm4)
DesignMatrix.lm4

myaseen208/StroupGLMM documentation built on May 10, 2019, 8:28 a.m.