[R] Fit Gaussian curve on my data ?

Ivan Krylov kry|ov@r00t @end|ng |rom gm@||@com
Sat Apr 25 21:27:28 CEST 2020


On Sat, 25 Apr 2020 19:02:59 +0000 (UTC)
varin sacha via R-help <r-help using r-project.org> wrote:

> plot(function(d)
> k*exp(-0.5*(d-m)^2/sd^2),col=2,add=TRUE,xlim=range(d))

Remove the `add=TRUE` or calculate the values manually and you'll see
that the function value is zero because the values in `d` are too big
compared to `m` (where the function peak is). Compare your result to the
following:

plot(
	function(d) k*exp(-0.5*(d-m)^2/sd^2), 
	xlim = m + 3*sd * c(-1,+1)
)

Your parameters don't quite fit the observed values.

-- 
Best regards,
Ivan



More information about the R-help mailing list