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

Michael Koppelman michael at isis.spa.umn.edu
Sat Aug 26 21:51:54 CEST 2006


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.

Cheers,
Michael


-------------- next part --------------
A non-text attachment was scrubbed...
Name: example3.png
Type: image/png
Size: 21420 bytes
Desc: not available
Url : https://stat.ethz.ch/pipermail/r-help/attachments/20060826/b405c7dd/attachment.png 


More information about the R-help mailing list