[Rd] Accuracy of dnorm (PR#8586)

Barry Rowlingson B.Rowlingson at lancaster.ac.uk
Fri Feb 10 14:33:09 CET 2006


Prof Brian Ripley wrote:

>>The dnorm functions yield a wrong value when the standard deviation is near to
>>1e-1

> What is wrong here?  Try the textbook formula
> 
> 
>>x <- 0
>>m <- 0.04
>>sd <- 0.3
>>1/(sqrt(2*pi)*sd) * exp(-0.5*(x-m)^2/sd^2)
> 
> [1] 1.318039
> 

Even MS Excel gets this one right:

=NORMDIST(0,0.04,0.3,FALSE)

1.31803947

Barry



More information about the R-devel mailing list