From B.Rowlingson at lancaster.ac.uk  Fri Feb 10 14:33:09 2006
From: B.Rowlingson at lancaster.ac.uk (Barry Rowlingson)
Date: Fri, 10 Feb 2006 13:33:09 +0000
Subject: [Rd] Accuracy of dnorm (PR#8586)
In-Reply-To: <Pine.LNX.4.64.0602101313560.5396@gannet.stats.ox.ac.uk>
References: <20060210130147.808AE121AE@slim.kubism.ku.dk>
	<Pine.LNX.4.64.0602101313560.5396@gannet.stats.ox.ac.uk>
Message-ID: <43EC9615.8090905@lancaster.ac.uk>

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



[Rd] Accuracy of dnorm (PR#8586)
Barry Rowlingson