# Exam3.2: Example 3.2 from Generalized Linear Mixed Models: Modern... In StroupGLMM: R Codes and Datasets for Generalized Linear Mixed Models: Modern Concepts, Methods and Applications by Walter W. Stroup

## Description

Exam3.2 used binomial data, two treatment samples

## References

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

`DataSet3.1`
 ``` 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``` ```#------------------------------------------------------------- ## Linear Model and results discussed in Article 1.2.1 after Table1.1 #------------------------------------------------------------- data(DataSet3.1) DataSet3.1\$trt <- factor(x = DataSet3.1\$trt) Exam3.2.glm <- glm( formula = F/N~trt , family = quasibinomial(link = "logit") , data = DataSet3.1 , weights = NULL # , subset # , na.action , start = NULL # , etastart # , mustart # , offset # , control = list(...) # , model = TRUE , method = "glm.fit" # , x = FALSE # , y = TRUE , contrasts = NULL # , ... ) summary(Exam3.2.glm) #------------------------------------------------------------- ## Individula least squares treatment means #------------------------------------------------------------- library(lsmeans) (Lsm3.2 <- lsmeans::lsmeans( object = Exam3.2.glm , specs = "trt" # , ... ) ) OddsRatioMean3.2 <- 1/(1 + exp(-summary(Lsm3.2)[c("lsmean")] ) ) #--------------------------------------------------- ## Over all mean #--------------------------------------------------- library(phia) list3.2<- list(trt=c("0" = 0.5,"1" = 0.5 )) (Test3.2 <- testFactors( model = Exam3.2.glm , levels = list3.2 ) ) #--------------------------------------------------- ## Pairwise treatment means estimate #--------------------------------------------------- contrast(object = Lsm3.2 , method = "pairwise") #--------------------------------------------------- ## Repairwise treatment means estimate #--------------------------------------------------- ## contrast( object = Lsm3.2 , method = "repairwise") ```