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

tidy.drc does not calculate confidence intervals #798

Closed
nlubock opened this issue Dec 7, 2019 · 5 comments
Closed

tidy.drc does not calculate confidence intervals #798

nlubock opened this issue Dec 7, 2019 · 5 comments
Labels
beginner-friendly bug an unexpected problem or unintended behavior

Comments

@nlubock
Copy link

nlubock commented Dec 7, 2019

The tidy.drc function returns NA's for the confidence interval estimates.

Attempting the example from the documentation:

library(drc)
library(broom)
library(tidyverse)

mod <- drm(dead/total~conc, type, 
           weights = total, data = selenium, fct = LL.2(), type = "binomial")

tidy(mod)

# A tibble: 8 x 6
  term  curve estimate std.error statistic  p.value
  <chr> <chr>    <dbl>     <dbl>     <dbl>    <dbl>
1 b     1       -1.50      0.155     -9.67 2.01e-22
2 b     2       -0.843     0.139     -6.06 1.35e- 9
3 b     3       -2.16      0.138    -15.7  1.65e-55
4 b     4       -1.45      0.169     -8.62 3.41e-18
5 e     1      252.       13.8       18.2  1.16e-74
6 e     2      378.       39.4        9.61 3.53e-22
7 e     3      120.        5.91      20.3  1.14e-91
8 e     4       88.8       8.62      10.3  3.28e-25

tidy(mod, conf.int = TRUE)

# A tibble: 8 x 8
  term  curve estimate std.error statistic  p.value conf.low conf.high
  <chr> <chr>    <dbl>     <dbl>     <dbl>    <dbl>    <dbl>     <dbl>
1 b     1       -1.50      0.155     -9.67 2.01e-22       NA        NA
2 b     2       -0.843     0.139     -6.06 1.35e- 9       NA        NA
3 b     3       -2.16      0.138    -15.7  1.65e-55       NA        NA
4 b     4       -1.45      0.169     -8.62 3.41e-18       NA        NA
5 e     1      252.       13.8       18.2  1.16e-74       NA        NA
6 e     2      378.       39.4        9.61 3.53e-22       NA        NA
7 e     3      120.        5.91      20.3  1.14e-91       NA        NA
8 e     4       88.8       8.62      10.3  3.28e-25       NA        NA

Relevant session info:

R version 3.6.0 (2019-04-26)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Debian GNU/Linux 9 (stretch)

Matrix products: default
BLAS/LAPACK: /usr/lib/libopenblasp-r0.2.19.so

locale:
 [1] LC_CTYPE=C.UTF-8       LC_NUMERIC=C           LC_TIME=C.UTF-8        LC_COLLATE=C.UTF-8     LC_MONETARY=C.UTF-8   
 [6] LC_MESSAGES=C          LC_PAPER=C.UTF-8       LC_NAME=C              LC_ADDRESS=C           LC_TELEPHONE=C        
[11] LC_MEASUREMENT=C.UTF-8 LC_IDENTIFICATION=C   

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

other attached packages:
 [1] forcats_0.4.0    stringr_1.4.0    dplyr_0.8.3      purrr_0.3.2      readr_1.3.1      tidyr_0.8.3     
 [7] tibble_2.1.3     ggplot2_3.2.0    tidyverse_1.2.1  broom_0.5.2.9002 drc_3.0-1        MASS_7.3-51.4   

loaded via a namespace (and not attached):
 [1] httr_1.4.0        jsonlite_1.6      splines_3.6.0     carData_3.0-2     modelr_0.1.4      gtools_3.8.1     
 [7] assertthat_0.2.1  cellranger_1.1.0  pillar_1.4.2      backports_1.1.4   lattice_0.20-38   glue_1.3.1       
