bbolker / broom.mixed

tidy methods for mixed models in R
229 stars 24 forks source link

feature request: supporting linear mixed-effects models under heavy-tailed distributions #48

Open IndrajeetPatil opened 6 years ago

IndrajeetPatil commented 6 years ago
# set up
set.seed(123)
library(heavy)
data(dental)

# model
fit <-
  heavy::heavyLme(
    fixed = distance ~ age * Sex,
    random = ~ age,
    groups = ~ Subject,
    data = dental,
    family = Student(df = 4)
  )

# class
class(fit)
#> [1] "heavyLme"

# summary
summary(fit)
#> Linear mixed-effects model under heavy-tailed distributions
#>  Data: dental; Family: Student(df = 5.57571) 
#>  Log-likelihood: -213.6174 
#> 
#> Random effects:
#>  Formula: ~age; Groups: ~Subject 
#>  Scale matrix estimate:
#>             (Intercept) age        
#> (Intercept)  3.99479783            
#> age         -0.23905366  0.04887959
#> Within-Group scale parameter: 0.8829409 
#> 
#> Fixed: distance ~ age * Sex 
#>               Estimate Std.Error Z-value p-value
#> (Intercept)   16.9819   1.6995    9.9922  0.0000
#> age            0.7170   0.1677    4.2765  0.0000
#> SexFemale      0.6798   2.6626    0.2553  0.7985
#> age:SexFemale -0.0678   0.2627   -0.2579  0.7965
#> 
#> Number of Observations: 108 
#> Number of Groups: 27

# tidies present?
broom.mixed::tidy(fit)
#> Registered S3 methods overwritten by 'broom.mixed':
#>   method         from 
#>   augment.lme    broom
#>   augment.merMod broom
#>   glance.lme     broom
#>   glance.merMod  broom
#>   glance.stanreg broom
#>   tidy.brmsfit   broom
#>   tidy.gamlss    broom
#>   tidy.lme       broom
#>   tidy.merMod    broom
#>   tidy.rjags     broom
#>   tidy.stanfit   broom
#>   tidy.stanreg   broom
#> Error: No tidy method for objects of class heavyLme

# glance method present?
broom.mixed::glance(fit)
#> Error: No glance method for objects of class heavyLme

Created on 2018-11-18 by the reprex package (v0.2.1)