* Data from Myers (1990) Classical and Modern Regression with Applications 10 measurements on spray paint efficiency were taken at each of 4 combinations of air velocity and voltage. The variance of the 10 measurements was estimated for each combination, as recorded below ; data wls ; input voltage velocity estvar ; varweight = 1/estvar ; do i = 1 to 10 ; input y @@ ; output ; end ; cards ; 50 60 1.8899 87.5 88.2 88.1 87.3 89.5 89.2 86.2 85.9 90.0 87.0 50 120 2.5018 82.5 81.3 81.6 80.7 77.4 79.3 81.5 82.0 79.7 79.2 70 60 54.3204 77.4 68.1 70.7 65.3 67.0 61.0 71.7 81.7 79.2 60.3 70 120 60.6933 61.2 50.7 67.2 52.3 55.9 68.6 52.0 69.5 63.5 70.1 run ; proc reg data = wls ; model y = voltage velocity ; weight varweight ; run ; proc iml ; use wls ; read all var {y} into y ; read all var {voltage} into xvolt ; read all var {velocity} into xvel ; read all var {varweight} into vary ; close wls ; x = j(nrow(y),1) || xvolt || xvel ; w = diag(vary) ; bhat = inv(x`*w*x)*x`*w*y ; mse = .98006 ; varwls = mse*inv(x`*w*x) ; stderr = sqrt(diag(varwls)) ; print bhat ; print varwls ; print stderr ; quit ;