function likeli=h1testwei(para,data1,data2,data3,data4)

a   =para(1);
b   =para(2);

lamda =para(3);
gamma =para(4);

 
live=[data2;data4];
died=[data1; data3];
realsur=live(:,8);
%  died



l1=(1-1./(1+exp(a+b.*died(:,3)))) ...
       .*exp(-(lamda*died(:,5)).^gamma).*(lamda*gamma*(lamda*died(:,5)).^(gamma-1));

 logl1=sum(log(l1(l1~=0)));
 
 
%  and live (censored)
 
p4=(1./(1+exp(a+b.*live(:,3)')))';
l4=p4.*realsur+(1-p4).*exp(-(lamda*live(:,5)).^gamma);

logl4=sum(log(l4(l4~=0)));


likeli=logl1+logl4;
 

likeli=(-1)*likeli+(a<0)*1e10+(b<0)*1e10+(lamda<0)*1e10+(gamma<0)*1e10;