Question: Best fit line through data anchored at one point

I couldn't find an option to find a best fit line passing through a specified point in your data.  How do you do that?

I would like the best fit line to pass through [2,21]

restart

pts := [[0, 0], [1, 13], [2, 21], [6, 45], [12, 54], [15, 77]]

plot(pts)

 

pts1 := Vector([0, 1, 2, 6, 12, 15])

pts2 := Vector([0, 13, 21, 45, 54, 77])

with(Statistics)

L := LinearFit(b*x+a, pts1, pts2, x)

HFloat(8.154639175257726)+HFloat(4.474226804123712)*x

(1)

plot({L, pts})

 

``


 

Download test.mw

Please Wait...