[13] digest_0.6.20     rvest_0.3.4       colorspace_1.4-1  sandwich_2.5-1    htmltools_0.3.6   Matrix_1.2-17    
[19] clipr_0.6.0       pkgconfig_2.0.2   haven_2.1.1       mvtnorm_1.0-11    scales_1.0.0      processx_3.4.0   
[25] whisker_0.3-2     openxlsx_4.1.0.1  rio_0.5.16        generics_0.0.2    car_3.0-3         ellipsis_0.2.0.1 
[31] withr_2.1.2       TH.data_1.0-10    lazyeval_0.2.2    cli_1.1.0         survival_2.44-1.1 magrittr_1.5     
[37] crayon_1.3.4      readxl_1.3.1      evaluate_0.14     ps_1.3.0          fansi_0.4.0       fs_1.3.1         
[43] xml2_1.2.0        foreign_0.8-71    tools_3.6.0       data.table_1.12.2 hms_0.4.2         multcomp_1.4-10  
[49] munsell_0.5.0     reprex_0.3.0      plotrix_3.7-6     zip_2.0.3         callr_3.3.0       compiler_3.6.0   
[55] rlang_0.4.0       grid_3.6.0        rstudioapi_0.10   rmarkdown_1.13    gtable_0.3.0      codetools_0.2-16 
[61] abind_1.4-5       curl_3.3          R6_2.4.0          zoo_1.8-6         lubridate_1.7.4   knitr_1.23       
[67] zeallot_0.1.0     utf8_1.1.4        stringi_1.4.3     Rcpp_1.0.1        vctrs_0.1.0       tidyselect_0.2.5 
[73] xfun_0.8  
@raerickson
Copy link

raerickson commented Dec 10, 2019

I can recreate the the same error with R 3.6.1 running on macOS:

R version 3.6.1 (2019-07-05)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS High Sierra 10.13.6

@alexpghayes
Copy link
Collaborator

alexpghayes commented Dec 13, 2019

How do you get confidence intervals for these objects normally?

@alexpghayes alexpghayes added beginner-friendly bug an unexpected problem or unintended behavior labels Dec 13, 2019
@raerickson
Copy link

raerickson commented Dec 13, 2019

@IndrajeetPatil
Copy link
Contributor

IndrajeetPatil commented Dec 14, 2019

library(drc)
#> Loading required package: MASS
#> 
#> 'drc' has been loaded.
#> Please cite R and 'drc' if used for a publication,
#> for references type 'citation()' and 'citation('drc')'.
#> 
#> Attaching package: 'drc'
#> The following objects are masked from 'package:stats':
#> 
#>     gaussian, getInitial
library(broom)
library(tidyverse)

mod <- drm(dead/total~conc, type, 
           weights = total, data = selenium, fct = LL.2(), type = "binomial")

confint(mod)
#>          2.5 %      97.5 %
#> b:1  -1.808258  -1.1988105
#> b:2  -1.115883  -0.5705842
#> b:3  -2.434489  -1.8925927
#> b:4  -1.783488  -1.1225642
#> e:1 225.155474 279.3556331
#> e:2 301.295321 455.6256335
#> e:3 108.138906 131.2875017
#> e:4  71.917971 105.6926148

Created on 2019-12-14 by the reprex package (v0.3.0)

