[Rd] Bug in rt() ? (PR#9422)

ripley at stats.ox.ac.uk ripley at stats.ox.ac.uk
Wed Dec 20 08:59:18 CET 2006


Why do you consider this might be a bug in R rather than in your 
expectations?  Your 'expected' is not what others have expected ....

In 2.4.1  rt(ncp) operates continuously as ncp is varied through 0.
That is different from saying that you want a central t (omitting ncp).

BTW, reports to R-bugs should *never* include a question mark: see the R 
FAQ.  A question on R-devel (or even R-help) would have been reasonable.

On Tue, 19 Dec 2006, goodrich at fas.harvard.edu wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> <<insert bug report here>>
> Reproduced on Debian and Windows ...
>
> On 2.4.x if you execute
>
> set.seed(12345)
> t.1 <- rt(n = 1000, df = 20)
>
> set.seed(12345)
> t.2 <- rt(n = 1000, df = 20, ncp = 0)
>
> all.equal(t.1, t.2) ## Not close to true
>
> This appears to be due to the fact that in 2.4.x rt is now
>
> rt
> function (n, df, ncp = 0)
> {
>    if (missing(ncp))
>                .Internal(rt(n, df))
>    else rnorm(n, ncp)/sqrt(rchisq(n, df)/df)
> }
> <environment: namespace:stats>
>
> Whereas in 2.3.1 rt() is verified to work as expected when someone
> (redundantly) types ncp = 0
>
> rt
> function (n, df, ncp = 0)
> {
>    if (ncp == 0)
>   .Internal(rt(n, df))
>    else rnorm(n, ncp)/(rchisq(n, df)/sqrt(df))
> }
> <environment: namespace:stats>
>
> The only interface difference is missing(ncp) vs. ncp == 0 .
>
> - --please do not edit the information below--
>
> Version:
> platform = i486-pc-linux-gnu
> arch = i486
> os = linux-gnu
> system = i486, linux-gnu
> status =
> major = 2
> minor = 4.1
> year = 2006
> month = 12
> day = 18
> svn rev = 40228
> language = R
> version.string = R version 2.4.1 (2006-12-18)
>
> Locale:
> LC_CTYPE=en_US.UTF-8;LC_NUMERIC=C;LC_TIME=en_US.UTF-8;LC_COLLATE=en_US.UTF-8;LC_MONETARY=en_US.UTF-8;LC_MESSAGES=en_US.UTF-8;LC_PAPER=en_US.UTF-8;LC_NAME=en_US.UTF-8;LC_ADDRESS=en_US.UTF-8;LC_TELEPHONE=en_US.UTF-8;LC_MEASUREMENT=en_US.UTF-8;LC_IDENTIFICATION=en_US.UTF-8
>
> Search Path:
> .GlobalEnv, package:car, package:rkward, package:stats,
> package:graphics, package:grDevices, package:utils, package:datasets,
> package:methods, Autoloads, package:base
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.6 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>
> iD8DBQFFiF09zQDSXIcN85kRAhK4AKCBmPNkGszTzFdALfiGgW1LfNIOTwCfZ8RM
> 0gZjer8+rnmOPDFKZXBbFQw=
> =ff85
> -----END PGP SIGNATURE-----
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



More information about the R-devel mailing list