Closed IndrajeetPatil closed 5 years ago
Interesting. I consider the behavior in the second case a bug, and we've talked about using the ellipsis
to give informative errors when this happens (#413). The plan was to give ellipsis
a dry-run in the 0.7.0 release, although I haven't done much work in that direction yet.
In the meantime, I think this a result of relying on process_lm()
too much, and I think the short term solution is to improve the documentation so it doesn't seem like conf.int
is an acceptable argument (this would probably also splitting the tidying for objects from robust
off from the lm
logic, which needs to happen at some point anyway).
Also also we need to move to supporting robustbase
instead of robust
because robust
is coming apart at the seams.
The same things holds true for tidier for orcutt
objects-
# model
library(orcutt)
#> Loading required package: lmtest
#> Loading required package: zoo
#>
#> Attaching package: 'zoo'
#> The following objects are masked from 'package:base':
#>
#> as.Date, as.Date.numeric
set.seed(123)
reg <- stats::lm(formula = mpg ~ wt + qsec + disp, data = mtcars)
co <- orcutt::cochrane.orcutt(reg)
# without confidence intervals
broom::tidy(co)
#> Warning in tidy.orcutt(co): deal with tidy.orcutt conf.int nonsense
#> # A tibble: 4 x 5
#> term estimate std.error statistic p.value
#> <chr> <dbl> <dbl> <dbl> <dbl>
#> 1 (Intercept) 21.8 6.63 3.29 0.00279
#> 2 wt -4.85 1.33 -3.65 0.00112
#> 3 qsec 0.797 0.370 2.15 0.0402
#> 4 disp -0.00136 0.0110 -0.123 0.903
# with confidence intervals
broom::tidy(co, conf.int = TRUE)
#> Warning in tidy.orcutt(co, conf.int = TRUE): deal with tidy.orcutt conf.int
#> nonsense
#> Error in UseMethod("vcov"): no applicable method for 'vcov' applied to an object of class "orcutt"
Created on 2019-01-06 by the reprex package (v0.2.1)
The same thing holds true for lavaan
object. The culprit here, I think, is lavaan
since the function doesn't have ...
argument and so irrelevant arguments are not ignored.
# setup
set.seed(123)
library(lavaan)
#> This is lavaan 0.6-3
#> lavaan is BETA software! Please report any bugs.
# model
cfa.fit <- cfa('F =~ x1 + x2 + x3 + x4',
data = HolzingerSwineford1939, group = "school")
# tidieer
broom::tidy(
x = cfa.fit,
conf.int = TRUE,
conf.level = 0.99,
quick = TRUE
)
#> Error in lavaan::parameterEstimates(x, ci = conf.int, level = conf.level, : unused argument (quick = TRUE)
Created on 2019-01-12 by the reprex package (v0.2.1)
on it
Here is another issue with this tidier. Although it takes quick
argument, if you specify it, the function produces error-
# set up
set.seed(123)
library(robust)
#> Loading required package: fit.models
data(stack.dat)
# model
stack.rob <- robust::lmRob(formula = Loss ~ ., data = stack.dat)
# broom outputs
broom::tidy(x = stack.rob,
conf.int = TRUE,
conf.level = 0.95,
quick = FALSE)
#> Warning in if (quick) {: the condition has length > 1 and only the first
#> element will be used
#> Error in if (quick) {: argument is not interpretable as logical
Created on 2019-01-20 by the reprex package (v0.2.1)
Note to self: need to turn this into a separate issue.
I did some improvements on this (https://github.com/tidymodels/broom/pull/618), I made tidy.lmRob
only evaluate x
and conf.level
, and all other arguments will be ignored. It might serve while the tidy.lm
is the actual method :)
I'm closing this in favor of more specific issues:
lmRob
and glmRob
need custom tidiers. This is now issue #589.orcutt
exploding when conf.int
is passed is #590 lavaan
exploding when quick = TRUE
is passed is #628.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.
Currently, confidence intervals are not available for models from
robust
package, so I was expecting settingconf.int = TRUE
would just return the tidy output without confidence intervals. But instead this actually produces an error.This is not the case for other tidiers which clearly don't output confidence intervals but nevertheless work if
conf.int = TRUE
. For example-It will be nice to have this behavior also for tidiers for
robust
package models specifically, and other models more generally. This way, one doesn't need to keep changing thebroom::tidy()
function call based on the class of the object.Created on 2018-12-17 by the reprex package (v0.2.1)
Session info
``` r devtools::session_info() #> - Session info ---------------------------------------------------------- #> setting value #> version R Under development (unstable) (2018-11-30 r75724) #> os Windows 10 x64 #> system x86_64, mingw32 #> ui RTerm #> language (EN) #> collate English_United States.1252 #> ctype English_United States.1252 #> tz Asia/Calcutta #> date 2018-12-17 #> #> - Packages -------------------------------------------------------------- #> package * version date lib #> assertthat 0.2.0 2017-04-11 [1] #> backports 1.1.3 2018-12-14 [1] #> bindr 0.1.1 2018-03-13 [1] #> bindrcpp 0.2.2 2018-03-29 [1] #> broom * 0.5.1.9000 2018-12-09 [1] #> callr 3.1.0 2018-12-10 [1] #> cli 1.0.1.9000 2018-10-30 [1] #> cluster 2.0.7-1 2018-04-13 [2] #> crayon 1.3.4 2017-09-16 [1] #> DEoptimR 1.0-8 2016-11-19 [1] #> desc 1.2.0 2018-10-30 [1] #> devtools 2.0.1 2018-10-26 [1] #> digest 0.6.18 2018-10-10 [1] #> dplyr 0.7.8 2018-11-10 [1] #> evaluate 0.12 2018-10-09 [1] #> fansi 0.4.0 2018-11-05 [1] #> fit.models * 0.5-14 2017-04-06 [1] #> fs 1.2.6 2018-08-23 [1] #> generics 0.0.2 2018-11-29 [1] #> glue 1.3.0 2018-07-17 [1] #> highr 0.7 2018-06-09 [1] #> htmltools 0.3.6 2017-04-28 [1] #> knitr 1.21 2018-12-10 [1] #> lattice 0.20-38 2018-11-04 [2] #> magrittr 1.5 2014-11-22 [1] #> MASS 7.3-51.1 2018-11-01 [2] #> memoise 1.1.0 2017-04-21 [1] #> mvtnorm 1.0-8 2018-05-31 [1] #> pcaPP 1.9-73 2018-01-14 [1] #> pillar 1.3.1 2018-12-15 [1] #> pkgbuild 1.0.2 2018-10-16 [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.2.1 2018-12-05 [1] #> ps 1.2.1 2018-11-06 [1] #> purrr 0.2.5.9000 2018-11-28 [1] #> R6 2.3.0 2018-10-04 [1] #> Rcpp 1.0.0 2018-11-07 [1] #> remotes 2.0.2 2018-10-30 [1] #> rlang 0.3.0.1 2018-10-25 [1] #> rmarkdown 1.11 2018-12-08 [1] #> robust * 0.4-18 2017-04-27 [1] #> robustbase 0.93-3 2018-09-21 [1] #> rprojroot 1.3-2 2018-01-03 [1] #> rrcov 1.4-7 2018-11-15 [1] #> sessioninfo 1.1.1 2018-11-05 [1] #> stringi 1.2.4 2018-07-20 [1] #> stringr 1.3.1 2018-05-10 [1] #> testthat 2.0.1 2018-10-13 [1] #> tibble 1.4.99.9006 2018-11-29 [1] #> tidyr 0.8.2 2018-10-28 [1] #> tidyselect 0.2.5 2018-10-11 [1] #> usethis 1.4.0.9000 2018-12-12 [1] #> utf8 1.1.4 2018-05-24 [1] #> withr 2.1.2 2018-03-15 [1] #> xfun 0.4 2018-10-23 [1] #> yaml 2.2.0 2018-07-25 [1] #> source #> CRAN (R 3.5.1) #> CRAN (R 3.6.0) #> CRAN (R 3.5.1) #> CRAN (R 3.5.1) #> Github (tidymodels/broom@9a85f75) #> CRAN (R 3.6.0) #> Github (r-lib/cli@56538e3) #> CRAN (R 3.6.0) #> CRAN (R 3.5.1) #> CRAN (R 3.5.0) #> Github (r-lib/desc@7c12d36) #> CRAN (R 3.5.1) #> CRAN (R 3.5.1) #> CRAN (R 3.5.1) #> CRAN (R 3.5.1) #> Github (brodieG/fansi@ab11e9c) #> CRAN (R 3.5.1) #> CRAN (R 3.5.1) #> CRAN (R 3.6.0) #> CRAN (R 3.5.1) #> CRAN (R 3.5.1) #> CRAN (R 3.5.1) #> CRAN (R 3.6.0) #> CRAN (R 3.6.0) #> CRAN (R 3.5.1) #> CRAN (R 3.6.0) #> CRAN (R 3.5.1) #> CRAN (R 3.5.0) #> CRAN (R 3.5.0) #> 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.0) #> CRAN (R 3.6.0) #> Github (tidyverse/purrr@b4ae036) #> CRAN (R 3.5.1) #> CRAN (R 3.6.0) #> CRAN (R 3.6.0) #> CRAN (R 3.5.1) #> CRAN (R 3.6.0) #> CRAN (R 3.5.1) #> CRAN (R 3.5.1) #> CRAN (R 3.5.1) #> CRAN (R 3.6.0) #> CRAN (R 3.6.0) #> CRAN (R 3.6.0) #> CRAN (R 3.5.1) #> CRAN (R 3.5.1) #> Github (tidyverse/tibble@a248cf1) #> CRAN (R 3.6.0) #> CRAN (R 3.5.1) #> Github (r-lib/usethis@923dd75) #> CRAN (R 3.5.1) #> CRAN (R 3.5.1) #> CRAN (R 3.6.0) #> CRAN (R 3.5.1) #> #> [1] C:/Users/inp099/Documents/R/win-library/3.6 #> [2] C:/Program Files/R/R-devel/library ```