Session info
devtools::session_info()
#> - Session info ---------------------------------------------------------------
#>  setting  value                       
#>  version  R version 3.6.1 (2019-07-05)
#>  os       Windows 10 x64              
#>  system   x86_64, mingw32             
#>  ui       RTerm                       
#>  language (EN)                        
#>  collate  English_United States.1252  
#>  ctype    English_United States.1252  
#>  tz       Europe/Berlin               
#>  date     2019-12-14                  
#> 
#> - Packages -------------------------------------------------------------------
#>  package     * version    date       lib source                          
#>  abind         1.4-5      2016-07-21 [1] CRAN (R 3.5.0)                  
#>  assertthat    0.2.1      2019-03-21 [1] CRAN (R 3.6.0)                  
#>  backports     1.1.5      2019-10-02 [1] CRAN (R 3.6.1)                  
#>  broom       * 0.5.2.9003 2019-12-14 [1] local                           
#>  callr         3.4.0      2019-12-09 [1] CRAN (R 3.6.1)                  
#>  car           3.0-5      2019-11-15 [1] CRAN (R 3.6.1)                  
#>  carData       3.0-3      2019-11-16 [1] CRAN (R 3.6.1)                  
#>  cellranger    1.1.0      2016-07-27 [1] CRAN (R 3.5.1)                  
#>  cli           2.0.0.9000 2019-12-12 [1] Github (r-lib/cli@ac2c18b)      
#>  codetools     0.2-16     2018-12-24 [1] CRAN (R 3.5.2)                  
#>  colorspace    1.4-1      2019-03-18 [1] CRAN (R 3.6.0)                  
#>  crayon        1.3.4      2017-09-16 [1] CRAN (R 3.5.1)                  
#>  curl          4.3        2019-12-02 [1] CRAN (R 3.6.1)                  
#>  data.table    1.12.8     2019-12-09 [1] CRAN (R 3.6.1)                  
#>  DBI           1.0.0      2018-05-02 [1] CRAN (R 3.5.1)                  
#>  dbplyr        1.4.2      2019-06-17 [1] CRAN (R 3.6.0)                  
#>  desc          1.2.0      2019-11-11 [1] Github (r-lib/desc@61205f6)     
#>  devtools      2.2.1      2019-09-24 [1] CRAN (R 3.6.1)                  
#>  digest        0.6.23     2019-11-23 [1] CRAN (R 3.6.1)                  
#>  dplyr       * 0.8.3.9000 2019-10-10 [1] Github (tidyverse/dplyr@dcfc1d1)
#>  drc         * 3.0-1      2016-08-30 [1] CRAN (R 3.5.2)                  
#>  ellipsis      0.3.0      2019-09-20 [1] CRAN (R 3.6.1)                  
#>  evaluate      0.14       2019-05-28 [1] CRAN (R 3.6.0)                  
#>  fansi         0.4.0      2018-11-05 [1] Github (brodieG/fansi@ab11e9c)  
#>  forcats     * 0.4.0      2019-02-17 [1] CRAN (R 3.5.2)                  
#>  foreign       0.8-71     2018-07-20 [2] CRAN (R 3.6.1)                  
#>  fs            1.3.1      2019-05-06 [1] CRAN (R 3.6.0)                  
#>  generics      0.0.2      2019-03-05 [1] Github (r-lib/generics@c15ac43) 
#>  ggplot2     * 3.2.1      2019-08-10 [1] CRAN (R 3.6.1)                  
#>  glue          1.3.1      2019-03-12 [1] CRAN (R 3.6.0)                  
#>  gtable        0.3.0      2019-03-25 [1] CRAN (R 3.6.0)                  
#>  gtools        3.8.1      2018-06-26 [1] CRAN (R 3.5.0)                  
#>  haven         2.2.0      2019-11-08 [1] CRAN (R 3.6.1)                  
#>  highr         0.8        2019-03-20 [1] CRAN (R 3.6.0)                  
#>  hms           0.5.2      2019-10-30 [1] CRAN (R 3.6.1)                  
#>  htmltools     0.4.0      2019-10-04 [1] CRAN (R 3.6.1)                  
#>  httr          1.4.1      2019-08-05 [1] CRAN (R 3.6.1)                  
#>  jsonlite      1.6        2018-12-07 [1] CRAN (R 3.6.0)                  
#>  knitr         1.26       2019-11-12 [1] CRAN (R 3.6.1)                  
#>  lattice       0.20-38    2018-11-04 [2] CRAN (R 3.6.1)                  
#>  lazyeval      0.2.2      2019-03-15 [1] CRAN (R 3.6.0)                  
#>  lifecycle     0.1.0      2019-08-01 [1] CRAN (R 3.6.1)                  
#>  lubridate     1.7.4      2018-04-11 [1] CRAN (R 3.5.1)                  
#>  magrittr      1.5        2014-11-22 [1] CRAN (R 3.5.1)                  
#>  MASS        * 7.3-51.4   2019-03-31 [1] CRAN (R 3.6.0)                  
#>  Matrix        1.2-18     2019-11-27 [1] CRAN (R 3.6.1)                  
#>  memoise       1.1.0      2017-04-21 [1] CRAN (R 3.6.0)                  
#>  modelr        0.1.5      2019-08-08 [1] CRAN (R 3.6.1)                  
#>  multcomp      1.4-11     2019-12-10 [1] CRAN (R 3.6.1)                  
#>  munsell       0.5.0      2018-06-12 [1] CRAN (R 3.5.1)                  
#>  mvtnorm       1.0-11     2019-06-19 [1] CRAN (R 3.6.0)                  
#>  openxlsx      4.1.4      2019-12-06 [1] CRAN (R 3.6.1)                  
#>  pillar        1.4.2.9001 2019-12-10 [1] Github (r-lib/pillar@82370d7)   
#>  pkgbuild      1.0.6      2019-10-09 [1] CRAN (R 3.6.1)                  
#>  pkgconfig     2.0.3      2019-09-22 [1] CRAN (R 3.6.1)                  
#>  pkgload       1.0.2      2018-10-29 [1] CRAN (R 3.6.0)                  
#>  plotrix       3.7-7      2019-12-05 [1] CRAN (R 3.6.1)                  
#>  prettyunits   1.0.2      2015-07-13 [1] CRAN (R 3.5.1)                  
#>  processx      3.4.1      2019-07-18 [1] CRAN (R 3.6.1)                  
#>  ps            1.3.0      2018-12-21 [1] CRAN (R 3.6.0)                  
#>  purrr       * 0.3.3      2019-10-18 [1] CRAN (R 3.6.1)                  
#>  R6            2.4.1      2019-11-12 [1] CRAN (R 3.6.1)                  
#>  Rcpp          1.0.3      2019-11-08 [1] CRAN (R 3.6.1)                  
#>  readr       * 1.3.1      2018-12-21 [1] CRAN (R 3.6.0)                  
#>  readxl        1.3.1      2019-03-13 [1] CRAN (R 3.6.0)                  
#>  remotes       2.1.0      2019-06-24 [1] CRAN (R 3.6.0)                  
#>  reprex        0.3.0      2019-05-16 [1] CRAN (R 3.6.0)                  
#>  rio           0.5.16     2018-11-26 [1] CRAN (R 3.6.0)                  
#>  rlang         0.4.2      2019-11-23 [1] CRAN (R 3.6.1)                  
#>  rmarkdown     2.0        2019-12-12 [1] CRAN (R 3.6.1)                  
#>  rprojroot     1.3-2      2018-01-03 [1] CRAN (R 3.5.1)                  
#>  rvest         0.3.5      2019-11-08 [1] CRAN (R 3.6.1)                  
#>  sandwich      2.5-1      2019-04-06 [1] CRAN (R 3.6.0)                  
#>  scales        1.1.0      2019-11-18 [1] CRAN (R 3.6.1)                  
#>  sessioninfo   1.1.1      2018-11-05 [1] CRAN (R 3.6.0)                  
#>  stringi       1.4.3      2019-03-12 [1] CRAN (R 3.6.0)                  
#>  stringr     * 1.4.0      2019-02-10 [1] CRAN (R 3.6.0)                  
#>  survival      3.1-8      2019-12-03 [1] CRAN (R 3.6.1)                  
#>  testthat      2.3.1      2019-12-01 [1] CRAN (R 3.6.1)                  
#>  TH.data       1.0-10     2019-01-21 [1] CRAN (R 3.5.2)                  
#>  tibble      * 2.1.3      2019-06-06 [1] CRAN (R 3.6.1)                  
#>  tidyr       * 1.0.0      2019-09-11 [1] CRAN (R 3.6.1)                  
#>  tidyselect    0.2.5      2018-10-11 [1] CRAN (R 3.5.1)                  
#>  tidyverse   * 1.3.0      2019-11-21 [1] CRAN (R 3.6.1)                  
#>  usethis       1.5.1.9000 2019-12-12 [1] Github (r-lib/usethis@23dd62c)  
#>  vctrs         0.2.0.9007 2019-12-10 [1] Github (r-lib/vctrs@3bca8ae)    
#>  withr         2.1.2      2018-03-15 [1] CRAN (R 3.5.1)                  
#>  xfun          0.11       2019-11-12 [1] CRAN (R 3.6.1)                  
#>  xml2          1.2.2      2019-08-09 [1] CRAN (R 3.6.1)                  
#>  yaml          2.2.0      2018-07-25 [1] CRAN (R 3.5.1)                  
#>  zip           2.0.4      2019-09-01 [1] CRAN (R 3.6.1)                  
#>  zoo           1.8-6      2019-05-28 [1] CRAN (R 3.6.0)                  
#> 
#> [1] C:/Users/inp099/Documents/R/win-library/3.6
#> [2] C:/Program Files/R/R-3.6.1/library

@github-actions
Copy link

github-actions bot commented Mar 9, 2021

This issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with a reprex: https://reprex.tidyverse.org) and link to this issue.

@github-actions github-actions bot locked and limited conversation to collaborators Mar 9, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
beginner-friendly bug an unexpected problem or unintended behavior
Projects
None yet
Development

No branches or pull requests

4 participants