[R] Question about curve fitting...

Peter Dalgaard p.dalgaard at biostat.ku.dk
Wed Aug 10 17:01:43 CEST 2005


Dan Bolser <dmb at mrc-dunn.cam.ac.uk> writes:

> On Wed, 10 Aug 2005, S.O. Nyangoma wrote:
> 
> >I see that 
> >log(y)=log(k1)+k2*log(x)
> >use lm?
> 
> Thats a nice solution in this instance, but in general how do I get R to
> fit a particular function (formula) and return the parameters?

nls() is your friend.
 

-- 
   O__  ---- Peter Dalgaard             Øster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark          Ph:  (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)                  FAX: (+45) 35327907




More information about the R-help mailing list