Linear Regression

Fits data to a line using the method of least squares. Outputs the coefficients for the line as well as the fit info.

Downloads:

Basic program (liberty basic) - linreg.bas

 

Test Case:

Linear Regression

number of known points? 11

x(1)=  71
y(1)=  160

x(2)=  73
y(2)=  183

x(3)=  64
y(3)=  154

x(4)=  65
y(4)=  168

x(5)=  61
y(5)=  159

x(6)=  70
y(6)=  180

x(7)=  65
y(7)=  145

x(8)=  72
y(8)=  210

x(9)=  63
y(9)=  132

x(10)= 67
y(10)= 168

x(11)= 64
y(11)= 141


f(x)=-106.791667+(4.04722222*x)

Coefficient of Determination (r^2)= 0.55626017
Coefficient of correlation (r^.5)= 0.74582851
Standard error of estimate (k/(n-2)^.5= 15.4134882

Interpolation (enter x=q to end program) x= 70
y= 176.513889

Interpolation (enter x=q to end program) x= 72
y= 184.608333

Interpolation (enter x=q to end program) x= q