[R] best fit line

David Winsemius dwinsemius at comcast.net
Wed Mar 4 19:49:28 CET 2009


On Mar 4, 2009, at 1:22 PM, anujgoel wrote:

>
> Dear R Community,
> I am plotting this simple x-y plot (raw data & plot attached).
> I cant fit a linear regression line to it. I have to figure out what  
> is the
> best fit for this graph.

That is virtually impossible to define rigorously. The "best fit"  
would go through all the points precisely, the extreme form of  
overfitting, but the mathematical result would not be informative at  
all. Where did these data come from? What domain of science are you  
working on? You want a result that incorporates the relationships  
known to exist in your domain of investigation and summarizes the data  
without overfitting. I am being intentionally vague in what follows  
because this looks like homework.

> Is there a way to tell which regression to use for
> this kind of data?

Not really. Looks rather "hyperbolic", so you might think about the  
formula for hyperbola and then use the lm function.

>
> Also, after selecting the best fit model, I need to extrapolate what  
> could
> be the other possible data points.

The predict functions are used for this purpose. Consult you  
documentation.
?predict

-- 
David Winsemius

>
> I am new to R. Could anyone please help?
> Thanks.
> Anuj
> http://www.nabble.com/file/p22336095/plot.jpg
> -- 
> View this message in context: http://www.nabble.com/best-fit-line-tp22336095p22336095.html
> Sent from the R help mailing list archive at Nabble.com.
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> 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