추가
data Q;
x0 = 1;
input x1 x2 y;
cards;
0.871.690 12.10
0.202 1.170 5.50
0.2031.170 4.60
0.198 1.210 4.50
0.7301.630 10.80
0.510 1.590 4.90
0.2051.140 6.00
0.6701.920 4.20
0.2051.220 5.30
0.271 1.710 6.70
0.2031.160 4.00
0.2641.370 6.10
;
proc print;
run;
proc reg data = Q;
model y = x1 x2 / clb;
run; quit;
/* MSE = 3.49043 */
proc iml;
use Q;
read all into z;
print z;
y = z[1:12,4];
print y;
x = z[1:12,1:3];
print x;
x_t = t(x);
print x_t;
beta_hat = inv(x_t*x)*x_t*y;
print beta_hat;
k = {1 1,0 0,-2 0};
print k;
k_t = t(k);
print k_t ;
ma = {0, 8};
print ma;
MSE = 3.49043;
r = 2;
print mse r;
f_score = t(k_t*beta_hat-ma)*inv(k_t*inv(x_t*x)*k)*(k_t*beta_hat-ma)/(r*mse);
print f_score;
criterion = finv(0.95, 2, 9);
print criterion;
m = {1,10};
print m;
sigma_square =1;
print sigma_square;
theta= t(ma-m)*inv(k_t*inv(x_t*x)*k)*(ma-m)/sigma_square;
print theta;
run; quit;