PolymathPlus Report
📊   Multiple linear regression 2022-04-01 12:48 

# Example 14 - Simple multiple linear regression
# y = a0 + a1*x1 + a2*x2
# Verified Solution: a0 =360.836, a1 = -3.75246 a2=-0.084265

[
y x1 x2
293 1.61 851
230 15.5 820
172 22 1058
91 45 1201
125 33 1357
125 40 1115
]

# mlinfit <x1> <x2> <x3> [...] <y> [origin]
mlinfit x1 x2 y


y = a0 + a1x1 + a2x2

Variable Value 95% confidence
a0 360.83566 118.07555
a1 -3.7524613 1.7739996
a2 -0.08426503 0.14031331

R^2   R^2adj   Rmsd   Variance  
0.9835209    0.9725349    3.642287    159.1951   

Regression Plot

 100 150 200 250 300 50 100 150 200 250 300 y y=x Line y Calc



Residuals Plot

 -30 -20 -10 0 10 20 100 150 200 250 300 y Zero Line y - yCalc



Source data points and calculated data points

  x1 x2 y y calc Delta y
1 1.61 851 293 283.08465 9.9153492
2 15.5 820 230 233.57518 -3.575179
3 22 1058 172 189.1291 -17.129103
4 45 1201 91 90.772592 0.22740759
5 33 1357 125 122.65678 2.3432168
6 40 1115 125 116.78169 8.2183081

General

Number of independent variables = 2
Regression including a free parameter
Number of observations = 6