Open dbarneche opened 2 years ago
Is this potentially a bug or is it intended behaviour?
I noticed that the spinach.model1 example in ?predict.drc returns a matrix with the credible intervals
spinach.model1
?predict.drc
> library(drc) > spinach_model1_ll4 <- drm(SLOPE~DOSE, CURVE, data = spinach, fct = LL.4()) > predict(spinach_model1_ll4, data.frame(dose=2, CURVE=c("1", "2", "3")), interval = "confidence") Prediction Lower Upper [1,] 0.9048476 0.8552178 0.9544775 [2,] 0.4208307 0.3626741 0.4789873 [3,] 0.5581673 0.4971838 0.6191509 Warning messages: 1: In (tquan * sqrt(varVal + sumObjRV)) * c(-1, 1) : Recycling array of length 1 in array-vector arithmetic is deprecated. Use c() or as.vector() instead. 2: In (tquan * sqrt(varVal + sumObjRV)) * c(-1, 1) : Recycling array of length 1 in array-vector arithmetic is deprecated. Use c() or as.vector() instead. 3: In (tquan * sqrt(varVal + sumObjRV)) * c(-1, 1) : Recycling array of length 1 in array-vector arithmetic is deprecated. Use c() or as.vector() instead.
But as soon as I use NEC.3() for the model, it only returns what I think is the mean?
NEC.3()
> spinach_model1_nec3 <- drm(SLOPE~DOSE, CURVE, data = spinach, fct = NEC.3()) > predict(spinach_model1_nec3) [1] 1.534025e+00 1.534025e+00 1.534025e+00 1.396653e+00 1.396653e+00 [6] 1.396653e+00 1.159464e+00 1.159464e+00 1.159464e+00 6.613781e-01 [11] 6.613781e-01 6.613781e-01 1.231237e-01 1.231237e-01 1.231237e-01 [16] 7.943600e-04 7.943600e-04 7.943600e-04 2.130037e-10 2.130037e-10 [21] 2.130037e-10 8.254612e-01 8.254612e-01 8.254612e-01 7.073317e-01 [26] 7.073317e-01 7.073317e-01 5.206644e-01 5.206644e-01 5.206644e-01 [31] 2.066325e-01 2.066325e-01 2.066325e-01 1.298029e-02 1.298029e-02 [36] 1.298029e-02 3.217671e-06 3.217671e-06 3.217671e-06 4.889130e-17 [41] 4.889130e-17 4.889130e-17 9.281359e-01 9.281359e-01 9.281359e-01 [46] 9.088835e-01 9.088835e-01 9.088835e-01 8.546830e-01 8.546830e-01 [51] 8.546830e-01 6.692668e-01 6.692668e-01 6.692668e-01 2.502354e-01 [56] 2.502354e-01 2.502354e-01 4.917835e-03 4.917835e-03 4.917835e-03 [61] 7.315787e-10 7.315787e-10 7.315787e-10 2.124491e+00 2.124491e+00 [66] 2.124491e+00 2.124491e+00 2.124491e+00 2.124491e+00 2.124491e+00 [71] 2.124491e+00 2.124491e+00 1.703807e+00 1.703807e+00 1.703807e+00 [76] 7.583491e-01 7.583491e-01 7.583491e-01 4.461082e-02 4.461082e-02 [81] 4.461082e-02 1.361222e-05 1.361222e-05 1.361222e-05 1.773046e+00 [86] 1.773046e+00 1.773046e+00 1.773046e+00 1.773046e+00 1.773046e+00 [91] 1.773046e+00 1.773046e+00 1.773046e+00 1.413257e+00 1.413257e+00 [96] 1.413257e+00 6.522470e-01 6.522470e-01 6.522470e-01 4.355921e-02 [101] 4.355921e-02 4.355921e-02 1.909801e-05 1.909801e-05 1.909801e-05 Warning message: In sqrt(diag(varMat)) : NaNs produced
My specs are:
> sessionInfo() R version 4.1.1 (2021-08-10) Platform: x86_64-apple-darwin17.0 (64-bit) Running under: macOS Catalina 10.15.7 Matrix products: default BLAS: /Library/Frameworks/R.framework/Versions/4.1/Resources/lib/libRblas.0.dylib LAPACK: /Library/Frameworks/R.framework/Versions/4.1/Resources/lib/libRlapack.dylib locale: [1] en_AU.UTF-8/en_AU.UTF-8/en_AU.UTF-8/C/en_AU.UTF-8/en_AU.UTF-8 attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] drc_3.0-1 MASS_7.3-54 loaded via a namespace (and not attached): [1] zip_2.1.1 Rcpp_1.0.7 cellranger_1.1.0 pillar_1.6.2 [5] compiler_4.1.1 forcats_0.5.1 tools_4.1.1 lifecycle_1.0.0 [9] tibble_3.1.4 lattice_0.20-44 pkgconfig_2.0.3 rlang_0.4.11 [13] Matrix_1.3-4 openxlsx_4.2.3 curl_4.3.2 mvtnorm_1.1-2 [17] haven_2.4.3 rio_0.5.26 vctrs_0.3.8 gtools_3.9.2 [21] hms_1.1.0 grid_4.1.1 data.table_1.14.0 R6_2.5.1 [25] plotrix_3.8-2 fansi_0.5.0 readxl_1.3.1 survival_3.2-11 [29] foreign_0.8-81 multcomp_1.4-17 TH.data_1.0-10 carData_3.0-4 [33] car_3.0-10 magrittr_2.0.1 scales_1.1.1 codetools_0.2-18 [37] ellipsis_0.3.2 splines_4.1.1 abind_1.4-5 colorspace_2.0-2 [41] sandwich_3.0-1 utf8_1.2.2 stringi_1.7.4 munsell_0.5.0 [45] crayon_1.4.1 zoo_1.8-9
Is this potentially a bug or is it intended behaviour?
I noticed that the
spinach.model1
example in?predict.drc
returns a matrix with the credible intervalsBut as soon as I use
NEC.3()
for the model, it only returns what I think is the mean?My specs are: