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

2006-09-30 Thread H. Paul Benton
Michael, I'm also playing with the nls function trying to get it to work with a Gaussian. My lines that I have at the moment and I hope will help you are class(fo <- (x ~ (A/(sig*sqrt(2*pi)))* exp(-1*((bin-mu)^2/(2* sig^2) nls.AB <- nls(fo,data=freq.tab, start=

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

2006-08-26 Thread Michael Koppelman
Whoops, I forgot to add, many thanks to all who replied publicly and privately. I am very appreciative of all comments and suggestions. Mark Leeds was especially kind in terms of clarifying why my description of the situation was so confusing. Cheers, Michael On Aug 26, 2006, at 2:51 PM, Mi

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

2006-08-26 Thread Michael Koppelman
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

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

2006-08-25 Thread MARK LEEDS
7;t take my word in stone. someone else will likely reply. - Original Message - From: "Michael Koppelman" <[EMAIL PROTECTED]> To: Sent: Friday, August 25, 2006 3:35 PM Subject: Re: [R] fitting a gaussian to some x,y data > Thank you. Yes, I do feel that I am under-qualifie

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

2006-08-25 Thread Michael Koppelman
Thank you. Yes, I do feel that I am under-qualified to even ask questions of y'all. Plus I'm an astronomer, which doesn't help! ;) I'll try again. I have two columns of data, the first column (x) is a distance (or length or separation) and the second column (y) is a flux (or number of cou

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

2006-08-25 Thread Rolf Turner
Michael Koppelman wrote: > I apologize if this is redundant. I've been Googling, searching the > archive and reading the help all morning and I am not getting closer > to my goal. > > I have a series of data( xi, yi). It is not evenly sampled and it is > messy (meaning that there is a lot of scat

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

2006-08-25 Thread Michael Koppelman
I apologize if this is redundant. I've been Googling, searching the archive and reading the help all morning and I am not getting closer to my goal. I have a series of data( xi, yi). It is not evenly sampled and it is messy (meaning that there is a lot of scatter in the data). I want to fi