Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement a tidy.glmx() method #795

Closed
IndrajeetPatil opened this issue Dec 4, 2019 · 2 comments
Closed

Implement a tidy.glmx() method #795

IndrajeetPatil opened this issue Dec 4, 2019 · 2 comments

Comments

@IndrajeetPatil
Copy link
Contributor

# setup
library(glmx)
library(MASS)
set.seed(1)
d <- data.frame(x = runif(200, -1, 1))
d$y <- rnbinom(200, mu = exp(0 + 3 * d$x), size = 1)

# model
m_nb1 <- 
  glmx(
  formula = y ~ x,
  data = d,
  family = negative.binomial,
  xlink = "log",
  xstart = 0
)

# class
class(m_nb1)
#> [1] "glmx"

# summary
summary(m_nb1)
#> 
#> Call:
#> glmx(formula = y ~ x, data = d, family = negative.binomial, xlink = "log", 
#>     xstart = 0)
#> 
#> Deviance residuals:
#>    Min     1Q Median     3Q    Max 
#> 0.0006 0.1866 0.5392 1.3547 6.5589 
#> 
#> Coefficients (Negative Binomial(1.3534) model with log link):
#>             Estimate Std. Error z value Pr(>|z|)    
#> (Intercept)  0.04794    0.11760   0.408    0.684    
#> x            3.01552    0.20500  14.710   <2e-16 ***
#> 
#> Extra parameters (with log link):
#>            Estimate Std. Error z value Pr(>|z|)
#> log(theta)   0.3026     0.1864   1.624    0.104
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 
#> 
#> Log-likelihood: -343.5 on 3 Df
#> Dispersion: 1
#> Number of iterations in BFGS optimization: 5 (profile) 3 (full)

# tidier?
broom::tidy(m_nb1)
#> Error: No tidy method for objects of class glmx

Created on 2019-12-04 by the reprex package (v0.3.0)

