Reputation: 4200
Given some data points plotted in a graph by:
plot(<<a>|<b>>,style=point);
How do I do regression through the points? That is finding the best possible curve, straight line etc.
Upvotes: 0
Views: 518
Reputation: 7271
You could look at the help-pages for the CurveFitting package, or those of Statistics,Regression. (Note that the latter of those should appear by entering regression
in the Maple 16 Help browser's search box.)
a:=<1,2,3,4,5>:
b:=<2,5,10,17,26>:
P1:=plot(<a|b>,style=point,color=red):
C1:=Statistics:-Fit(s+t*x,a,b,x);
C2:=Statistics:-Fit(s+t*x+u*x^2,a,b,x);
plots:-display(
P1,
plot(C1, x=min(a)..max(a), color=green),
plot(C2, x=min(a)..max(a), color=blue)
);
Upvotes: 1