Student Support Forum: 'Best Fit Line / Regression Line' topicStudent Support Forum > General > "Best Fit Line / Regression Line"

 Next Comment > Help | Reply To Topic
 Author Comment/Response Afshin Esmaeili 08/06/08 09:43am I have a set of non-linear data points and i want to plot the best fit line, but i have had no luck .... I did try google and the closest thing i got is this: Nonlinear Curve Fitting: If your data does not follow a straight line or simple polynomial, you will need to use Mathematica’s NonlinearFit functions: In[21]:= << Statistics‘NonlinearFit‘ Define the function and ask Mathematica to solve for a and b: In[24]:= chrgft = NonlinearFit[chargedata, a(1 - Exp[-x/b]), x, {a, b}] Out[24]= 4.83133 (1 - ã-0.00957528 x) The problem in my case is i don't know what function would best fit the data ... how do i do this ? Here is sample data which i have: (I have attached a notebook with sample data if that helps ) {{1/6, 1/6}, {1/3, 1/2}, {1/6, 1/6}, {1/2, 1/3}, {1/6, 1/3}, {1/3, 2/ 3}, {1/6, 1/3}, {2/3, 2/3}, {1/6, 0}, {1/3, 1/3}, {1/6, 0}, {1/2, 1/ 6}, {1/6, 1/6}, {1/3, 1/2}, {1/6, 1/6}, {5/6, 5/6}, {1/6, 1/6}, {1/ 3, 1/6}, {1/6, 1/6}, {1/2, 1/2}, {1/6, 1/3}, {1/3, 1/2}, {1/6, 1/ 3}, {2/3, 1/2}, {1/6, 0}, {1/3, 0}, {1/6, 0}, {1/2, 1/2}, {1/6, 1/ 6}, {1/3, 1/3}, {1/6, 1/6}, {1, 1/3}, {1/6, 1/6}, {1/3, 1/2}, {1/6, 1/6}, {1/2, 1/3}, {1/6, 0}, {1/3, 1/3}, {1/6, 0}, {2/3, 2/3}, {1/6, 1/3}, {1/3, 5/6}, {1/6, 1/3}, {1/2, 2/3}, {1/6, 1/6}, {1/3, 2/ 3}, {1/6, 1/6}, {5/6, 1/3}, {1/6, 1/6}, {1/3, 1/6}, {1/6, 1/6}, {1/ 2, 1/2}, {1/6, 0}, {1/3, 1/6}, {1/6, 0}, {2/3, 1/2}, {1/6, 1/3}, {1/ 3, 1/2}, {1/6, 1/3}, {1/2, 1}, {1/6, 1/6}, {1/3, 1/2}} Any help is greatly appreciated. Thank you in advanced. Attachment: SampleData.nb, URL: a.esmaeili@ucalgary.ca,

 Subject (listing for 'Best Fit Line / Regression Line') Author Date Posted Best Fit Line / Regression Line Afshin Esmae... 08/06/08 09:43am Re: Best Fit Line / Regression Line Forum Modera... 09/23/08 09:26am
 Next Comment > Help | Reply To Topic