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

From: Prof Brian Ripley <ripley_at_stats.ox.ac.uk>
Date: Fri 10 Feb 2006 - 13:20:29 GMT

On Fri, 10 Feb 2006, marco.vezzoli@st.com wrote:

> Full_Name: Marco Vezzoli
> Version: 2.2.0 2.1.0 2.0.0
> OS: Solaris, Windows, Linux
> Submission from: (NULL) (57.78.11.38)
>
>
> The dnorm functions yield a wrong value when the standard deviation is near to
> 1e-1
> e.g.
>> dnorm(0,mean=0.04,sd=0.3)
> [1] 1.318039

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

> this error is consistent in various version and os.

It _is_ good that R is consistent.

I don't think we are going to believe you unless you give your credentials and state your `correct value' and your reasoning.

-- 
Brian D. Ripley,                  ripley@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

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

This archive was generated by hypermail 2.1.8 : Mon 20 Feb 2006 - 03:21:41 GMT