Hi Milton,

Thanks for your help. Actually, I would like to fit a non-linear fashion. For 
some data like below, 'lm' may not work very well. Do you have idea? Thanks 
again!

Bill



0 1 
2 0.9 
5 0.5 
7 0.1 
10 0.01 




________________________________
From: milton ruser <milton.ru...@gmail.com>

Cc: R-help@r-project.org
Sent: Wednesday, September 9, 2009 12:01:52 PM
Subject: Re: [R] fitting nonlinear model


Hi Bill,
 
I am not sure what you want, but...
 
mydf<-read.table(stdin(), head=T, sep=",")
Np,year
96,2
91,5
89,7
85,10
 
plot(Np~year, data=mydf)
mymodel<-lm(Np~year, data=mydf)
abline(mymodel, col="red")
 
bests 
milton




My data look like:
>
>Np year
>96    2
>91    5
>89    7
>85   10
>
>
>
>
>----- Original Message ----

>To: r-help@r-project.org
>>Sent: Wednesday, September 9, 2009 11:23:26 AM
>Subject: [R] fitting nonlinear model
>
[[elided Yahoo spam]]
>
>______________________________________________
>R-help@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.
>
>______________________________________________
>R-help@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.
>



      
        [[alternative HTML version deleted]]

______________________________________________
R-help@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.

Reply via email to