Question: How to do simple linear regression in Maple T.A.?

I decided to convert an old LR question to Maple 15 syntax and update my Maple T.A. questions. I have it working in Maple, but in MTA I get an error: " Maple computation error", I've eliminated lines until I found out the error is when I use Fit to solve for the equation. What am I doing wrong?

Thanks, Stephen

I define 8 x values, and calculate 8 y values with random residuals. Then I solve using least squares.

X := Vector([$x1,$x2,$x3,$x4,$x5,$x6,$x7,$x8],datatype =float):
Rsdl := RandomVariable(Normal(2000, 1000));
Resid := Sample(Rsdl, 8);
Y := Vector([1, 1, 1, 1, 1, 1, 1, 1, 1], datatype = float);
for i to 8 do Y[i] := evalf[3](40*X[i]+Resid[i]) end do;
solution := Statistics:-Fit(b0+b1*x, X, Y, x, output = leastsquaresfunction);
Please Wait...