利用least-square参数估计法与Copula函数计算联合概率分布 (matlab code)(The joint probability distribution (Matlab, code) is calculated by using the least-square parameter estimation method and the Copula function)
% using least-square parameter estimation method and Copula function to calculate joint probability distribution
%parameter, estimation, for, Weibull, distribution, and, estimate, the,, parameter, for, Copula
Clear; clc;
N=20;
H=[8.7, 12.8, 9.9, 10.3, 7.5, 12.3, 10.3, 7.5, 9.3, 12.7, 6.8, 7.4, 12.6,, 12.2, 8.7, 13.2, 11.8, 11,, 10.5;
S=[39.9, 40.3, 41.7, 28.5, 26.4, 47.1, 40.5, 22.9, 40.5, 42.2, 23.8, 23.6, 38.2,, 45.8, 34.2, 31.2, 35.2, 41.2,, 41.5;
%--------determine Weibull distribution-----------------------------------
H_sort=sort (H);
S_sort=sort (s);
X_hi=log (h_sort);
X_si=log (s_sort);
For k=1:20
MR (k) = (k-0.3) / (n+0.4);
X_hi_2 (k) = (x_hi (k)) ^2;
X_si_2 (k) = (x_si (k)) ^2;
End
For i=1:n
Xy_hi (I), =x_hi (I), *yi (I);
Xy_si (I), =x_si (I), *yi (I);
End
B_hat_h= (sum (xy_hi), -sum (x_hi), *sum (Yi) /n) / (sum (x_hi_2) - (sum (x_hi)) ^2/n);
B_hat_s= (sum (xy_si), -sum (x_si), *sum (Yi) /n) / (sum (x_si_2) - (sum (x_si)) ^2/n);
A_hat_h=mean (Yi) -b_hat_h*mean (x_hi);
A_hat_s=mean (Yi) -b_hat_s*mean (x_si);
Eta_hat_h=exp (-a_hat_h/b_hat_h)
Eta_hat_s=exp (-a_hat_s/b_hat_s)
Beta_hat_h=b_hat_h
Beta_hat_s=b_hat_s
%----------determine Copula function--------------------------------------------
Count_nag=0;
Count_pos=0;
For j=1:n-1
For l=j+1:n
Tau_value= (H (J) -h (L)) * (s (J) -s (L));
If (tau_value<0)
Count_nag=count_nag+1
Else
Count_pos=count_pos+1;
End
End
End
Tau= (count_pos-count_nag) / (n* (n-1) *0.5)
%Plot, PDF, and, CDF, distribution, figures, in, calculation
%Prepare, by, Pu, Li, 2008.03.22
Clear; clc;
H=[0:0.3:30];
S=[0:0.9:90];
H_pdf=wblpdf (h, 11.0175, 4.2393);
S_pdf=wblpdf (s, 38.8137, 4.4892);
Figure;
Plot (h, h_pdf);
Figure;
Plot (s, s_pdf);
H_cdf=wblcdf (h, 11.0175, 4.2393);
S_cdf=wblcdf (