Fuel, Temperature, Wind Example
MATLAB published form for the Fuel, Temperature, Wind Example
Contents
Definition of the data
fuel = [14.96 14.1 23.76 13.2 18.6 16.79 21.83 16.25 20.98 16.88] temp = [-3 -1.8 -10 .7 -5.1 -6.3 -15.5 -4.2 -8.8 -2.3] wind = [15.3 16.4 41.2 9.7 19.3 11.4 5.9 24.3 14.7 16.1]
fuel = 14.9600 14.1000 23.7600 13.2000 18.6000 16.7900 21.8300 16.2500 20.9800 16.8800 temp = -3.0000 -1.8000 -10.0000 0.7000 -5.1000 -6.3000 -15.5000 -4.2000 -8.8000 -2.3000 wind = 15.3000 16.4000 41.2000 9.7000 19.3000 11.4000 5.9000 24.3000 14.7000 16.1000
The design matrix
F=[ones(size(fuel))' temp' wind']
F =
1.0000 -3.0000 15.3000
1.0000 -1.8000 16.4000
1.0000 -10.0000 41.2000
1.0000 0.7000 9.7000
1.0000 -5.1000 19.3000
1.0000 -6.3000 11.4000
1.0000 -15.5000 5.9000
1.0000 -4.2000 24.3000
1.0000 -8.8000 14.7000
1.0000 -2.3000 16.1000
Computation of regression coefficients with MATLAB syntax
pmat=F\fuel'
pmat =
11.9339
-0.6285
0.1298
Computation of regression coefficients directly
p = (F'*F)\(F'*fuel')
p =
11.9339
-0.6285
0.1298
Sum square error
error = norm(fuel'-F*p,2)^2
error = 10.5328