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

level argument not working #189

Open
1 of 3 tasks
cknotz opened this issue May 4, 2023 · 0 comments
Open
1 of 3 tasks

level argument not working #189

cknotz opened this issue May 4, 2023 · 0 comments

Comments

@cknotz
Copy link

cknotz commented May 4, 2023

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

Hi,

I think I think the level argument in the margins_summary() function is not working as intended: Setting the confidence level to a different value than 95 has no effect on the output. It seems the argument is simply ignored. This happens with lm() and lme4::glmer(), and when using either margins_summary() or summary(margins()). Strangely, plot(margins()) works as described in the vignette -- but, contrary to what is written there, it is not possible to specify multiple confidence levels.

Hope I'm not misunderstanding something here! Many thanks in advance!

Example:

## load package
library("margins")

## code goes here
data(mtcars)

mod <- lm(mpg ~ hp, data = mtcars)

margins_summary(mod) # baseline
margins_summary(mod, level = .9) # same result
margins_summary(mod, level = .99) # same result

# just for fun
margins_summary(mod, level = 90) # same result
margins_summary(mod, level = 99) # same result
margins_summary(mod, level = .01) # same result
margins_summary(mod, level = "99") # same result

# same here
summary(margins(mod,
                level = 99))

# These work
plot(margins(mod),
     level = c(.9))
plot(margins(mod),
     level = c(.999))

This produces an error ("length of 'dimnames' [2] not equal to array extent")
plot(margins(mod),
     level = c(.999,.9))

## session info for your system
sessionInfo()
R version 4.2.2 (2022-10-31)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Ventura 13.3.1

Matrix products: default
LAPACK: /Library/Frameworks/R.framework/Versions/4.2/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

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.10       rstudioapi_0.14   magrittr_2.0.3    hms_1.1.2         splines_4.2.2     MASS_7.3-58.2    
 [7] tidyselect_1.2.0  xtable_1.8-4      lattice_0.20-45   R6_2.5.1          rlang_1.1.0       minqa_1.2.5      
[13] fansi_1.0.4       dplyr_1.1.0       tools_4.2.2       grid_4.2.2        data.table_1.14.8 nlme_3.1-162     
[19] utf8_1.2.3        cli_3.6.0         ellipsis_0.3.2    lme4_1.1-31       countrycode_1.4.0 tibble_3.2.1     
[25] lifecycle_1.0.3   prediction_0.3.14 Matrix_1.5-3      nloptr_2.0.3      vctrs_0.6.1       labelled_2.10.0  
[31] glue_1.6.2        haven_2.5.1       compiler_4.2.2    pillar_1.8.1      forcats_1.0.0     generics_0.1.3   
[37] boot_1.3-28.1     pkgconfig_2.0.3  
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