function likeli=h1test(para,data1,data2,data3,data4,realsur,realden)

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

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

 

%diseased and died



l1=(1-1./(1+exp(a+b.*data1(:,3)))) ...
       .*exp(-(lamda*data1(:,5)).^gamma).*(lamda*gamma.*(lamda*data1(:,5)).^(gamma-1));
   log(l1)
   
 
 logl1=sum(log(l1));
%diseased but live (censored)

l2=(1-1./(1+exp(a+b.*data2(:,3)))) ...
       .*exp(-(lamda*data2(:,5)).^gamma);
 
   log(l2)
   
   logl2=sum(log(l2));
   
%not diseased but died 

 
p3=(1./(1+exp(a+b.*data3(:,3)')))';
 
l3=p3.*(realden)+(1-p3).*lamda.*gamma.*(lamda.*data3(:,5)).^(gamma-1).*exp(-(lamda.*data3(:,5)).^gamma);


log(l3)

logl3=sum(log(l3));
%not diseased and live (censored)
 
p4=(1./(1+exp(a+b.*data4(:,3)')))';
l4=p4.*realsur+(1-p4).*exp(-(lamda*data4(:,5)).^gamma);

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


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