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 tidy.tobit() method or set to default method to get better error #749

Closed
IndrajeetPatil opened this issue Aug 19, 2019 · 2 comments

Comments

@IndrajeetPatil
Copy link
Contributor

IndrajeetPatil commented Aug 19, 2019

# setup
set.seed(123)
library(AER)
#> Loading required package: car
#> Loading required package: carData
#> Loading required package: lmtest
#> Loading required package: zoo
#> 
#> Attaching package: 'zoo'
#> The following objects are masked from 'package:base':
#> 
#>     as.Date, as.Date.numeric
#> Loading required package: sandwich
#> Loading required package: survival
data("Affairs", package = "AER")

# model
m1 <-
  AER::tobit(affairs ~ age + yearsmarried + religiousness + occupation + rating,
             data = Affairs)

# tidier
broom::tidy(m1)
#> Error in if (!is.null(newnames) && length(newnames) != ncol(x)) {: missing value where TRUE/FALSE needed

Created on 2019-08-18 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       America/New_York            
#>  date     2019-08-18                  
#> 
#> - Packages --------------------------------------------------------------
#>  package     * version     date       lib
#>  abind         1.4-5       2016-07-21 [1]
#>  AER         * 1.2-7       2019-07-31 [1]
#>  assertthat    0.2.1       2019-03-21 [1]
#>  backports     1.1.4       2019-04-10 [1]
#>  broom         0.5.2.9002  2019-08-15 [1]
#>  callr         3.3.1       2019-07-18 [1]
#>  car         * 3.0-3       2019-05-27 [1]
#>  carData     * 3.0-2       2018-09-30 [1]
#>  cellranger    1.1.0       2016-07-27 [1]
#>  cli           1.1.0       2019-03-19 [1]
#>  crayon        1.3.4       2017-09-16 [1]
#>  curl          4.0         2019-07-22 [1]
#>  data.table    1.12.2      2019-04-07 [1]
#>  desc          1.2.0       2019-04-03 [1]
#>  devtools      2.1.0       2019-07-06 [1]
#>  digest        0.6.20      2019-07-04 [1]
#>  dplyr         0.8.3       2019-07-04 [1]
#>  evaluate      0.14        2019-05-28 [1]
#>  forcats       0.4.0       2019-02-17 [1]
#>  foreign       0.8-71      2018-07-20 [2]
#>  Formula       1.2-3       2018-05-03 [1]
#>  fs            1.3.1       2019-05-06 [1]
#>  generics      0.0.2       2019-03-05 [1]
#>  glue          1.3.1       2019-03-12 [1]
#>  haven         2.1.1       2019-07-04 [1]
#>  highr         0.8         2019-03-20 [1]
#>  hms           0.5.0       2019-07-09 [1]
#>  htmltools     0.3.6       2017-04-28 [1]
#>  knitr         1.24        2019-08-08 [1]
#>  lattice       0.20-38     2018-11-04 [2]
#>  lifecycle     0.1.0       2019-08-01 [1]
#>  lmtest      * 0.9-37      2019-04-30 [1]
#>  magrittr      1.5         2014-11-22 [1]
#>  Matrix        1.2-17      2019-03-22 [1]
#>  memoise       1.1.0       2017-04-21 [1]
#>  openxlsx      4.1.0.1     2019-05-28 [1]
#>  pillar        1.4.2       2019-06-29 [1]
#>  pkgbuild      1.0.4       2019-08-05 [1]
#>  pkgconfig     2.0.2       2018-08-16 [1]
#>  pkgload       1.0.2       2018-10-29 [1]
#>  prettyunits   1.0.2       2015-07-13 [1]
#>  processx      3.4.1       2019-07-18 [1]
#>  ps            1.3.0       2018-12-21 [1]
#>  purrr         0.3.2       2019-03-15 [1]
#>  R6            2.4.0       2019-02-14 [1]
#>  Rcpp          1.0.2       2019-07-25 [1]
#>  readxl        1.3.1       2019-03-13 [1]
#>  remotes       2.1.0       2019-06-24 [1]
#>  rio           0.5.16      2018-11-26 [1]
#>  rlang         0.4.0       2019-06-25 [1]
#>  rmarkdown     1.14.3      2019-08-02 [1]
#>  rprojroot     1.3-2       2018-01-03 [1]
#>  sandwich    * 2.5-1       2019-04-06 [1]
#>  sessioninfo   1.1.1       2018-11-05 [1]
#>  stringi       1.4.3       2019-03-12 [1]
#>  stringr       1.4.0       2019-02-10 [1]
#>  survival    * 2.44-1.1    2019-04-01 [2]
#>  testthat      2.2.1       2019-07-25 [1]
#>  tibble        2.1.3       2019-06-06 [1]
#>  tidyr         0.8.99.9000 2019-08-11 [1]
#>  tidyselect    0.2.5       2018-10-11 [1]
#>  usethis       1.5.1.9000  2019-07-27 [1]
#>  vctrs         0.2.0       2019-07-05 [1]
#>  withr         2.1.2       2018-03-15 [1]
#>  xfun          0.8         2019-06-25 [1]
#>  yaml          2.2.0       2018-07-25 [1]
#>  zeallot       0.1.0       2018-01-28 [1]
#>  zip           2.0.3       2019-07-03 [1]
#>  zoo         * 1.8-6       2019-05-28 [1]
#>  source                            
#>  CRAN (R 3.5.0)                    
#>  CRAN (R 3.6.1)                    
#>  CRAN (R 3.6.0)                    
#>  CRAN (R 3.6.0)                    
#>  local                             
#>  CRAN (R 3.6.1)                    
#>  CRAN (R 3.6.0)                    
#>  CRAN (R 3.5.1)                    
#>  CRAN (R 3.5.1)                    
#>  CRAN (R 3.6.0)                    
#>  CRAN (R 3.5.1)                    
#>  CRAN (R 3.6.1)                    
#>  CRAN (R 3.5.3)                    
#>  Github (r-lib/desc@c860e7b)       
#>  CRAN (R 3.6.1)                    
#>  CRAN (R 3.6.0)                    
#>  CRAN (R 3.6.0)                    
#>  CRAN (R 3.6.0)                    
#>  CRAN (R 3.5.2)                    
#>  CRAN (R 3.6.1)                    
#>  CRAN (R 3.5.0)                    
#>  CRAN (R 3.6.0)                    
#>  Github (r-lib/generics@c15ac43)   
#>  CRAN (R 3.6.0)                    
#>  CRAN (R 3.6.0)                    
#>  CRAN (R 3.6.0)                    
#>  CRAN (R 3.6.1)                    
#>  CRAN (R 3.5.1)                    
#>  CRAN (R 3.6.1)                    
#>  CRAN (R 3.6.1)                    
#>  CRAN (R 3.6.1)                    
#>  CRAN (R 3.6.0)                    
#>  CRAN (R 3.5.1)                    
#>  CRAN (R 3.6.0)                    
#>  CRAN (R 3.6.0)                    
#>  CRAN (R 3.6.0)                    
#>  CRAN (R 3.6.0)                    
#>  CRAN (R 3.6.1)                    
#>  CRAN (R 3.5.1)                    
#>  CRAN (R 3.6.0)                    
#>  CRAN (R 3.5.1)                    
#>  CRAN (R 3.6.1)                    
#>  CRAN (R 3.6.0)                    
#>  CRAN (R 3.6.0)                    
#>  CRAN (R 3.6.0)                    
#>  CRAN (R 3.6.1)                    
#>  CRAN (R 3.6.0)                    
#>  CRAN (R 3.6.0)                    
#>  CRAN (R 3.6.0)                    
#>  CRAN (R 3.6.0)                    
#>  Github (rstudio/rmarkdown@37bcb8f)
#>  CRAN (R 3.5.1)                    
#>  CRAN (R 3.6.0)                    
#>  CRAN (R 3.6.0)                    
#>  CRAN (R 3.6.0)                    
#>  CRAN (R 3.6.0)                    
#>  CRAN (R 3.6.1)                    
#>  CRAN (R 3.6.1)                    
#>  CRAN (R 3.6.0)                    
#>  Github (tidyverse/tidyr@908da2c)  
#>  CRAN (R 3.5.1)                    
#>  Github (r-lib/usethis@b241420)    
#>  CRAN (R 3.6.1)                    
#>  CRAN (R 3.5.1)                    
#>  CRAN (R 3.6.0)                    
#>  CRAN (R 3.5.1)                    
#>  CRAN (R 3.5.1)                    
#>  CRAN (R 3.6.0)                    
#>  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 survreg tidier doesn't work for tobit regression Implement tidy.tobit() method or set to default method to get better error Aug 20, 2019
@alexpghayes
Copy link
Collaborator

alexpghayes commented Aug 20, 2019

Solution: either tidy.tobit <- tidy.default or implement a tidy.tobit() method.

  • Don't forget a regression test
library(AER)
#> Loading required package: car
#> Loading required package: carData
#> Loading required package: lmtest
#> Loading required package: zoo
#> 
#> Attaching package: 'zoo'
#> The following objects are masked from 'package:base':
#> 
#>     as.Date, as.Date.numeric
#> Loading required package: sandwich
#> Loading required package: survival

data("Affairs", package = "AER")

m1 <- AER::tobit(affairs ~ age + yearsmarried, data = Affairs)

class(m1)
#> [1] "tobit"   "survreg"

Created on 2019-08-19 by the reprex package (v0.3.0)

@github-actions
Copy link

github-actions bot commented Mar 9, 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 9, 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

2 participants