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

## 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: "java.io.IOException: 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.

`\$x1=180;\$x2=320;\$x3=200;\$x4=400;\$x5=350;\$x6=220;\$x7=450;\$x8=300;\$SR=maple(" with(Statistics): 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);");`
﻿