Closed proshano closed 1 year ago
I have now found that confint() provides the same confidence intervals as are presented in tbl_regression(). I wonder if the problem is more with confint()
Hi @proshano , thanks for the report.
There are various default methods for the CI calculation. We use the defaults from broom::tidy.glm()
and you can look into the various options (all of which can be implemented in tbl_regression()
). But this is not a bug...just a different estimation method.
Your package is wonderful and you are outstanding in your responsiveness.
Thank you
Awww, thank you for the kind words
I do not know how to include a "reproducible example" of this particular issue but want to direct attention that their may be a problem.
It pertains to just a single covariate in a large logistic model. I cannot identify any specific reason why this occurs:
After glm logistic regression, tbl_regression provides 95% CIs that are substantially discordant with the standard error estimate from summary() run on the glm object and discordant from the p-value that is reported in both summary() and by tbl_regression. Stata also produces a different 95% CI from tbl_regression but matches summary().
The differences are not trivial:
tbl_regression: 0.19 (0.01 to 0.88), p = 0.10 stata and summary() after glm: 0.19 (.03 to 1.40), p = 0.10
R version 4.2.2 (2022-10-31) Platform: aarch64-apple-darwin20 (64-bit) Running under: macOS Ventura 13.2
Matrix products: default LAPACK: /Library/Frameworks/R.framework/Versions/4.2-arm64/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] DescTools_0.99.47 devtools_2.4.5 usethis_2.1.6 flexsurv_2.2.1 cmprsk_2.2-11 ggsci_2.9
[7] rms_6.3-0 SparseM_1.81 Hmisc_4.7-2 lattice_0.20-45 gt_0.8.0 gtsummary_1.6.3
[13] forcats_0.5.2 stringr_1.5.0.9000 dplyr_1.0.10 purrr_1.0.0 readr_2.1.3 tidyr_1.2.1.9001
[19] tibble_3.1.8 tidyverse_1.3.2 lubridate_1.9.0 timechange_0.1.1 survminer_0.4.9 ggpubr_0.5.0.999
[25] ggplot2_3.4.0 SemiCompRisks_3.4 Formula_1.2-4 survival_3.4-0 MASS_7.3-58.1 foreign_0.8-84
[31] haven_2.5.1
loaded via a namespace (and not attached): [1] estimability_1.4.1 muhaz_1.2.6.4 coda_0.19-4 ragg_1.2.4 knitr_1.41 dygraphs_1.1.1.6
[7] multcomp_1.4-20 data.table_1.14.6 rpart_4.1.19 inline_0.3.19 generics_0.1.3 callr_3.7.3
[13] cowplot_1.1.1 TH.data_1.1-1 polspline_1.1.22 commonmark_1.8.1 proxy_0.4-27 tzdb_0.3.0
[19] xml2_1.3.3 httpuv_1.6.7 StanHeaders_2.21.0-7 assertthat_0.2.1 gargle_1.2.1 brms_2.18.0
[25] xfun_0.36 hms_1.1.2 ggdist_3.2.0 bayesplot_1.10.0 promises_1.2.0.1 fansi_1.0.3
[31] caTools_1.18.2 dbplyr_2.2.1 readxl_1.4.1 km.ci_0.5-6 igraph_1.3.5 DBI_1.1.3
[37] htmlwidgets_1.6.0 tensorA_0.36.2 googledrive_2.0.0 stats4_4.2.2 ellipsis_0.3.2 crosstalk_1.2.0
[43] backports_1.4.1 markdown_1.4 RcppParallel_5.1.5 deldir_1.0-6 vctrs_0.5.1 remotes_2.4.2
[49] quantreg_5.94 abind_1.4-5 tidybayes_3.0.2 cachem_1.0.6 withr_2.5.0 checkmate_2.1.0
[55] emmeans_1.8.3 xts_0.12.2 prettyunits_1.1.1 cluster_2.1.4 pacman_0.5.1 crayon_1.5.2
[61] pkgconfig_2.0.3 labeling_0.4.2 nlme_3.1-161 pkgload_1.3.2 nnet_7.3-18 rlang_1.0.6
[67] lifecycle_1.0.3 miniUI_0.1.1.1 colourpicker_1.2.0 MatrixModels_0.5-1 sandwich_3.0-2 modelr_0.1.10
[73] cellranger_1.1.0 distributional_0.3.1 randomForest_4.7-1.1 matrixStats_0.63.0 Matrix_1.5-3 loo_2.5.1
[79] KMsurv_0.1-5 carData_3.0-5 boot_1.3-28.1 zoo_1.8-11 reprex_2.0.2 base64enc_0.1-3
[85] processx_3.8.0 googlesheets4_1.0.1 png_0.1-8 mstate_0.3.2 rootSolve_1.8.2.3 bitops_1.0-7
[91] jpeg_0.1-10 shinystan_2.6.0 rstatix_0.7.1.999 ggsignif_0.6.4 scales_1.2.1 memoise_2.0.1
[97] magrittr_2.0.3 plyr_1.8.8 threejs_0.3.3 compiler_4.2.2 rstantools_2.2.0 RColorBrewer_1.1-3
[103] cli_3.5.0 urlchecker_1.0.1 ps_1.7.2 Brobdingnag_1.2-9 htmlTable_2.4.1 tidyselect_1.2.0
[109] stringi_1.7.8 textshaping_0.3.6 svUnit_1.0.6 latticeExtra_0.6-30 bridgesampling_1.1-2 survMisc_0.5.6
[115] grid_4.2.2 sass_0.4.4 tools_4.2.2 lmom_2.9 parallel_4.2.2 rstudioapi_0.14
[121] foreach_1.5.2 gridExtra_2.3 gld_2.6.6 posterior_1.3.1 farver_2.1.1 digest_0.6.31
[127] shiny_1.7.4 quadprog_1.5-8 Rcpp_1.0.9 car_3.1-1 broom_1.0.2 later_1.3.0
[133] httr_1.4.4 colorspace_2.0-3 rvest_1.0.3 fs_1.5.2 splines_4.2.2 statmod_1.4.37
[139] expm_0.999-6 Exact_3.2 shinythemes_1.2.0 sessioninfo_1.2.2 systemfonts_1.0.4 xtable_1.8-4
[145] jsonlite_1.8.4 rstan_2.21.7 R6_2.5.1 profvis_0.3.7 pillar_1.8.1 htmltools_0.5.4
[151] mime_0.12 glue_1.6.2 fastmap_1.1.0 DT_0.26 deSolve_1.34 class_7.3-20
[157] codetools_0.2-18 pkgbuild_1.4.0 mvtnorm_1.1-3 utf8_1.2.2 numDeriv_2016.8-1.1 arrayhelpers_1.1-0
[163] curl_4.3.3 gtools_3.9.4 shinyjs_2.1.0 interp_1.1-3 munsell_0.5.0 e1071_1.7-12
[169] iterators_1.0.14 broom.helpers_1.11.0 labelled_2.10.0 reshape2_1.4.4 gtable_0.3.1