]> henry.ined.fr Git - .git/commitdiff
(Module): refinements in the computation of lli if
authorAgnès Lièvre <agnes.lievre@education.gouv.fr>
Thu, 16 Mar 2006 15:10:38 +0000 (15:10 +0000)
committerAgnès Lièvre <agnes.lievre@education.gouv.fr>
Thu, 16 Mar 2006 15:10:38 +0000 (15:10 +0000)
status=-2 in order to have more reliable computation if stepm is
not 1 month. Version 0.98f

src/imach.c

index 13dcbac65cabf6a8ade3b5fc52c60af2b51eb0b4..21dc78c42aee45685b8b745c12b407a7c364cd89 100644 (file)
@@ -1,6 +1,10 @@
 /* $Id$
   $State$
   $Log$
+  Revision 1.119  2006/03/15 17:42:26  brouard
+  (Module): Bug if status = -2, the loglikelihood was
+  computed as likelihood omitting the logarithm. Version O.98e
+
   Revision 1.118  2006/03/14 18:20:07  brouard
   (Module): varevsij Comments added explaining the second
   table of variances if popbased=1 .
@@ -325,7 +329,7 @@ extern int errno;
 /* $Id$ */
 /* $State$ */
 
-char version[]="Imach version 0.98e, March 2006, INED-EUROREVES-Institut de longevite ";
+char version[]="Imach version 0.98f, March 2006, INED-EUROREVES-Institut de longevite ";
 char fullversion[]="$Revision$ $Date$"; 
 char strstart[80];
 char optionfilext[10], optionfilefiname[FILENAMELENGTH];
@@ -1382,23 +1386,23 @@ double func( double *x)
 
        } else if  (s2==-2) {
          for (j=1,survp=0. ; j<=nlstate; j++) 
-           survp += out[s1][j];
+           survp += (1.+bbh)*out[s1][j]- bbh*savm[s1][j];
+         /*survp += out[s1][j]; */
          lli= log(survp);
        }
        
-/*     else if  (s2==-4) { */
-/*       for (j=3,survp=0. ; j<=nlstate; j++)  */
-/*         survp += out[s1][j]; */
-/*       lli= survp; */
-/*     } */
-       
-/*     else if  (s2==-5) { */
-/*       for (j=1,survp=0. ; j<=2; j++)  */
-/*         survp += out[s1][j]; */
-/*       lli= survp; */
-/*     } */
-
+       else if  (s2==-4) { 
+         for (j=3,survp=0. ; j<=nlstate; j++)  
+           survp += (1.+bbh)*out[s1][j]- bbh*savm[s1][j];
+         lli= log(survp); 
+       } 
 
+       else if  (s2==-5) { 
+         for (j=1,survp=0. ; j<=2; j++)  
+           survp += (1.+bbh)*out[s1][j]- bbh*savm[s1][j];
+         lli= log(survp); 
+       } 
+       
        else{
          lli= log((1.+bbh)*out[s1][s2]- bbh*savm[s1][s2]); /* linear interpolation */
          /*  lli= (savm[s1][s2]>(double)1.e-8 ?log((1.+bbh)*out[s1][s2]- bbh*(savm[s1][s2])):log((1.+bbh)*out[s1][s2]));*/ /* linear interpolation */
@@ -1595,7 +1599,7 @@ double funcone( double *x)
        lli=log(out[s1][s2] - savm[s1][s2]);
       } else if  (s2==-2) {
        for (j=1,survp=0. ; j<=nlstate; j++) 
-         survp += out[s1][j];
+         survp += (1.+bbh)*out[s1][j]- bbh*savm[s1][j];
        lli= log(survp);
       }else if (mle==1){
        lli= log((1.+bbh)*out[s1][s2]- bbh*savm[s1][s2]); /* linear interpolation */