Re: [R] fitting a gaussian to some x,y data

From: Michael Koppelman <>
Date: Sun 27 Aug 2006 - 05:51:54 EST

Success! The line I needed was:

gcoeffs <-nls(y~(a/b)*exp(-(x-c)^2/(2*b^2)),start=list (a=0.4,b=2,c=-10), trace=TRUE)

I also needed to provide good guesses for a, b and c. The attached PNG should explain what I was going after, which is the line in the center of that curve. I am sorry for my confusing and perhaps incorrect usage of terminology.

Michael mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code.
Received on Sun Aug 27 05:56:36 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Sun 27 Aug 2006 - 08:23:06 EST.

Mailing list information is available at Please read the posting guide before posting to the list.