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

lower_ci and upper_ci reversed in output of add_confint() #107

Closed
Aariq opened this issue Jun 10, 2021 · 2 comments
Closed

lower_ci and upper_ci reversed in output of add_confint() #107

Aariq opened this issue Jun 10, 2021 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@Aariq
Copy link

Aariq commented Jun 10, 2021

It looks like lower_ci is actually the upper confidence interval and upper_ci is actually lower.

library(gratia)
library(tidyverse)
load_mgcv()

dat <- gamSim(1, n = 400, dist = "normal", scale = 2)
#> Gu & Wahba 4 term additive model
m1 <- gam(y ~ s(x0) + s(x1) + s(x2) + s(x3), data = dat, method = "REML")

out1 <- confint(m1, parm = "s(x0)")
any(out1$lower < out1$upper)
#> [1] TRUE

out2 <- smooth_estimates(m1, smooth = "s(x0)") %>% add_confint()
any(out2$lower_ci < out2$upper_ci)
#> [1] FALSE

Created on 2021-06-10 by the reprex package (v2.0.0)

Session info
sessioninfo::session_info()
#> ─ Session info ───────────────────────────────────────────────────────────────
#>  setting  value                       
#>  version  R version 4.0.2 (2020-06-22)
#>  os       macOS  10.16                
#>  system   x86_64, darwin17.0          
#>  ui       X11                         
#>  language (EN)                        
#>  collate  en_US.UTF-8                 
#>  ctype    en_US.UTF-8                 
#>  tz       America/New_York            
#>  date     2021-06-10                  
#> 
#> ─ Packages ───────────────────────────────────────────────────────────────────
#>  ! package     * version    date       lib source                              
#>  P assertthat    0.2.1      2019-03-21 [?] CRAN (R 4.0.2)                      
#>  P backports     1.2.1      2020-12-09 [?] CRAN (R 4.0.2)                      
#>  P broom         0.7.6      2021-04-05 [?] CRAN (R 4.0.2)                      
#>  P cellranger    1.1.0      2016-07-27 [?] CRAN (R 4.0.2)                      
#>  P cli           2.5.0      2021-04-26 [?] CRAN (R 4.0.2)                      
#>  P colorspace    2.0-1      2021-05-04 [?] CRAN (R 4.0.2)                      
#>  P crayon        1.4.1      2021-02-08 [?] CRAN (R 4.0.2)                      
#>  P DBI           1.1.1      2021-01-15 [?] CRAN (R 4.0.2)                      
#>  P dbplyr        2.1.1      2021-04-06 [?] CRAN (R 4.0.2)                      
#>  P digest        0.6.27     2020-10-24 [?] CRAN (R 4.0.2)                      
#>  P dplyr       * 1.0.5      2021-03-05 [?] CRAN (R 4.0.2)                      
#>  P ellipsis      0.3.2      2021-04-29 [?] CRAN (R 4.0.2)                      
#>  P evaluate      0.14       2019-05-28 [?] CRAN (R 4.0.1)                      
#>  P fansi         0.4.2      2021-01-15 [?] CRAN (R 4.0.2)                      
#>  P forcats     * 0.5.1      2021-01-27 [?] CRAN (R 4.0.2)                      
#>  P fs            1.5.0      2020-07-31 [?] CRAN (R 4.0.2)                      
#>  P generics      0.1.0      2020-10-31 [?] CRAN (R 4.0.2)                      
#>  P ggplot2     * 3.3.3      2020-12-30 [?] CRAN (R 4.0.2)                      
#>  P glue          1.4.2      2020-08-27 [?] CRAN (R 4.0.2)                      
#>  P gratia      * 0.6.0.9111 2021-06-10 [?] Github (gavinsimpson/gratia@a810c45)
#>  P gtable        0.3.0      2019-03-25 [?] CRAN (R 4.0.2)                      
#>  P haven         2.4.1      2021-04-23 [?] CRAN (R 4.0.2)                      
#>  P highr         0.9        2021-04-16 [?] CRAN (R 4.0.2)                      
#>  P hms           1.0.0      2021-01-13 [?] CRAN (R 4.0.2)                      
#>  P htmltools     0.5.1.1    2021-01-22 [?] CRAN (R 4.0.2)                      
#>  P httr          1.4.2      2020-07-20 [?] CRAN (R 4.0.2)                      
#>  P jsonlite      1.7.2      2020-12-09 [?] CRAN (R 4.0.2)                      
#>  P knitr         1.33       2021-04-24 [?] CRAN (R 4.0.2)                      
#>  P lattice       0.20-44    2021-05-02 [?] CRAN (R 4.0.2)                      
#>  P lifecycle     1.0.0      2021-02-15 [?] CRAN (R 4.0.2)                      
#>  P lubridate     1.7.10     2021-02-26 [?] CRAN (R 4.0.2)                      
#>  P magrittr      2.0.1      2020-11-17 [?] CRAN (R 4.0.2)                      
#>  P Matrix        1.3-3      2021-05-04 [?] CRAN (R 4.0.2)                      
#>  P mgcv        * 1.8-35     2021-04-18 [?] CRAN (R 4.0.2)                      
#>  P modelr        0.1.8      2020-05-19 [?] CRAN (R 4.0.2)                      
#>  P munsell       0.5.0      2018-06-12 [?] CRAN (R 4.0.2)                      
#>  P mvnfast       0.2.5.1    2020-10-14 [?] CRAN (R 4.0.2)                      
#>  P nlme          3.1-152    2021-02-04 [?] CRAN (R 4.0.2)                      
#>  P patchwork     1.1.1      2020-12-17 [?] CRAN (R 4.0.2)                      
#>  P pillar        1.6.0      2021-04-13 [?] CRAN (R 4.0.2)                      
#>  P pkgconfig     2.0.3      2019-09-22 [?] CRAN (R 4.0.2)                      
#>  P purrr       * 0.3.4      2020-04-17 [?] CRAN (R 4.0.2)                      
#>  P R6            2.5.0      2020-10-28 [?] CRAN (R 4.0.2)                      
#>  P Rcpp          1.0.6      2021-01-15 [?] CRAN (R 4.0.2)                      
#>  P readr       * 1.4.0      2020-10-05 [?] CRAN (R 4.0.2)                      
#>  P readxl        1.3.1      2019-03-13 [?] CRAN (R 4.0.2)                      
#>  P reprex        2.0.0      2021-04-02 [?] CRAN (R 4.0.2)                      
#>  P rlang         0.4.11     2021-04-30 [?] CRAN (R 4.0.2)                      
#>  P rmarkdown     2.7        2021-02-19 [?] CRAN (R 4.0.2)                      
#>  P rstudioapi    0.13       2020-11-12 [?] CRAN (R 4.0.2)                      
#>  P rvest         1.0.0      2021-03-09 [?] CRAN (R 4.0.2)                      
#>  P scales        1.1.1      2020-05-11 [?] CRAN (R 4.0.2)                      
#>  P sessioninfo   1.1.1      2018-11-05 [?] CRAN (R 4.0.2)                      
#>  P stringi       1.5.3      2020-09-09 [?] CRAN (R 4.0.2)                      
#>  P stringr     * 1.4.0      2019-02-10 [?] CRAN (R 4.0.2)                      
#>    styler        1.4.1      2021-03-30 [3] CRAN (R 4.0.2)                      
#>  P tibble      * 3.1.1      2021-04-18 [?] CRAN (R 4.0.2)                      
#>  P tidyr       * 1.1.3      2021-03-03 [?] CRAN (R 4.0.2)                      
#>  P tidyselect    1.1.1      2021-04-30 [?] CRAN (R 4.0.2)                      
#>  P tidyverse   * 1.3.1      2021-04-15 [?] CRAN (R 4.0.2)                      
#>  P utf8          1.2.1      2021-03-12 [?] CRAN (R 4.0.2)                      
#>  P vctrs         0.3.8      2021-04-29 [?] CRAN (R 4.0.2)                      
#>  P withr         2.4.2      2021-04-18 [?] CRAN (R 4.0.2)                      
#>  P xfun          0.22       2021-03-11 [?] CRAN (R 4.0.2)                      
#>  P xml2          1.3.2      2020-04-23 [?] CRAN (R 4.0.2)                      
#>  P yaml          2.2.1      2020-02-01 [?] CRAN (R 4.0.2)                      
#> 
#> [1] /Users/scottericr/Documents/HeliconiaDemography/renv/library/R-4.0/x86_64-apple-darwin17.0
#> [2] /private/var/folders/b_/2vfnxxls5vs401tmhhb3wqdh0000gp/T/RtmpUcsSd4/renv-system-library
#> [3] /Library/Frameworks/R.framework/Versions/4.0/Resources/library
#> 
#>  P ── Loaded and on-disk path mismatch.
@gavinsimpson
Copy link
Owner

Yup; that's dumb of me... Will fix this ASAP

@gavinsimpson gavinsimpson self-assigned this Jun 10, 2021
@gavinsimpson gavinsimpson added the bug Something isn't working label Jun 10, 2021
gavinsimpson added a commit that referenced this issue Jun 10, 2021
@gavinsimpson
Copy link
Owner

Thanks for the report; this is fixed in 0.6.0.9112

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

2 participants