[R] Fitting a function

Thomas Levine thomas.levine at gmail.com
Fri May 14 15:07:20 CEST 2010


Actually, ignore my comment about that link. I don't think that link
is what you want to look at either.

y~x^2 fits quite well, but you could also write a loop to run lm() on
a bunch of different transformations.

foo=list(log,sqrt)
for (bar in foo) {
	plot(bar(x),y)
}

There may be a function that does this already, but I couldn't find it either.

Sorry for sending so many emails

2010/5/14 Thomas Levine <thomas.levine at gmail.com>:
> I spoke too soon; that is not linear.
>
> I've never used the model-fitting functions, but you may check them out.
> http://developer.r-project.org/model-fitting-functions.txt
>
> Tom
>
> 2010/5/14 Thomas Levine <thomas.levine at gmail.com>:
>> x<-c(0.5,4,6,8,12)
>> y<-c(0.021,0.021,0.020,0.018,0.012)
>> lm(y~x)
>>
>> 2010/5/14 Dani Valverde <daniel.valverde at uab.cat>:
>>> Hello,
>>> It is a very naive question, but here it is. I have this values:
>>>
>>> x: 0.5 4 6 8 12
>>>
>>> y: 0.021 0.021 0.020 0.018 0.012
>>>
>>> I need to fit a function to them. How can I do it with R?
>>> Thank you so much!
>>>
>>> Dani
>>>
>>> --
>>> Daniel Valverde Saubí
>>>
>>> Grup de Biologia Molecular de Llevats
>>> Facultat de Veterinària de la Universitat Autònoma de Barcelona
>>> Edifici V, Campus UAB
>>> 08193 Cerdanyola del Vallès- SPAIN
>>>
>>> Tlf. +34 93 581 1910
>>> Fax: +34 93 581 1573
>>>
>>> ______________________________________________
>>> R-help at r-project.org mailing list
>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>>> and provide commented, minimal, self-contained, reproducible code.
>>>
>>
>



More information about the R-help mailing list