Stephen Berman
2022-Jun-13 21:47 UTC
[R] Why does qt() return Inf with certain negative ncp values?
Can anyone explain why Inf appears in the following results?> sapply(-1:-10, \(ncp) qt(1-1*(10^(-4+ncp)), 35, ncp))[1] 3.6527153 3.0627759 2.4158355 1.7380812 1.0506904 0.3700821 [7] Inf -0.9279783 -1.5341759 -2.1085213> sapply(seq(-6.9, -7.9, -0.1), \(ncp) qt(1-1*(10^(-4+ncp)), 35, ncp))[1] -0.2268386 Inf Inf Inf -0.4857400 -0.5497784 [7] -0.6135402 -0.6770143 -0.7401974 -0.8030853 -0.8656810 In case it matters:> sessionInfo()R Under development (unstable) (2022-06-05 r82452) Platform: x86_64-pc-linux-gnu (64-bit) Running under: Linux From Scratch r11.0-165 Matrix products: default BLAS: /usr/lib/R/lib/libRblas.so LAPACK: /usr/lib/R/lib/libRlapack.so locale: [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C [3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8 [5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 [7] LC_PAPER=en_US.UTF-8 LC_NAME=C [9] LC_ADDRESS=C LC_TELEPHONE=C [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C attached base packages: [1] stats graphics grDevices utils datasets methods base loaded via a namespace (and not attached): [1] compiler_4.3.0 tools_4.3.0 Thanks. Steve Berman
Bert Gunter
2022-Jun-14 02:28 UTC
[R] Why does qt() return Inf with certain negative ncp values?
Well, this will likely require close numerical analysis of the algorithm used for the calculation, which I can't help with, but I do note for the first case (I didn't bother checking the second) it may be useful to note that besides returning Inf, I also got with -7 as ncp: "There were 50 or more warnings" all of which were: "In qt(1 - 1 * (10^(-11)), 35, -7) : full precision may not have been achieved in 'pnt{final}' " I got this warning for all the other values of ncp also. So it looks like: Congratulations, you seem to have defeated the algorithm. Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) On Mon, Jun 13, 2022 at 6:14 PM Stephen Berman <stephen.berman at gmx.net> wrote:> Can anyone explain why Inf appears in the following results? > > > sapply(-1:-10, \(ncp) qt(1-1*(10^(-4+ncp)), 35, ncp)) > [1] 3.6527153 3.0627759 2.4158355 1.7380812 1.0506904 0.3700821 > [7] Inf -0.9279783 -1.5341759 -2.1085213 > > > sapply(seq(-6.9, -7.9, -0.1), \(ncp) qt(1-1*(10^(-4+ncp)), 35, ncp)) > [1] -0.2268386 Inf Inf Inf -0.4857400 -0.5497784 > [7] -0.6135402 -0.6770143 -0.7401974 -0.8030853 -0.8656810 > > In case it matters: > > > sessionInfo() > R Under development (unstable) (2022-06-05 r82452) > Platform: x86_64-pc-linux-gnu (64-bit) > Running under: Linux From Scratch r11.0-165 > > Matrix products: default > BLAS: /usr/lib/R/lib/libRblas.so > LAPACK: /usr/lib/R/lib/libRlapack.so > > locale: > [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C > [3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8 > [5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 > [7] LC_PAPER=en_US.UTF-8 LC_NAME=C > [9] LC_ADDRESS=C LC_TELEPHONE=C > [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C > > attached base packages: > [1] stats graphics grDevices utils datasets methods base > > loaded via a namespace (and not attached): > [1] compiler_4.3.0 tools_4.3.0 > > Thanks. > Steve Berman > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >[[alternative HTML version deleted]]