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

Tests for data / model.frame() equality too strict #105

Open
matthiasgomolka opened this issue Mar 2, 2023 · 0 comments
Open

Tests for data / model.frame() equality too strict #105

matthiasgomolka opened this issue Mar 2, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@matthiasgomolka
Copy link
Owner

matthiasgomolka commented Mar 2, 2023

When estimating a plm() model, all variables in model.frame() gain the additional class attribute "pseries". This leads to an error in

  if (!data.table::fsetequal(stats::na.omit(model_frame), 
    stats::na.omit(data[, names(model_frame), with = FALSE]))) {
    stop("'data' is not the data.frame which was used in 'model'.")
  }

within sdc_model().

Here' a reprex:

library(plm)
library(sdcLog)

data("Grunfeld", package="plm")

mod_plm <- plm(inv~value+capital, data = Grunfeld, model = "within")
sdc_model(Grunfeld, mod_plm, id_var = "firm")
#> Error in .set_ops_arg_check(x, y, all): Item 1 of x is 'pseries' but the corresponding item of y is 'numeric'.

Created on 2023-03-02 with reprex v2.0.2

Session info
sessioninfo::session_info()
#> ─ Session info ───────────────────────────────────────────────────────────────
#>  setting  value
#>  version  R version 4.2.2 (2022-10-31 ucrt)
#>  os       Windows 10 x64 (build 19044)
#>  system   x86_64, mingw32
#>  ui       RTerm
#>  language en
#>  collate  German_Germany.utf8
#>  ctype    German_Germany.utf8
#>  tz       Europe/Berlin
#>  date     2023-03-02
#>  pandoc   2.19.2 @ C:/Program Files/R/RStudio-2022.07/bin/quarto/bin/tools/ (via rmarkdown)
#> 
#> ─ Packages ───────────────────────────────────────────────────────────────────
#>  package     * version    date (UTC) lib source
#>  assertthat    0.2.1      2019-03-21 [1] CRAN (R 4.2.2)
#>  backports     1.4.1      2021-12-13 [1] CRAN (R 4.2.0)
#>  bdsmatrix     1.3-6      2022-06-03 [1] CRAN (R 4.2.0)
#>  broom         1.0.1      2022-08-29 [1] CRAN (R 4.2.2)
#>  checkmate     2.1.0      2022-04-21 [1] CRAN (R 4.2.2)
#>  cli           3.4.1      2022-09-23 [1] CRAN (R 4.2.2)
#>  collapse      1.8.9      2022-10-07 [1] CRAN (R 4.2.2)
#>  data.table    1.14.6     2022-11-16 [1] CRAN (R 4.2.2)
#>  DBI           1.1.3      2022-06-18 [1] CRAN (R 4.2.2)
#>  digest        0.6.31     2022-12-11 [1] CRAN (R 4.2.2)
#>  dplyr         1.0.10     2022-09-01 [1] CRAN (R 4.2.2)
#>  dreamerr      1.2.3      2020-12-05 [1] CRAN (R 4.2.2)
#>  evaluate      0.18       2022-11-07 [1] CRAN (R 4.2.2)
#>  fansi         1.0.3      2022-03-24 [1] CRAN (R 4.2.2)
#>  fastmap       1.1.0      2021-01-25 [1] CRAN (R 4.2.2)
#>  fixest        0.11.0     2022-10-19 [1] CRAN (R 4.2.2)
#>  Formula       1.2-4      2020-10-16 [1] CRAN (R 4.2.0)
#>  fs            1.5.2      2021-12-08 [1] CRAN (R 4.2.2)
#>  generics      0.1.3      2022-07-05 [1] CRAN (R 4.2.2)
#>  glue          1.6.2      2022-02-24 [1] CRAN (R 4.2.2)
#>  highr         0.9        2021-04-16 [1] CRAN (R 4.2.2)
#>  htmltools     0.5.4      2022-12-07 [1] CRAN (R 4.2.2)
#>  knitr         1.41       2022-11-18 [1] CRAN (R 4.2.2)
#>  lattice       0.20-45    2021-09-22 [2] CRAN (R 4.2.2)
#>  lifecycle     1.0.3      2022-10-07 [1] CRAN (R 4.2.2)
#>  lmtest        0.9-40     2022-03-21 [1] CRAN (R 4.2.2)
#>  magrittr      2.0.3      2022-03-30 [1] CRAN (R 4.2.2)
#>  MASS          7.3-58.1   2022-08-03 [2] CRAN (R 4.2.2)
#>  mathjaxr      1.6-0      2022-02-28 [1] CRAN (R 4.2.2)
#>  maxLik        1.5-2      2021-07-26 [1] CRAN (R 4.2.0)
#>  miscTools     0.6-26     2019-12-08 [1] CRAN (R 4.2.2)
#>  nlme          3.1-160    2022-10-10 [2] CRAN (R 4.2.2)
#>  numDeriv      2016.8-1.1 2019-06-06 [1] CRAN (R 4.2.0)
#>  pillar        1.8.1      2022-08-19 [1] CRAN (R 4.2.2)
#>  pkgconfig     2.0.3      2019-09-22 [1] CRAN (R 4.2.2)
#>  plm         * 2.6-2      2022-08-16 [1] CRAN (R 4.2.2)
#>  purrr         0.3.5      2022-10-06 [1] CRAN (R 4.2.2)
#>  R.cache       0.16.0     2022-07-21 [1] CRAN (R 4.2.2)
#>  R.methodsS3   1.8.2      2022-06-13 [1] CRAN (R 4.2.0)
#>  R.oo          1.25.0     2022-06-12 [1] CRAN (R 4.2.0)
#>  R.utils       2.12.2     2023-01-11 [1] local
#>  R6            2.5.1      2021-08-19 [1] CRAN (R 4.2.2)
#>  rbibutils     2.2.11     2022-12-08 [1] CRAN (R 4.2.2)
#>  Rcpp          1.0.9      2022-07-08 [1] CRAN (R 4.2.2)
#>  Rdpack        2.4        2022-07-20 [1] CRAN (R 4.2.2)
#>  reprex        2.0.2      2022-08-17 [1] CRAN (R 4.2.2)
#>  rlang         1.0.6      2022-09-24 [1] CRAN (R 4.2.2)
#>  rmarkdown     2.18       2022-11-09 [1] CRAN (R 4.2.2)
#>  rstudioapi    0.14       2022-08-22 [1] CRAN (R 4.2.2)
#>  sandwich      3.0-2      2022-06-15 [1] CRAN (R 4.2.2)
#>  sdcLog      * 0.5.0      2022-03-19 [1] CRAN (R 4.2.2)
#>  sessioninfo   1.2.2      2021-12-06 [1] CRAN (R 4.2.2)
#>  stringi       1.7.8      2022-07-11 [1] CRAN (R 4.2.1)
#>  stringr       1.5.0      2022-12-02 [1] CRAN (R 4.2.2)
#>  styler        1.8.1      2022-11-07 [1] CRAN (R 4.2.2)
#>  tibble        3.1.8      2022-07-22 [1] CRAN (R 4.2.2)
#>  tidyr         1.2.1      2022-09-08 [1] CRAN (R 4.2.2)
#>  tidyselect    1.2.0      2022-10-10 [1] CRAN (R 4.2.2)
#>  utf8          1.2.2      2021-07-24 [1] CRAN (R 4.2.2)
#>  vctrs         0.5.1      2022-11-16 [1] CRAN (R 4.2.2)
#>  withr         2.5.0      2022-03-03 [1] CRAN (R 4.2.2)
#>  xfun          0.35       2022-11-16 [1] CRAN (R 4.2.2)
#>  yaml          2.3.6      2022-10-18 [1] CRAN (R 4.2.2)
#>  zoo           1.8-11     2022-09-17 [1] CRAN (R 4.2.2)
#> 
#>  [1] C:/Users/s1504gl/AppData/Local/R/win-library/4.2
#>  [2] C:/Program Files/R/R-4.2.2/library
#> 
#> ──────────────────────────────────────────────────────────────────────────────
@matthiasgomolka matthiasgomolka added the bug Something isn't working label Mar 2, 2023
@matthiasgomolka matthiasgomolka changed the title Tests for data / model.frame() equality too strict Tests for data / model.frame() equality too strict Mar 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant