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

> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: sim
> ### Title: Functions to Get Posterior Distributions
> ### Aliases: sim sim-class sim.merMod-class sim,lm-method sim,glm-method
> ###   sim,polr-method sim,merMod-method coef.sim coef.sim.polr
> ###   coef.sim.merMod fixef.sim.merMod ranef.sim.merMod fitted.sim.merMod
> ### Keywords: models methods
> 
> ### ** Examples
> 
> #Examples of "sim"
>  set.seed (1)
>  J <- 15
>  n <- J*(J+1)/2
>  group <- rep (1:J, 1:J)
>  mu.a <- 5
>  sigma.a <- 2
>  a <- rnorm (J, mu.a, sigma.a)
>  b <- -3
>  x <- rnorm (n, 2, 1)
>  sigma.y <- 6
>  y <- rnorm (n, a[group] + b*x, sigma.y)
>  u <- runif (J, 0, 3)
>  y123.dat <- cbind (y, x, group)
> # Linear regression
>  x1 <- y123.dat[,2]
>  y1 <- y123.dat[,1]
>  M1 <- lm (y1 ~ x1)
>  display(M1)
lm(formula = y1 ~ x1)
            coef.est coef.se
(Intercept)  5.79     1.72  
x1          -3.42     0.77  
---
n = 120, k = 2
residual sd = 7.04, R-Squared = 0.14
>  M1.sim <- sim(M1)
>  coef.M1.sim <- coef(M1.sim)
>  sigma.M1.sim <- sigma.hat(M1.sim)
>  ## to get the uncertainty for the simulated estimates
>  apply(coef(M1.sim), 2, quantile)
     (Intercept)         x1
0%    -0.6965736 -5.0647624
25%    4.7131084 -3.9309356
50%    6.0346236 -3.4834091
75%    6.9481385 -2.9938647
100%   9.4221294 -0.3620188
>  quantile(sigma.hat(M1.sim))
      0%      25%      50%      75%     100% 
6.159272 6.772798 7.065009 7.484341 8.345240 
> 
> # Logistic regression
>  u.data <- cbind (1:J, u)
>  dimnames(u.data)[[2]] <- c("group", "u")
>  u.dat <- as.data.frame (u.data)
>  y <- rbinom (n, 1, invlogit (a[group] + b*x))
>  M2 <- glm (y ~ x, family=binomial(link="logit"))
>  display(M2)
glm(formula = y ~ x, family = binomial(link = "logit"))
            coef.est coef.se
(Intercept)  4.52     0.97  
x           -2.64     0.51  
---
  n = 120, k = 2
  residual deviance = 102.3, null deviance = 157.7 (difference = 55.4)
>  M2.sim <- sim (M2)
>  coef.M2.sim <- coef(M2.sim)
>  sigma.M2.sim <- sigma.hat(M2.sim)
> 
> # Ordered Logistic regression
> house.plr <- polr(Sat ~ Infl + Type + Cont, weights = Freq, data = housing)
> display(house.plr)

Re-fitting to get Hessian

polr(formula = Sat ~ Infl + Type + Cont, data = housing, weights = Freq)
              coef.est coef.se
InflMedium     0.57     0.10  
InflHigh       1.29     0.13  
TypeApartment -0.57     0.12  
TypeAtrium    -0.37     0.16  
TypeTerrace   -1.09     0.15  
ContHigh       0.36     0.10  
Low|Medium    -0.50     0.12  
Medium|High    0.69     0.13  
---
n = 1681, k = 8 (including 2 intercepts)
residual deviance = 3479.1, null deviance is not computed by polr
> M.plr <- sim(house.plr)

Re-fitting to get Hessian

> coef.sim <- coef(M.plr, slot="coef")
> zeta.sim <- coef(M.plr, slot="zeta")
> coefall.sim <- coef(M.plr)
> 
> # Using lmer:
> # Example 1
>  E1 <- lmer (y ~ x + (1 | group))
>  display(E1)
lmer(formula = y ~ x + (1 | group))
            coef.est coef.se
(Intercept)  1.02     0.10  
x           -0.32     0.04  

Error terms:
 Groups   Name        Std.Dev.
 group    (Intercept) 0.17    
 Residual             0.34    
---
number of obs: 120, groups: group, 15
AIC = 115, DIC = 89.8
deviance = 98.4 
>  E1.sim <- sim (E1)
>  coef.E1.sim <- coef(E1.sim)
>  fixef.E1.sim <- fixef(E1.sim)
>  ranef.E1.sim <- ranef(E1.sim)
>  sigma.E1.sim <- sigma.hat(E1.sim)
>  yhat <- fitted(E1.sim, E1)
> 
> # Example 2
>  u.full <- u[group]
>  E2 <- lmer (y ~ x + u.full + (1 | group))
>  display(E2)
lmer(formula = y ~ x + u.full + (1 | group))
            coef.est coef.se
(Intercept)  0.92     0.16  
x           -0.32     0.04  
u.full       0.07     0.08  

Error terms:
 Groups   Name        Std.Dev.
 group    (Intercept) 0.17    
 Residual             0.35    
---
number of obs: 120, groups: group, 15
AIC = 119.5, DIC = 85.6
deviance = 97.6 
>  E2.sim <- sim (E2)
>  coef.E2.sim <- coef(E2.sim)
>  fixef.E2.sim <- fixef(E2.sim)
>  ranef.E2.sim <- ranef(E2.sim)
>  sigma.E2.sim <- sigma.hat(E2.sim)
>  yhat <- fitted(E2.sim, E2)
> 
> # Example 3
>  y <- rbinom (n, 1, invlogit (a[group] + b*x))
>  E3 <- glmer (y ~ x + (1 | group), family=binomial(link="logit"))
Error: Downdated VtV is not positive definite
Execution halted