Minor bug in dlnorm (PR#1781)

murdoch@stats.uwo.ca murdoch@stats.uwo.ca
Fri, 12 Jul 2002 21:43:43 +0200 (MET DST)


The density of a lognormal should be 0 for negative arguments, but

> dlnorm(-1)
[1] NaN
Warning message: 
NaNs produced in: dlnorm(x, meanlog, sdlog, log) 

A simple fix is to change dlnorm's definition to:

function (x, meanlog = 0, sdlog = 1, log = FALSE) 
.Internal(dlnorm(x*(x>0), meanlog, sdlog, log))

It might be faster to put the same sort of adjustment into the
internal code, but I couldn't spot where that lives.

Duncan Murdoch

--please do not edit the information below--

Version:
 platform = i386-pc-mingw32
 arch = i386
 os = mingw32
 system = i386, mingw32
 status = 
 major = 1
 minor = 5.1
 year = 2002
 month = 06
 day = 17
 language = R

Windows 98 4.10 (build 1998)  

Search Path:
 .GlobalEnv, package:affine, package:boot, package:ctest, Autoloads,
package:base

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._