7.4852 -15.9975 7.7978 166.7088
5.8611 -17.5693 12.0178 165.5934
7.1259 -17.5272 7.4251 166.5637
6.6186 -17.0837 12.4536 165.3449
6.4305 -15.5659 8.8766 165.8230
6.2121 -15.9700 10.1831 164.1200
6.3538 -16.3374 8.5878 166.9151
5.9857 -18.3566 7.3265 167.9977
6.1652 -19.3342 9.5829 165.5141
7.2786 -18.7227 9.6440 165.0974
8.1598 -17.9350 9.0559 164.5018
6.3445 -18.5623 6.7798 165.3493
7.1925 -18.2450 7.1858 163.9161
6.1192 -17.4951 9.3537 164.3617
6.8087 -18.9182 11.1488 167.2663
5.0421 -16.0366 9.3526 165.7689
8.5740 -17.6436 9.8665 165.6685
8.7000 -15.7616 9.0134 166.5463
6.3938 -16.6296 9.6259 167.1241
9.3566 -19.5029 9.8847 165.7145
7.1967 -17.3653 9.1331 166.3693
6.8748 -15.5068 6.9022 165.3785
6.3774 -16.0153 9.3000 165.8999
6.5430 -15.8328 9.3214 166.5810
7.2523 -17.0393 9.2903 163.8583
8.1870 -14.3908 10.3854 165.5108
6.2888 -19.7145 8.7638 167.4628
MeanYB =
7.0782 -17.1662 9.0817 165.7985
MeanYall =
6.7347 -17.2625 9.2564 165.8384
Количество, когда Q_M > Q_MB:
sq_m =
34
Оценки параметров базовой модели, рассчитанные взвешенным МНК
Q_M =
6.3912
-4.2072
-2.9609
0.4977
Оценки параметров модели с учетом данных, сгенерированных бутстреп-методом, рассчитанные взвешенным МНК
Q_MB =
6.7347
-4.2853
-2.9681
0.4988
3.2. По функции распределения ошибок
sigma = 1.5;
Q=[6 -4 -3 0.5];
N = 16;
X1=[0:0.1:10];
rnd=[];
Ysred=[];
Otkl=[];
k_intrv=5;
KB=100;
RNX=[];
YB=[];
MeanYB=[];
Yall=[];
MeanYall=[];
p=[];
maxp=0;
PLAN=[
0 N;
2.765 N;
7.235 N;
10 N;
];
sq_m=0;
for l=1:KB
random = randn(N+1,4)*sigma;
Ymodel=zeros(N,4);
for j=1:N
for i=1:4
Ymodel(j,i) = Q(1)+Q(2)*PLAN(i,1)+Q(3)*PLAN(i,1)^2+Q(4)*PLAN(i,1)^3+random(j,i);
end
end
Ysred = mean(Ymodel);
for i=1:N
for j=1:4
Otkl(i,j)= Ymodel(i,j) - Ysred(j);
end
end
MinOtkl = min(min(Otkl));
MaxOtkl = max(max(Otkl));
Delta = (MaxOtkl - MinOtkl)/k_intrv;
Chast = zeros (1,k_intrv);
LeftVal = MinOtkl;
for l = 1:k_intrv
for i = 1:N
for j = 1:4
if (Otkl(i,j) >= LeftVal) & (Otkl(i,j) < LeftVal + Delta)
Chast(l) = Chast(l) + 1;
end
if Otkl(i,j) == MaxOtkl & l == k_intrv
Chast(k_intrv) = Chast(k_intrv) + 1;
end
end
end
LeftVal = LeftVal + Delta;
end
for i= 1: k_intrv
p(i)=Chast(i)/N*4;
end
maxP=max(p);
sum=0;
sum=0;
for i=1:k_intrv
sum = sum + p(i);
Fp(i) = sum;
end
Fotkl=[];
for i= 1: k_intrv
Fotkl(i,1) = p(i) / Delta;
Fotkl(i,2) = Fp(i)-(Fotkl(i,1)*(MinOtkl + i*Delta));
end
for i= 1: KB
for j= 1: 4
for k= 1: N
ran_y=rand;
if 0 <= ran_y & ran_y < Fp(1)
t=1;
end
for i= 2: k_intrv
if Fp(i-1) <= ran_y & ran_y < Fp(i)
t=i;
break
end
end
RNX(k,j)=(ran_y-Fotkl(t,2))/Fotkl(t,1);
end
end
for i= 1: N
for j= 1: 4
YB(i,j)=Ysred(j)+RNX(i,j);
end
end
end
Yall=[Ymodel;YB];
MeanYB=mean(YB);
MeanYall=mean(Yall);
n = 4;
k = 4;
m = 1;
X = zeros(1,m);
f=[1 X(1) X(1)^2 X(1)^3];
F = ones(n,k);
for i= 1: n
for j= 1: m
X(j) = PLAN(i,j);
end
f=[1 X(1) X(1)^2 X(1)^3];
for j= 1: k
F(i,j) = f(j);
end
end
Q_M=inv(F'*F)*F'*Ysred';
k=4;
D_MB=[];
for i= 1: k
sum = 0;
for j= 1: 2*N
sum = sum + (Yall(j,i)-MeanYall(i))^2;
end
D_MB(i) = (1/((2*N)*(2*N-1)))*sum;
end
D = diag(D_MB);
M = F'*inv(D)*F;
Q_MB=inv(M)*F'*inv(D)*MeanYall';
sqm=0;
sqmb=0;
for i= 1: k
sqm = sqm + (Q(i)-Q_M(i))^2;
sqmb = sqmb + (Q(i)-Q_MB(i))^2;
end
if sqm > sqmb
sq_m=sq_m+1;
end
end
Ymodel
Ysred
YB
Yall
MeanYB
MeanYall
sq_m
Q_M
Q_MB
Результаты
Ymodel =
6.0719 -19.1491 9.8373 165.2897
5.2901 -19.6243 8.5404 164.1257
5.4039 -21.1021 8.6097 163.6705
3.2741 -17.1903 12.8710 164.6585
6.6158 -18.2346 9.0057 166.7196
6.7152 -19.0349 9.2901 165.9242
3.4051 -15.8481 8.4309 164.4530
8.7645 -14.7943 10.9563 165.1408
7.2246 -20.3398 7.5563 167.1481
7.9144 -15.5130 10.0093 166.7199
6.1805 -18.1420 10.1556 166.0201
7.1599 -16.9574 7.4808 165.2733
3.5461 -16.7282 10.2308 164.6781
6.0613 -18.3470 9.5969 165.0340
4.9115 -16.8629 8.4037 163.7214
4.6745 -15.2243 12.5411 166.0598
Ysred =
5.8258 -17.6933 9.5948 165.2898
YB =
2.8145 -20.4888 6.8743 162.1732
2.7300 -20.6144 6.3793 162.2295
2.5351 -20.7744 6.5124 162.6791
2.4826 -20.8751 6.2126 161.9913
2.4795 -20.4030 6.5088 162.1066
2.5271 -21.0645 6.6315 162.3103
3.2640 -20.5948 6.8780 162.3172
2.6547 -20.3785 6.6731 162.0635
Уважаемый посетитель!
Чтобы распечатать файл, скачайте его (в формате Word).
Ссылка на скачивание - внизу страницы.