bbolker / broom.mixed

tidy methods for mixed models in R
227 stars 23 forks source link

feature request: supporting `glmmFit` class objects #55

Open IndrajeetPatil opened 5 years ago

IndrajeetPatil commented 5 years ago

# setup
set.seed(123)
library(glmmsr)

# model
mod <-
  glmmsr::glmm(
    formula = response ~ covariate + (1 | cluster),
    data = two_level,
    family = binomial,
    method = "AGQ",
    control = list(nAGQ = 16)
  )
#> Fitting the model. done.

# class of object
class(mod)
#> [1] "glmmFit"

# summary
summary(mod)
#> Generalized linear mixed model fit by maximum likelihood [glmmFit] 
#> Likelihood approximation: Adaptive Gaussian Quadrature with 16 points (lme4) 
#>  
#> Family: binomial ( logit ) 
#> Formula: response ~ covariate + (1 | cluster)
#> 
#> Random effects:
#>  Groups  Name        Estimate Std.Error
#>  cluster (Intercept) 1.041    0.5926   
#> Number of obs: 100, groups: cluster, 50; 
#> 
#> Fixed effects: 
#>             Estimate Std. Error z value Pr(>|z|)
#> (Intercept)   0.7168     0.3980   1.801  0.07172
#> covariate    -1.2734     0.5735   2.220  0.02639

# confidence intervals
confint.default(mod)
#>                     2.5 %     97.5 %
#> RE(Intercept) -0.12067442  2.2022207
#> (Intercept)   -0.06331442  1.4968362
#> covariate     -2.39736544 -0.1494037

Created on 2019-02-05 by the reprex package (v0.2.1)