Running examples in ‘StroupGLMM-Ex.R’ failed
The error most likely occurred in:

> ### Name: Exam5.2
> ### Title: Example 5.2 from Generalized Linear Mixed Models: Modern
> ###   Concepts, Methods and Applications by Walter W. Stroup(p-164)
> ### Aliases: Exam5.2
> ### Keywords: datasets
> 
> ### ** Examples
> 
> 
> DataSet5.2$a <- factor( x = DataSet5.2$a)
> DataSet5.2$b <- factor( x = DataSet5.2$b)
> DataSet5.2$c <- factor(x  = DataSet5.2$c)
> ##---first adding factor a in model
> Exam5.2.lm1 <-
+   lm(
+       formula     = y~ a
+     , data        = DataSet5.2
+  #  , subset
+  #  , weights
+  #  , na.action
+     , method      = "qr"
+     , model       = TRUE
+  #  , x           = FALSE
+  #  , y           = FALSE
+     , qr          = TRUE
+     , singular.ok = TRUE
+     , contrasts   = NULL
+  #  , offset
+  #  , ...
+   )
> summary( Exam5.2.lm1 )

Call:
lm(formula = y ~ a, data = DataSet5.2, method = "qr", model = TRUE, 
    qr = TRUE, singular.ok = TRUE, contrasts = NULL)

Residuals:
    Min      1Q  Median      3Q     Max 
-1.5833 -1.2833  0.4333  0.9333  1.1167 

Coefficients:
            Estimate Std. Error t value Pr(>|t|)    
(Intercept)   9.7667     0.6913   14.13 2.11e-06 ***
a1            1.6167     0.8466    1.91   0.0978 .  
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 1.197 on 7 degrees of freedom
Multiple R-squared:  0.3425,	Adjusted R-squared:  0.2486 
F-statistic: 3.646 on 1 and 7 DF,  p-value: 0.09783

> 
> library(lsmeans) 
Loading required package: estimability
> ##---A first
> ( Lsm5.2lm1    <-
+   lsmeans::lsmeans(
+      object  = Exam5.2.lm1
+     , specs   = "a"
+     # , ...
+   )
+ )
 a    lsmean        SE df  lower.CL upper.CL
 0  9.766667 0.6912721  7  8.132068 11.40127
 1 11.383333 0.4888032  7 10.227497 12.53917

Confidence level used: 0.95 
> ## lsmeans::contrast(object = Lsm5.2lm1 , method = "pairwise")
> Anovalm1  <-   anova(object   = Exam5.2.lm1)
> Anovalm1
Analysis of Variance Table

Response: y
          Df  Sum Sq Mean Sq F value  Pr(>F)  
a          1  5.2272  5.2272  3.6463 0.09783 .
Residuals  7 10.0350  1.4336                  
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
> 
> ##---then adding factor b in model
> Exam5.2.lm2 <-
+   lm(
+       formula     = y~ a + b
+     , data        = DataSet5.2
+  #  , subset
+  #  , weights
+  #  , na.action
+     , method      = "qr"
+     , model       = TRUE
+  #  , x           = FALSE
+  #  , y           = FALSE
+     , qr          = TRUE
+     , singular.ok = TRUE
+     , contrasts   = NULL
+  #  , offset
+  #  , ...
+   )
> summary( Exam5.2.lm1 )

Call:
lm(formula = y ~ a, data = DataSet5.2, method = "qr", model = TRUE, 
    qr = TRUE, singular.ok = TRUE, contrasts = NULL)

Residuals:
    Min      1Q  Median      3Q     Max 
-1.5833 -1.2833  0.4333  0.9333  1.1167 

Coefficients:
            Estimate Std. Error t value Pr(>|t|)    
(Intercept)   9.7667     0.6913   14.13 2.11e-06 ***
a1            1.6167     0.8466    1.91   0.0978 .  
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 1.197 on 7 degrees of freedom
Multiple R-squared:  0.3425,	Adjusted R-squared:  0.2486 
F-statistic: 3.646 on 1 and 7 DF,  p-value: 0.09783

> (Lsm5.2lm2    <-
+   lsmeans::lsmeans(
+       object  = Exam5.2.lm2
+     , specs   = "b"
+     # , ...
+   )
+ )
 b lsmean        SE df lower.CL upper.CL
 0  10.95 0.6093029  6  9.45909 12.44091
 1  10.20 0.6093029  6  8.70909 11.69091

Results are averaged over the levels of: a 
Confidence level used: 0.95 
> ## lsmeans::contrast(object = Lsm5.2lm2, method = "pairwise")
> Anovalm2  <-   anova(object   = Exam5.2.lm2)
> Anovalm2
Analysis of Variance Table

Response: y
          Df Sum Sq Mean Sq F value Pr(>F)
a          1 5.2272  5.2272  3.5200 0.1097
b          1 1.1250  1.1250  0.7576 0.4175
Residuals  6 8.9100  1.4850               
> 
> ##---then adding factor c in model
> Exam5.2.lm3 <-
+   lm(
+       formula     = y~ a + b + c
+     , data        = DataSet5.2
+ #  , subset
+ #  , weights
+ #  , na.action
+     , method      = "qr"
+     , model       = TRUE
+ #  , x           = FALSE
+ #  , y           = FALSE
+     , qr          = TRUE
+     , singular.ok = TRUE
+     , contrasts   = NULL
+ #  , offset
+ #  , ...
+   )
> summary( Exam5.2.lm3 )

Call:
lm(formula = y ~ a + b + c, data = DataSet5.2, method = "qr", 
    model = TRUE, qr = TRUE, singular.ok = TRUE, contrasts = NULL)

Residuals:
         1          2          3          4          5          6          7 
-1.500e-01  1.500e-01  3.000e-01  1.000e-01 -8.000e-01  4.000e-01 -2.500e-01 
         8          9 
 2.500e-01 -2.082e-17 

Coefficients:
            Estimate Std. Error t value Pr(>|t|)    
(Intercept)  10.5000     0.3469  30.264 7.39e-07 ***
a1            1.6000     0.3469   4.612  0.00578 ** 
b1           -0.0500     0.3469  -0.144  0.89104    
c1           -2.1000     0.3469  -6.053  0.00178 ** 
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 0.4626 on 5 degrees of freedom
Multiple R-squared:  0.9299,	Adjusted R-squared:  0.8878 
F-statistic: 22.11 on 3 and 5 DF,  p-value: 0.002584

> (Lsm5.2lm3    <-
+   lsmeans::lsmeans(
+       object  = Exam5.2.lm3
+     , specs   = "c"
+     # , ...
+   )
+ )
 c lsmean        SE df  lower.CL  upper.CL
 0 11.275 0.2003123  5 10.760081 11.789919
 1  9.175 0.2832843  5  8.446794  9.903206

Results are averaged over the levels of: a, b 
Confidence level used: 0.95 
> ## lsmeans::contrast(object = Lsm5.2lm3, method = "pairwise")
> Anovalm3  <-  anova(object   = Exam5.2.lm3)