Skip to content

tidy.drc does not calculate confidence intervals #798

Description

@nlubock

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  

Metadata

Metadata

Assignees

No one assigned

    Labels

    beginner-friendlybugan unexpected problem or unintended behavior

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions