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

Examp2.2.1.7R Documentation

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

Description

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

Author(s)

  1. Muhammad Yaseen (myaseen208@gmail.com)

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

#-------------------------------------------------------------
## Example 2.2.1.7 p-42
#-------------------------------------------------------------
 # PROC GLM DATA=ex121;
 # CLASS dose;
 # MODEL PCVdif=dose;
 # ESTIMATE 'l vs mh' dose -0.5 1 -0.5;
 # CONTRAST 'l vs mh' dose -0.5 1 -0.5;
 # RUN;

str(ex121)
fm2.1 <-
 aov(
     formula     = PCVdiff ~ dose
   , data        = ex121
   , projections = FALSE
   , qr          = TRUE
   , contrasts   = NULL
 #  , ...
   )
if (requireNamespace("report", quietly = TRUE)) {
  fm2.1 |>
    report::report()
}
summary(fm2.1)
anova(fm2.1)

LvsMHConc <-
         matrix(
             data    = c(-0.5, 1, -0.5)
           , nrow    = length(levels(ex121$dose))
           , byrow   = FALSE
           , dimnames = list(
                             c(levels(ex121$dose))
                           , c("Low vs Mediam and Hight")
                           )
         )

contrasts(ex121$dose) <- LvsMHConc
fm2.2 <-
 aov(
     formula     = PCVdiff ~ dose
   , data        = ex121
   , projections = FALSE
   , qr          = TRUE
   , contrasts   = NULL
 #  , ...
   )
if (requireNamespace("report", quietly = TRUE)) {
  fm2.2 |>
    report::report()
}
summary(fm2.2, split = list(dose = list("Low vs Mediam and Hight" = 1)))

fm2.3 <-
     lm(
          formula     = PCVdiff ~ dose
        , data        = ex121
     #  , subset
     #  , weights
     #  , na.action
        , method      = "qr"
        , model       = TRUE
        , x           = FALSE
        , y           = FALSE
        , qr          = TRUE
        , singular.ok = TRUE
        , contrasts   = NULL
     #  , offset
     #  , ...
     )
if (requireNamespace("report", quietly = TRUE)) {
  fm2.3 |>
    report::report()
}
if (requireNamespace("emmeans", quietly = TRUE)) {
  emm2.3 <- emmeans::emmeans(fm2.3, ~ dose)
  print(emm2.3)
  print(emmeans::contrast(
    emm2.3,
    method = list(low_vs_medium_high = c(-0.5, 1, -0.5))
  ))
}
summary(fm2.3)
anova(fm2.3)
# multcomp::glht(
#      model       = fm2.3
#    , linfct      = LvsMHConc
#    , alternative = "two.sided" # c("two.sided", "less", "greater")
#    , rhs         = 0
#    )


VetResearchLMM documentation built on May 5, 2026, 5:08 p.m.