data=load('data.txt');
[T,k] = size(data);

u = empiricalcdf(data(:,1));
v = empiricalcdf(data(:,2));

options = optimset('Display','iter','TolCon',10^-12,'TolFun',10^-4,'TolX',10^-6);
lower = 0.0001;
theta0 = 1;

kappa1 = corrcoef12(norminv(u),norminv(v));
kappa2 = fmincon('claytonCL',1,[],[],[],[],0.0001,[],[],options,[u,v]);
kappa3 = fmincon('claytonCL',theta0,[],[],[],[],lower,[],[],options,1-[u,v]);
kappa4 = fmincon('plackettCL',theta0,[],[],[],[],lower,[],[],options,[u,v]);
kappa5 = fmincon('frankCL',theta0,[],[],[],[],lower,[],[],options,[u,v]);
kappa6 = fmincon('gumbelCL',2,[],[],[],[],1.1,[],[],options,[u,v]);
kappa7 = fmincon('gumbelCL',2,[],[],[],[],1.1,[],[],options,1-[u,v]);


    lower1 = [-0.99 , 2.1 ];
    upper1 = [ 0.999, 100 ];
    theta01 = [kappa1;10];

    kappa8 = fmincon('tcopulaCL',theta01,[],[],[],[],lower1,upper1,[],options,[u,v]);


lower2 = [0 , 0 ];
upper2 = [ 1 , 1];
theta02 = [0.25;0.25];
kappa9 = fmincon('sym_jc_CL',theta02,[],[],[],[],lower2,upper2,[],options,[u,v]);

kappa=[kappa1;kappa2;kappa3;kappa4;kappa5;kappa6;kappa7;kappa8(1);kappa9];

