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

margins() not running for model of class bigglm #186

Open
1 of 3 tasks
rosemm opened this issue Jun 30, 2022 · 0 comments
Open
1 of 3 tasks

margins() not running for model of class bigglm #186

rosemm opened this issue Jun 30, 2022 · 0 comments

Comments

@rosemm
Copy link

rosemm commented Jun 30, 2022

I saw that bigglm is supported in prediction (thank you!), but I'm not able to run margins() on a bigglm model. Not sure if this is a bug or if I'm just doing something wrong here, but wanted to draw your attention to it in case it's a bug.

Please specify whether your issue is about:

  • a possible bug
  • a question about package functionality
  • a suggested code or documentation change, improvement to the code, or feature request

If you are reporting (1) a bug or (2) a question about code, please supply:

  • a fully reproducible example using a publicly available dataset (or provide your data)
  • if an error is occurring, include the output of traceback() run immediately after the error occurs
  • the output of sessionInfo()

Put your code here:

## load package
library("margins")
library("biglm")

# model run with glm
a <- glm(am ~ hp, data = mtcars, family = binomial)
# same model run with bigglm
b <- bigglm(am ~ hp, data = mtcars, family = binomial(), chunksize=10, sandwich=TRUE)
margins(a) # works
margins(b) # stops on error (error text and traceback below)

Error in x$terms %||% attr(x, "terms") %||% stop("no terms component nor attribute") : 
  no terms component nor attribute
> traceback()
8: stop("no terms component nor attribute")
7: x$terms %||% attr(x, "terms") %||% stop("no terms component nor attribute")
6: terms.default(find_data(model))
5: terms(find_data(model))
4: find_terms_in_model.default(model, variables = variables)
3: find_terms_in_model(model, variables = variables)
2: margins.default(b)
1: margins(b)


b$terms # note that there is a terms component

## session info for your system
> sessionInfo()
R version 4.1.0 (2021-05-18)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Big Sur 11.6.5

Matrix products: default
LAPACK: /Library/Frameworks/R.framework/Versions/4.1/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] margins_0.3.26 biglm_0.9-2.1  DBI_1.1.1     

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.7        pillar_1.6.2      compiler_4.1.0    tools_4.1.0      
 [5] digest_0.6.27     lubridate_1.7.10  evaluate_0.14     lifecycle_1.0.0  
 [9] tibble_3.1.4      gtable_0.3.0      pkgconfig_2.0.3   rlang_0.4.11     
[13] cli_3.0.1         rstudioapi_0.13   yaml_2.2.1        xfun_0.31        
[17] fastmap_1.1.0     dplyr_1.0.7       knitr_1.33        generics_0.1.0   
[21] vctrs_0.3.8       grid_4.1.0        tidyselect_1.1.1  data.table_1.14.0
[25] glue_1.4.2        R6_2.5.1          fansi_0.5.0       prediction_0.3.14
[29] rmarkdown_2.14    ggplot2_3.3.5     purrr_0.3.4       magrittr_2.0.1   
[33] MASS_7.3-54       scales_1.1.1      ellipsis_0.3.2    htmltools_0.5.2  
[37] assertthat_0.2.1  colorspace_2.0-2  utf8_1.2.2        munsell_0.5.0    
[41] crayon_1.4.1     
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant