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

pool() on lavaan objects gives error: illegal arguments passed to lavaan::parameterEstimates #614

Closed
3 tasks done
Gootjes opened this issue Jan 14, 2024 · 1 comment
Closed
3 tasks done
Labels

Comments

@Gootjes
Copy link

Gootjes commented Jan 14, 2024

Before submitting the issue

  • Check whether a bug report is the right format for your issue. For questions about using the mice package, see Discussions. For theoretical background about the mice methods, see Flexible Imputation of Missing Data.
  • Please make sure that you are using the latest version of mice (e.g. with the packageVersion() or sessionInfo() function).
  • Please verify whether the bug has already been addressed (e.g. on GitHub or Stack Overflow.

Describe the bug
Invalid arguments passed to lavaan::parameterEstimates via broom::tidy.lavaan raise an error.
Invalid arguments are passed here:

v <- lapply(fitlist, tidy, effects = "fixed", parametric = TRUE, ...) %>% bind_rows()

To Reproduce

library(lavaan)
#> This is lavaan 0.6-15
#> lavaan is FREE software! Please report any bugs.
library(mice)
#> 
#> Attaching package: 'mice'
#> The following object is masked from 'package:stats':
#> 
#>     filter
#> The following objects are masked from 'package:base':
#> 
#>     cbind, rbind
pool(list(sem("mpg ~ cyl", data = mtcars[1:10,]), sem("mpg ~ cyl", data = mtcars[1:20,])), dfcom = 18)
#> Warning: The `exponentiate` argument is not supported in the `tidy()` method
#> for `lavaan` objects and will be ignored.
#> Error in `purrr::keep()`:
#> ℹ In index: 1.
#> ℹ With name: estimate.
#> Caused by error in `lavaan::parameterEstimates()`:
#> ! unused arguments (effects = "fixed", parametric = TRUE, exponentiate = FALSE)
#> Backtrace:
#>      ▆
#>   1. ├─mice::pool(...)
#>   2. │ └─mice:::pool.fitlist(...)
#>   3. │   ├─base::summary(fitlist, type = "tidy", exponentiate = FALSE)
#>   4. │   └─mice:::summary.mira(fitlist, type = "tidy", exponentiate = FALSE)
#>   5. │     ├─... %>% bind_rows()
#>   6. │     └─base::lapply(...)
#>   7. │       ├─generics (local) FUN(X[[i]], ...)
#>   8. │       └─broom:::tidy.lavaan(X[[i]], ...)
#>   9. │         └─... %>% as_tibble()
#>  10. ├─dplyr::bind_rows(.)
#>  11. │ └─rlang::list2(...)
#>  12. ├─tibble::as_tibble(.)
#>  13. ├─dplyr::select(...)
#>  14. ├─broom:::rename2(...)
#>  15. │ └─purrr::keep(dots, ~quo_name(.x) %in% colnames(.data))
#>  16. │   └─purrr:::where_if(.x, .p, ...)
#>  17. │     └─purrr:::map_(.x, .p, ..., .type = "logical", .purrr_error_call = .purrr_error_call)
#>  18. │       ├─purrr:::with_indexed_errors(...)
#>  19. │       │ └─base::withCallingHandlers(...)
#>  20. │       ├─purrr:::call_with_cleanup(...)
#>  21. │       └─purrr (local) .f(.x[[i]], ...)
#>  22. │         └─broom (local) .fn(...)
#>  23. │           ├─quo_name(.x) %in% colnames(.data)
#>  24. │           └─base::colnames(.data)
#>  25. │             └─base::is.data.frame(x)
#>  26. ├─dplyr::mutate(., term = paste(lhs, op, rhs))
#>  27. ├─tibble::rownames_to_column(.)
#>  28. ├─tibble::as_tibble(.)
#>  29. └─base::.handleSimpleError(...)
#>  30.   └─purrr (local) h(simpleError(msg, call))
#>  31.     └─cli::cli_abort(...)
#>  32.       └─rlang::abort(...)

Created on 2024-01-14 with reprex v2.0.2

Expected behavior
Pooled results for lavaan fit objects.

Screenshots
If applicable, add screenshots to help explain your problem.

Additional context
Add any other context about the problem here.

@Gootjes Gootjes added the bug label Jan 14, 2024
@Gootjes Gootjes changed the title pool() on lavaan objects gives errors pool() on lavaan objects gives error: illegal arguments passed to lavaan::parameterEstimates Jan 14, 2024
@stefvanbuuren
Copy link
Member

Fixed in mice 3.16.9

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants