Examp2.5.3.1: Examp2.5.3.1 from Duchateau, L. and Janssen, P. and Rowlands,...

Description Author(s) References See Also Examples

Description

Examp2.5.3.1 is used for inspecting probability distribution and to define a plausible process through linear models and generalized linear models.

Author(s)

  1. Muhammad Yaseen ([email protected])

References

  1. Duchateau, L. and Janssen, P. and Rowlands, G. J. (1998).Linear Mixed Models. An Introduction with applications in Veterinary Research. International Livestock Research Institute.

See Also

ex124

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
#-------------------------------------------------------------
## Example 2.5.3.1 p-70
#-------------------------------------------------------------
 # PROC GLM DATA=ex125;
 # CLASS drug dose region;
 # MODEL pcv=region drug region*drug dose drug*dose;
 # RANDOM region drug*region;
 # RUN;
 
 
 # PROC MIXED DATA=ex125;
 # CLASS drug dose region;
 # MODEL pcv=drug dose drug*dose / ddfm=satterth;
 # RANDOM region drug*region;
 # ESTIMATE 'drug dif' drug -1 1 drug*dose -0.5 -0.5 0.5 0.5;
 # ESTIMATE 'Samorin mean' INTERCEPT 1 drug 0 1 dose 0.5 0.5
 #                             drug*dose 0 0 0.5 0.5;
 # ESTIMATE 'Samorin HvsL' dose 1 -1 drug*dose 0 0 1 -1;
 # ESTIMATE 'Samorin high' INTERCEPT 1 drug 0 1 dose 1 0
 #                             drug*dose 0 0 1 0;
 # RUN;
 
library(lme4)
str(ex125)
ex125$Region1 <- factor(ex125$Region)
 fm2.11 <- 
  aov(
      formula     = Pcv ~ Region1 + Drug + Error(Drug:Region1) + dose + dose:Drug
    , data        = ex125
    , projections = FALSE
    , qr          = TRUE
    , contrasts   = NULL
  #  , ...
    )
 summary(fm2.11)

 fm2.12 <- 
  lmerTest::lmer(
         formula    = Pcv ~ dose*Drug + (1|Region/Drug)
       , data       = ex125
       , REML       = TRUE
       , control    = lmerControl()
       , start      = NULL
       , verbose    = 0L
    #  , subset
    #  , weights
    #  , na.action
    #  , offset
       , contrasts  = list(dose = "contr.SAS", Drug = "contr.SAS")
       , devFunOnly = FALSE
    #  , ...
       )                       
 summary(fm2.12)
 lmerTest::anova(object = fm2.12, ddf = "Satterthwaite")

library(multcomp)
Contrasts1 <-
          matrix(c(
                  1, 0.5, 0, 0
                , 0, 0, -1, -0.5
                , 1, 1, 0, 0
                , 0, 1, 0, 0
                )
               , ncol = 4
               , byrow = TRUE
               , dimnames = list(
                  c("C1", "C2", "C3", "C4")
                , rownames(summary(fm2.12)$coef)
               )
              )

Contrasts1
summary(glht(fm2.12, linfct=Contrasts1))

VetResearchLMM documentation built on May 29, 2017, 4:15 p.m.