tidymodels / broom

Convert statistical analysis objects from R into tidy format
https://broom.tidymodels.org
Other
1.46k stars 304 forks source link

`glance` method fails for `slm` objects #774

Closed IndrajeetPatil closed 4 years ago

IndrajeetPatil commented 5 years ago

# setup
set.seed(123)
library(slm)
data("shan")

# model
mod <- slm(
  myformula = shan$PM_Xuhui ~ .,
  data = shan,
  method_cov_st = "fitAR",
  model_selec = -1
)

# tidier
broom::tidy(mod)
#> # A tibble: 10 x 5
#>    term           estimate std.error statistic  p.value
#>    <chr>             <dbl>     <dbl>     <dbl>    <dbl>
#>  1 (Intercept)   -54.9     143.         -0.383 0.702   
#>  2 PM_Jingan       0.596     0.0285     21.0   0       
#>  3 PM_US.Post      0.376     0.0309     12.2   0       
#>  4 DEWP           -1.04      0.336      -3.09  0.00198 
#>  5 HUMI            0.292     0.0931      3.13  0.00173 
#>  6 PRES            0.0253    0.138       0.184 0.854   
#>  7 TEMP            1.31      0.341       3.83  0.000129
#>  8 Iws            -0.00765   0.00570    -1.34  0.179   
#>  9 precipitation   0.463     0.126       3.68  0.000229
#> 10 Iprec          -0.125     0.0647     -1.94  0.0523

# glance
broom::glance(mod)
#> Error in eval_tidy(xs[[i]], unique_output): object 'adj.r.squared' not found

Created on 2019-10-24 by the reprex package (v0.3.0)

Session info ``` r 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-10-24 #> #> - 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-04-03 [1] Github (r-lib/desc@c860e7b) #> devtools 2.2.1 2019-09-24 [1] CRAN (R 3.6.1) #> digest 0.6.22 2019-10-21 [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) #> expm 0.999-4 2019-03-21 [1] CRAN (R 3.6.0) #> fansi 0.4.0 2018-11-05 [1] Github (brodieG/fansi@ab11e9c) #> 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) #> 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.25 2019-09-18 [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) #> ltsa 1.4.6 2015-12-21 [1] CRAN (R 3.6.0) #> magrittr 1.5 2014-11-22 [1] CRAN (R 3.5.1) #> Matrix 1.2-17 2019-03-22 [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.0 2019-02-14 [1] CRAN (R 3.6.0) #> Rcpp 1.0.2 2019-07-25 [1] CRAN (R 3.6.1) #> remotes 2.1.0 2019-06-24 [1] CRAN (R 3.6.0) #> rlang 0.4.1 2019-10-24 [1] Github (r-lib/rlang@30feeac) #> rmarkdown 1.16 2019-10-01 [1] CRAN (R 3.6.1) #> rprojroot 1.3-2 2018-01-03 [1] CRAN (R 3.5.1) #> sessioninfo 1.1.1 2018-11-05 [1] CRAN (R 3.6.0) #> slm * 1.1.0 2019-10-24 [1] CRAN (R 3.6.1) #> 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.2.1 2019-07-25 [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-10-18 [1] Github (r-lib/usethis@55cff6e) #> utf8 1.1.4 2018-05-24 [1] CRAN (R 3.5.1) #> 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.10 2019-10-01 [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) #> #> [1] C:/Users/inp099/Documents/R/win-library/3.6 #> [2] C:/Program Files/R/R-3.6.1/library ```
vincentarelbundock commented 4 years ago

As far as I can tell, the slm package does not produce "normal" lm objects, and slm objects are unsupported by broom. This is not a bug, but a feature request for a new tidier.

Label and Title of issue should be corrected.

IndrajeetPatil commented 4 years ago

broom is not accepting new tidier requests, so I will be closing this.

github-actions[bot] commented 3 years ago

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.