Re: [Rd] Accuracy of dnorm (PR#8586)

From: Barry Rowlingson <B.Rowlingson_at_lancaster.ac.uk>
Date: Fri 10 Feb 2006 - 13:33:09 GMT

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



R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Sat Feb 11 00:39:07 2006

This archive was generated by hypermail 2.1.8 : Mon 13 Feb 2006 - 14:59:18 GMT