Session info
devtools::session_info()
#> - Session info ---------------------------------------------------------------
#>  setting  value                       
#>  version  R version 3.6.1 (2019-07-05)
#>  os       Windows 10 x64              
#>  system   x86_64, mingw32             
#>  ui       RTerm                       
#>  language (EN)                        
#>  collate  English_United States.1252  
#>  ctype    English_United States.1252  
#>  tz       Europe/Berlin               
#>  date     2019-12-04                  
#> 
#> - Packages -------------------------------------------------------------------
#>  package     * version    date       lib source                          
#>  assertthat    0.2.1      2019-03-21 [1] CRAN (R 3.6.0)                  
#>  backports     1.1.5      2019-10-02 [1] CRAN (R 3.6.1)                  
#>  broom         0.5.2.9002 2019-10-14 [1] local                           
#>  callr         3.3.2      2019-09-22 [1] CRAN (R 3.6.1)                  
#>  cli           1.1.0      2019-03-19 [1] CRAN (R 3.6.0)                  
#>  crayon        1.3.4      2017-09-16 [1] CRAN (R 3.5.1)                  
#>  desc          1.2.0      2019-11-11 [1] Github (r-lib/desc@61205f6)     
#>  devtools      2.2.1      2019-09-24 [1] CRAN (R 3.6.1)                  
#>  digest        0.6.23     2019-11-23 [1] CRAN (R 3.6.1)                  
#>  dplyr         0.8.3.9000 2019-10-10 [1] Github (tidyverse/dplyr@dcfc1d1)
#>  ellipsis      0.3.0      2019-09-20 [1] CRAN (R 3.6.1)                  
#>  evaluate      0.14       2019-05-28 [1] CRAN (R 3.6.0)                  
#>  Formula       1.2-3      2018-05-03 [1] CRAN (R 3.5.0)                  
#>  fs            1.3.1      2019-05-06 [1] CRAN (R 3.6.0)                  
#>  generics      0.0.2      2019-03-05 [1] Github (r-lib/generics@c15ac43) 
#>  glmx        * 0.1-1      2015-11-19 [1] CRAN (R 3.6.1)                  
#>  glue          1.3.1      2019-03-12 [1] CRAN (R 3.6.0)                  
#>  highr         0.8        2019-03-20 [1] CRAN (R 3.6.0)                  
#>  htmltools     0.4.0      2019-10-04 [1] CRAN (R 3.6.1)                  
#>  knitr         1.26       2019-11-12 [1] CRAN (R 3.6.1)                  
#>  lattice       0.20-38    2018-11-04 [2] CRAN (R 3.6.1)                  
#>  lifecycle     0.1.0      2019-08-01 [1] CRAN (R 3.6.1)                  
#>  lmtest        0.9-37     2019-04-30 [1] CRAN (R 3.6.0)                  
#>  magrittr      1.5        2014-11-22 [1] CRAN (R 3.5.1)                  
#>  MASS        * 7.3-51.4   2019-03-31 [1] CRAN (R 3.6.0)                  
#>  memoise       1.1.0      2017-04-21 [1] CRAN (R 3.6.0)                  
#>  pillar        1.4.2      2019-06-29 [1] CRAN (R 3.6.0)                  
#>  pkgbuild      1.0.6      2019-10-09 [1] CRAN (R 3.6.1)                  
#>  pkgconfig     2.0.3      2019-09-22 [1] CRAN (R 3.6.1)                  
#>  pkgload       1.0.2      2018-10-29 [1] CRAN (R 3.6.0)                  
#>  prettyunits   1.0.2      2015-07-13 [1] CRAN (R 3.5.1)                  
#>  processx      3.4.1      2019-07-18 [1] CRAN (R 3.6.1)                  
#>  ps            1.3.0      2018-12-21 [1] CRAN (R 3.6.0)                  
#>  purrr         0.3.3      2019-10-18 [1] CRAN (R 3.6.1)                  
#>  R6            2.4.1      2019-11-12 [1] CRAN (R 3.6.1)                  
#>  Rcpp          1.0.3      2019-11-08 [1] CRAN (R 3.6.1)                  
#>  remotes       2.1.0      2019-06-24 [1] CRAN (R 3.6.0)                  
#>  rlang         0.4.2      2019-11-23 [1] CRAN (R 3.6.1)                  
#>  rmarkdown     1.18       2019-11-27 [1] CRAN (R 3.6.1)                  
#>  rprojroot     1.3-2      2018-01-03 [1] CRAN (R 3.5.1)                  
#>  sandwich      2.5-1      2019-04-06 [1] CRAN (R 3.6.0)                  
#>  sessioninfo   1.1.1      2018-11-05 [1] CRAN (R 3.6.0)                  
#>  stringi       1.4.3      2019-03-12 [1] CRAN (R 3.6.0)                  
#>  stringr       1.4.0      2019-02-10 [1] CRAN (R 3.6.0)                  
#>  testthat      2.3.1      2019-12-01 [1] CRAN (R 3.6.1)                  
#>  tibble        2.1.3      2019-06-06 [1] CRAN (R 3.6.0)                  
#>  tidyr         1.0.0      2019-09-11 [1] CRAN (R 3.6.1)                  
#>  tidyselect    0.2.5      2018-10-11 [1] CRAN (R 3.5.1)                  
#>  usethis       1.5.1.9000 2019-11-28 [1] Github (r-lib/usethis@c7314cf)  
#>  vctrs         0.2.0      2019-07-05 [1] CRAN (R 3.6.1)                  
#>  withr         2.1.2      2018-03-15 [1] CRAN (R 3.5.1)                  
#>  xfun          0.11       2019-11-12 [1] CRAN (R 3.6.1)                  
#>  yaml          2.2.0      2018-07-25 [1] CRAN (R 3.5.1)                  
#>  zeallot       0.1.0      2018-01-28 [1] CRAN (R 3.5.1)                  
#>  zoo           1.8-6      2019-05-28 [1] CRAN (R 3.6.0)                  
#> 
#> [1] C:/Users/inp099/Documents/R/win-library/3.6
#> [2] C:/Program Files/R/R-3.6.1/library
@alexpghayes alexpghayes changed the title feature request: new tidier for glmx Implement a tidy.glmx() method Dec 13, 2019
@simonpcouch
Copy link
Collaborator

Thanks for the issue! We’ve decided that, in general, we won’t be adding new tidier methods to broom after the upcoming 0.7.0 release in favor of asking the model-owning package (in this case, glmx) to write and export the tidiers. We’ve written some documentation on how to make this happen and have also provided a much lighter-weight dependency than broom, r-lib/generics, to supply the tidier generics. We'll keep that tidymodels.org article linked above up to date with current resources to help in the process.🙂

@github-actions
Copy link

github-actions bot commented Mar 8, 2021

This issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with a reprex: https://reprex.tidyverse.org) and link to this issue.

@github-actions github-actions bot locked and limited conversation to collaborators Mar 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants