LAMPIRAN 1 EDITOR PROGRAM MATLAB clear; clc; tic; %Data Permintaan Soft Drink A = [81.7 1.78 56.9 2.27 64.1 2.21 65.4 2.15 64.1 2.26 58.1 2.49 61.7 2.52 65.3 2.46 57.8 2.54 63.5 2.72 65.9 2.60 48.3 2.87 55.6 3.00 47.9 3.23 57.0 3.11 51.6 3.11 54.2 3.09 51.7 3.34 55.9 3.31 52.1 3.42 52.5 3.61 44.3 3.55 57.7 3.72 51.6 3.72 53.8 3.70 50.0 3.81 46.3 3.86 46.8 3.99 51.7 3.89 49.9 4.07
6.95 7.32 6.96 7.18 7.46 7.47 7.88 7.88 7.97 7.96 8.09 8.24 7.96 8.34 8.10 8.43 8.72 8.87 8.82 8.59 8.83 8.86 8.97 9.13 8.98 9.25 9.33 9.47 9.49 9.52
% Transformasi ke dalam fungsi log A = log (A); y = A (:, 1); T = length(y); X = [ones(T,1) A(:,2:5)]; [T k] = size(X); % I. SIMULASI SATU KALI fprintf('I. SIMULASI SATU KALI\n') % IA.ESTIMASI fprintf('A.I. ESTIMASI\n') % OLS Unrestricted R1 = [0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1];
1.11 0.67 0.83 0.75 1.06 1.10 1.09 1.18 0.88 1.30 1.17 0.94 0.91 1.10 1.50 1.17 1.18 1.37 1.52 1.15 1.39 1.60 1.73 1.35 1.37 1.41 1.62 1.69 1.71 1.69
25088 26561 25510 27158 27162 27583 28235 29413 28713 30000 30533 30373 31107 31126 32506 32408 33423 33904 34528 36019 34807 35943 37323 36682 38054 36707 38411 38823 38361 41593];
r1 = [0 0 0 0]'; [J1 K] = size(R1); fprintf('Penaksir Beta unresricted\n'); bcap = inv(X'*X)*X'*y; %taksir bcap BI.1 -Judge page 199 fprintf('bcap1=%6.3f bcap2=%6.3f bcap3=%6.3f bcap4=%6.3f bcap5=%6.3f \n\n',bcap(1),bcap(2),bcap(3),bcap(4),bcap(5)); ycap = X*bcap; ecap = y-ycap; fprintf('Penaksir Varian Error unrestristed\n'); s2cap = ecap'*ecap/(T-K); %taksir s2cap BI.2- Judge page 207 fprintf('s2cap=%6.3f \n\n',s2cap); fprintf('Penaksir Covarian Beta unrestricted\n'); covbcap= s2cap*inv(X'*X); %taksir covbcap BI.3 disp(covbcap); % OLS Restricted Benar R2 = [0 1 1 1 [J2 K] = size(R2); r2 = 0;
1];
fprintf('Penaksir Beta resricted-benar\n'); bst = bcap + inv(X'*X)*R2'*inv(R2*inv(X'*X)*R2')*(r2- R2*bcap); % taksiran bstar BI.4 fprintf('bst1=%6.3f bst2=%6.3f bst3=%6.3f bst4=%6.3f bst5=%6.3f \n\n',bst(1),bst(2),bst(3),bst(4),bst(5)); ycapst = X*bst; ecapst = y - ycapst; fprintf('Penaksir Varian Error restricted-benar\n'); s2capst=ecapst'*ecapst/(T-K); fprintf('s2capst=%6.3f \n\n',s2capst); Mst = eye(K)-inv(X'*X)*R2'*inv(R2*inv(X'*X)*R2')*R2; fprintf('Penaksir Covarian Beta restricted-benar\n'); covpst = s2capst*Mst*inv(X'*X)*Mst' ;% taksiran covbstra BI.5 disp(covpst); %OLS restricted salah R3 = [0 1 1 1 r3 = 0.1;
1];
fprintf('Penaksir Beta resricted-salah\n'); bsl = bcap + inv(X'*X)*R3'* inv(R3*inv(X'*X)*R3')*(r3-R3*bcap); % taksiran bsl BI.6 fprintf('bsl1=%6.3f bsl2=%6.3f bsl3=%6.3f bsl4=%6.3f bsl5=%6.3f \n\n',bsl(1),bsl(2),bsl(3),bsl(4),bsl(5)); ycapsl = X*bsl; ecapsl = y - ycapsl; fprintf('Penaksir Varian Error restricted-salah\n'); s2capsl=ecapsl'*ecapsl/(T-K); fprintf('s2capsl=%6.3f \n\n',s2capsl); Msl = eye(K)-inv(X'*X)*R3'*inv(R3*inv(X'*X)*R3')*R3;
fprintf('Penaksir Covarian Beta restricted-salah\n');% taksiran covbstra Bsl covpsl = s2capsl*Msl*inv(X'*X)*Msl'; disp(covpsl); % IB. PENGUJIAN fprintf('B.I. PENGUJIAN \n'); ttabel = 2.060; ftabel = 2.76; fprintf('t-tabel =%6.3f f-tabel =%6.3f \n',ttabel,ftabel); % OLS Unrestricted stdb = sqrt(diag(covbcap)); fprintf('t-test: uji Beta parsial-unrestricted\n'); t = bcap./stdb ;%t test BI.7 fprintf('t-bcap1=%6.3f t-bcap2=%6.3f t-bcap3=%6.3f t-bcap4=%6.3f t-bcap5=%6.3f \n\n',t(1),t(2),t(3),t(4),t(5)); SSR = ycap'*ycap- T*(mean(y))^2; SST = y'*y- T*(mean(y))^2 ; SSE = ecap'*ecap; fprintf('R2-Adj unrestricted\n'); R2adj = (1-(SSE/(T-K))/(SST/(T-1)))*100; fprintf('R2adj =%7.3f\n',R2adj); fprintf('F-test: unrestricted'); Fols = (R1*bcap-r1)'*inv(R1*inv(X'*X)*R1')*(R1*bcap-r1)/(J1*s2cap);%F test BI. 8 fprintf('F-ols =%7.3f\n',Fols); % OLS Restricted Benar SSRst = ycapst'*ycapst- T*(mean(y))^2; SSTst = y'*y- T*(mean(y))^2 ; SSEst = ecapst'*ecapst; fprintf('R2-Adj restricted-Benar\n'); R2adjst = (1-(SSEst/(T-K))/(SSTst/(T-1)))*100; fprintf('R2adjst =%7.3f\n',R2adjst); fprintf('F-test: restricted-Benar\n'); Fst = (R2*bcap-r2)'*inv(R2*inv(X'*X)*R2')*(R2*bcap-r2)/(J2*s2cap); %test untuk b2 BI.9 fprintf('F-st =%7.3f\n',Fst); % OLS Restricted Salah SSRsl = ycapsl'*ycapsl- T*(mean(y))^2; SSTsl = y'*y- T*(mean(y))^2 ; Ssesl = ecapsl'*ecapsl; fprintf('R2-Adj restricted-Salah\n'); R2adjsl = (1-(Ssesl/(T-K))/(SSTsl/(T-1)))*100; fprintf('R2adjsl =%7.3f\n',R2adjsl); fprintf('F-test: restricted-Salah\n'); Fsl = (R3*bcap-r3)'*inv(R3*inv(X'*X)*R3')*(R3*bcap-r3)/(J2*s2cap); %test untuk b2 BI.9 fprintf('F-sl =%7.3f\n\n',Fsl);
% II. MONTE CARLO SIMULATION fprintf('II. SIMULASI MONTE CARLO\n\n') % Misal beta dan s2 diketahui % Parameter Populasi beta = [-4.7978 -1.2994 0.1868 0.1667 0.9459]; s2 = 0.0036; % Inisialisasi rep = 10^5; bsim = zeros(rep,K); s2sim=zeros(rep,1); bstsim=zeros(rep,K); s2st=zeros(rep,1); bslsim=zeros(rep,K); s2sl=zeros(rep,1); pilih1=zeros(rep,2); pilih2=zeros(rep,2); pilih3=zeros(rep,2); pilih4=zeros(rep,K); % Proses Simulasi for i= 1:rep; % Estimasi OLS ysim = X*beta + sqrt(s2)*randn(T,1); betacap = inv(X'*X)*X'*ysim; ycapsim = X*betacap; ecapsim = ysim-ycapsim; s2capsim = ecapsim'*ecapsim/(T-K) ; bsim(i,:) = betacap'; s2sim(i,1)=s2capsim ; % Estimasi OLS Restricted Benar betast = betacap + inv(X'*X)*R2'*inv(R2*inv(X'*X)*R2')*(r2 - R2*betacap); ycapst = X*betast; ecapst = ysim-ycapst; s2capst= ecapst'*ecapst/(T-K); bstsim(i,:)= betast'; s2st(i,1)=s2capst; % Estimasi OLS Restricted Salah betasl = betacap + inv(X'*X)*R3'*inv(R3*inv(X'*X)*R3')*(r3- R3*betacap); ycapsl = X*betasl; ecapsl = ysim-ycapsl; s2capsl= ecapsl'*ecapsl/(T-K); bslsim(i,:)=betasl'; s2sl(i,1)=s2capsl;
% Pengujian FOLS1 = (R1*betacap-r1)'*inv(R1*inv(X'*X)*R1')*(R1*betacap-r1)/(J1*s2capsim);%F test BI. 8 FST2 = (R2*betast-r2)'*inv(R2*inv(X'*X)*R2')*(R2*betast-r2)/(J2*s2capst);%test untuk r2=r3 , F test BI. 9 FSL3 = (R3*betasl-r3)'*inv(R3*inv(X'*X)*R3')*(R3*betasl-r3)/(J2*s2capsl);%test F test BI. 6 covbetacap = s2capsim*inv(X'*X);%taksir covbcap BI.3 stdbeta = sqrt(diag(covbetacap)); t = betacap./stdbeta; %t test BI.7 pilih1(i,1)=FOLS1; pilih2(i,1)=FST2; pilih3(i,1)=FSL3; pilih1(i,2)=FOLS1>1.92 pilih2(i,2)=FST2>1.92; pilih3(i,2)=FSL3>1.92;
;
for j=1:K pilih4(i,j)=abs(t(j))>2.056; end; end; fprintf(' Persentase F-test unrestricted yang signifikan\n'); Persing1=sum(pilih1)/rep; fprintf('Persentase Ho yang ditolak = %3.0f\n',Persing1(2)*100); fprintf('Persentase F-test restricted-Benar yang signifikan\n'); Persing2=sum(pilih2)/rep; fprintf('Persentase Ho yang ditolak = %3.0f\n',Persing2(2)*100); fprintf('Persentase F-test restricted-Salah yang signifikan\n'); Persing3=sum(pilih3)/rep; fprintf('Persentase Ho yang ditolak = %3.0f\n',Persing3(2)*100); fprintf('Persentase t-test unrestricted yang signifikan\n'); Persing4=sum(pilih4)/rep; fprintf('Persentase Ho yang ditolak beta1 = %3.0f\n',Persing4(1)*100); fprintf('Persentase Ho yang ditolak beta2 = %3.0f\n',Persing4(2)*100); fprintf('Persentase Ho yang ditolak beta3 = %3.0f\n',Persing4(3)*100); fprintf('Persentase Ho yang ditolak beta4 = %3.0f\n',Persing4(4)*100); fprintf('Persentase Ho yang ditolak beta5 = %3.0f\n\n',Persing4(5)*100); % Analisis Mean Beta fprintf ('ANALISIS MEAN BETA \n'); fprintf ('Analisis Mean Beta Unrestricted \n'); mean_bsim=mean(bsim); fprintf('%7.3f',mean_bsim(1)); fprintf('%7.3f',mean_bsim(2)); fprintf('%7.3f',mean_bsim(3)); fprintf('%7.3f',mean_bsim(4)); fprintf('%7.3f\n\n',mean_bsim(5)); fprintf ('Analisis Mean Beta Restricted Benar \n'); mean_bstsim=mean(bstsim); fprintf('%7.3f',mean_bstsim(1)); fprintf('%7.3f',mean_bstsim(2));
fprintf('%7.3f',mean_bstsim(3)); fprintf('%7.3f',mean_bstsim(4)); fprintf('%7.3f\n\n',mean_bstsim(5)); fprintf ('Analisis Mean Beta Restricted Salah \n'); mean_bslsim=mean(bslsim); fprintf('%7.3f',mean_bslsim(1)); fprintf('%7.3f',mean_bslsim(2)); fprintf('%7.3f',mean_bslsim(3)); fprintf('%7.3f',mean_bslsim(4)); fprintf('%7.3f\n\n',mean_bslsim(5)); % Analisis Mean Varian error fprintf ('ANALISIS MEAN VARIAN ERROR\n'); mean_varsim=mean(s2sim); fprintf('mean_varsim = %7.4f \n',mean_varsim); mean_varstsim=mean(s2st); fprintf('mean_varstsim = %7.4f \n',mean_varstsim); mean_varslsim=mean(s2sl); fprintf('mean_varslsim = %7.4f \n',mean_varslsim); subplot(1,3,1), histfit(bsim(:,1)); title('Beta1-unrestricted'); subplot(1,3,2), histfit(bstsim(:,1)); title('B1-restricted BENAR'); subplot(1,3,3), histfit(bslsim(:,1)); title('B1-restricted SALAH'); subplot(1,3,1), histfit(bsim(:,2)); title('B2-unrestricted'); subplot(1,3,2), histfit(bstsim(:,2)); title('B2-restricted BENAR'); subplot(1,3,3), histfit(bslsim(:,2)); title('B2-restricted SALAH'); subplot(1,3,1), histfit(bsim(:,3)); title('B3-unrestricted'); subplot(1,3,2), histfit(bstsim(:,3)); title('B3-restricted BENAR'); subplot(1,3,3), histfit(bslsim(:,3)); title('B3-restricted SALAH'); subplot(1,3,1), histfit(bsim(:,4)); title('B4-unrestricted'); subplot(1,3,2), histfit(bstsim(:,4)); title('B4-restricted BENAR'); subplot(1,3,3), histfit(bslsim(:,4)); title('B4-restricted SALAH'); subplot(1,3,1), histfit(bsim(:,5)); title('B5-unrestricted'); subplot(1,3,2), histfit(bstsim(:,5)); title('B5-restricted BENAR'); subplot(1,3,3), histfit(bslsim(:,5)); title('B5-restricted SALAH'); ti=toc;
LAMPIRAN 2 OUTPUT PROGRAM MATLAB I. SIMULASI SATU KALI A.I. ESTIMASI Penaksir Beta unresricted bcap1=-3.243 bcap2=-1.020 bcap3=-0.583 bcap4= 0.210 bcap5= 0.923 Penaksir Varian Error unrestristed s2cap= 0.004 Penaksir Covarian Beta unrestricted 14.0100 0.6359 0.4600 0.1240 0.6359 0.0571 -0.0587 0.0044 0.4600 -0.0587 0.3138 -0.0079 0.1240 0.0044 -0.0079 0.0064 -1.5131 -0.0554 -0.1020 -0.0109
-1.5131 -0.0554 -0.1020 -0.0109 0.1727
Penaksir Beta resricted-benar bst1=-4.798 bst2=-1.299 bst3= 0.187 bst4= 0.167 bst5= 0.946 Penaksir Varian Error restricted-benar s2capst= 0.004 Penaksir Covarian Beta restricted-benar 14.3448 0.5084 1.0330 0.1071 -1.6485 0.5084 0.0286 0.0300 -0.0005 -0.0581 1.0330 0.0300 0.0841 0.0059 -0.1200 0.1071 -0.0005 0.0059 0.0062 -0.0116 -1.6485 -0.0581 -0.1200 -0.0116 0.1897 Penaksir Beta resricted-salah bsl1=-5.128 bsl2=-1.359 bsl3= 0.350 bsl4= 0.158 bsl5= 0.951 Penaksir Varian Error restricted-salah s2capsl= 0.004 Penaksir Covarian Beta restricted-salah 14.9567 0.5301 1.0771 0.1117 -1.7189 0.5301 0.0298 0.0313 -0.0005 -0.0606 1.0771 0.0313 0.0877 0.0061 -0.1251 0.1117 -0.0005 0.0061 0.0064 -0.0121 -1.7189 -0.0606 -0.1251 -0.0121 0.1978 B.I. PENGUJIAN t-tabel = 2.060 f-tabel = 2.760 t-test: uji Beta parsial-unrestricted
t-bcap1=-0.866 t-bcap2=-4.269 t-bcap3=-1.041 t-bcap4= 2.629 t-bcap5= 2.221 R2-Adj unrestricted R2adj = 79.745 F-test: unrestrictedF-ols = 29.544 R2-Adj restricted-Benar R2adjst = 77.722 F-test: restricted-Benar F-st = 2.497 R2-Adj restricted-Salah R2adjsl = 76.772 F-test: restricted-Salah F-sl = 3.670 II. SIMULASI MONTE CARLO Persentase F-test unrestricted yang signifikan Persentase Ho yang ditolak = 100 Persentase F-test restricted-Benar yang signifikan Persentase Ho yang ditolak = 0 Persentase F-test restricted-Salah yang signifikan Persentase Ho yang ditolak = 0 Persentase t-test unrestricted yang signifikan Persentase Ho yang ditolak beta1 = 24 Persentase Ho yang ditolak beta2 = 100 Persentase Ho yang ditolak beta3 = 6 Persentase Ho yang ditolak beta4 = 52 Persentase Ho yang ditolak beta5 = 59 ANALISIS MEAN BETA Analisis Mean Beta Unrestricted -4.805 -1.300 0.188 0.167 0.946 Analisis Mean Beta Restricted Benar -4.802 -1.300 0.187 0.167 0.946 Analisis Mean Beta Restricted Salah -5.132 -1.359 0.350 0.158 0.951 ANALISIS MEAN VARIAN ERROR mean_varsim = 0.0036 mean_varstsim = 0.0037 mean_varslsim = 0.0038 >>
LAMPIRAN 3 HASIL SIMULASI TAKSIRAN KOEFISIEN β
1200
Beta1-unrestricted
B1-restricted BENAR B1-restricted SALAH 1200 1200
1000
1000
1000
800
800
800
600
600
600
400
400
400
200
200
200
0 -20
0
20
0 -20
B2-unrestricted
0
20
0 -20
B2-restricted BENAR 1200
1200
1000
1000
1000
800
800
800
600
600
600
400
400
400
200
200
200
-2
0
0 -4
-2
0
20
B2-restricted SALAH
1200
0 -4
0
0 -4
-2
0
B3-unrestricted
B3-restricted BENAR
B3-restricted SALAH
1200
1200
1200
1000
1000
1000
800
800
800
600
600
600
400
400
400
200
200
200
0 -5
0
5
B4-unrestricted
0 -2
0
2
0 -2
0
2
1400
B4-restricted BENAR B4-restricted SALAH 1400 1400
1200
1200
1200
1000
1000
1000
800
800
800
600
600
600
400
400
400
200
200
200
0 -1
0
1
0 -0.5
0
0.5
0 -0.5
0
0.5
B5-unrestricted
B5-restricted BENAR
B5-restricted SALAH
1200
1200
1200
1000
1000
1000
800
800
800
600
600
600
400
400
400
200
200
200
0 -5
0
5
0 -5
0
5
0 -5
0
5