]> henry.ined.fr Git - .git/commitdiff
Summary: Outputs now all graphs of convergence to period prevalence
authorN. Brouard <brouard@ined.fr>
Fri, 20 Jun 2014 17:32:08 +0000 (17:32 +0000)
committerN. Brouard <brouard@ined.fr>
Fri, 20 Jun 2014 17:32:08 +0000 (17:32 +0000)
src/imach.c

index 98bbc36dc87560861fb8168ab2e7f69a928d55db..7e7bd81f7c968769c5fd1eda638914a54a49f5e3 100644 (file)
@@ -1,6 +1,10 @@
 /* $Id$
   $State$
   $Log$
+  Revision 1.153  2014/06/20 16:45:46  brouard
+  Summary: If 3 live state, convergence to period prevalence on same graph
+  Author: Brouard
+
   Revision 1.152  2014/06/18 17:54:09  brouard
   Summary: open browser, use gnuplot on same dir than imach if not found in the path
 
@@ -509,7 +513,7 @@ extern int errno;
 /* $Id$ */
 /* $State$ */
 
-char version[]="Imach version 0.98nT, January 2014,INED-EUROREVES-Institut de longevite-Japan Society for the Promotion of Science (Grant-in-Aid for Scientific Research 25293121)";
+char version[]="Imach version 0.98nU, January 2014,INED-EUROREVES-Institut de longevite-Japan Society for the Promotion of Science (Grant-in-Aid for Scientific Research 25293121)";
 char fullversion[]="$Revision$ $Date$"; 
 char strstart[80];
 char optionfilext[10], optionfilefiname[FILENAMELENGTH];
@@ -3888,13 +3892,13 @@ fprintf(fichtm," \n<ul><li><b>Graphs</b></li><p>");
  before but expressed in per year i.e. quasi incidences if stepm is small and probabilities too: <a href=\"%s%d_2.png\">%s%d_2.png</a><br> \
 <img src=\"%s%d_2.png\">",stepm,subdirf2(optionfilefiname,"pe"),jj1,subdirf2(optionfilefiname,"pe"),jj1,subdirf2(optionfilefiname,"pe"),jj1); 
        /* Period (stable) prevalence in each health state */
-       for(cpt=1; cpt<nlstate;cpt++){
-        fprintf(fichtm,"<br>- Period (stable) prevalence in each health state : <a href=\"%s%d_%d.png\">%s%d_%d.png</a><br> \
-<img src=\"%s%d_%d.png\">",subdirf2(optionfilefiname,"p"),cpt,jj1,subdirf2(optionfilefiname,"p"),cpt,jj1,subdirf2(optionfilefiname,"p"),cpt,jj1);
+       for(cpt=1; cpt<=nlstate;cpt++){
+        fprintf(fichtm,"<br>- Convergence from each state (1 to %d) to period (stable) prevalence in state %d <a href=\"%s%d_%d.png\">%s%d_%d.png</a><br> \
+<img src=\"%s%d_%d.png\">",nlstate, cpt, subdirf2(optionfilefiname,"p"),cpt,jj1,subdirf2(optionfilefiname,"p"),cpt,jj1,subdirf2(optionfilefiname,"p"),cpt,jj1);
        }
      for(cpt=1; cpt<=nlstate;cpt++) {
-        fprintf(fichtm,"\n<br>- Life expectancy by health state (%d) at initial age and its decomposition into health expectancies : <a href=\"%s%d%d.png\">%s%d%d.png</a> <br> \
-<img src=\"%s%d%d.png\">",cpt,subdirf2(optionfilefiname,"exp"),cpt,jj1,subdirf2(optionfilefiname,"exp"),cpt,jj1,subdirf2(optionfilefiname,"exp"),cpt,jj1);
+        fprintf(fichtm,"\n<br>- Life expectancy by health state (%d) at initial age and its decomposition into health expectancies in each alive state (1 to %d) : <a href=\"%s%d%d.png\">%s%d%d.png</a> <br> \
+<img src=\"%s%d%d.png\">",cpt,nlstate,subdirf2(optionfilefiname,"exp"),cpt,jj1,subdirf2(optionfilefiname,"exp"),cpt,jj1,subdirf2(optionfilefiname,"exp"),cpt,jj1);
      }
    } /* end i1 */
  }/* End k1 */
@@ -4080,7 +4084,6 @@ plot [%.f:%.f] \"%s\" every :::%d::%d u 1:%d t \"e%d1\" w l",ageminpar,fage,subd
       k=3;
       fprintf(ficgp,"\n#\n#\n#CV preval stable (period): 'pij' files, cov=%d state=%d",k1, cpt);
       fprintf(ficgp,"\nset out \"%s%d_%d.png\" \n",subdirf2(optionfilefiname,"p"),cpt,k1);
-      l=(nlstate+ndeath)*(cpt-1)+1;
       fprintf(ficgp,"set xlabel \"Age\" \nset ylabel \"Probability\" \n\
 set ter png small size 320, 240\n\
 unset log y\n\
@@ -4090,7 +4093,8 @@ plot [%.f:%.f]  ", ageminpar, agemaxpar);
          fprintf(ficgp,"\"%s\"",subdirf2(fileres,"pij"));
        else
          fprintf(ficgp,", '' ");
-       fprintf(ficgp," u ($1==%d ? ($3):1/0):($%d/($%d",k1,k+l,k+l);
+       l=(nlstate+ndeath)*(i-1)+1;
+       fprintf(ficgp," u ($1==%d ? ($3):1/0):($%d/($%d",k1,k+l+(cpt-1),k+l);
        for (j=1; j<= (nlstate-1) ; j ++)
          fprintf(ficgp,"+$%d",k+l+j);
        fprintf(ficgp,")) t \"prev(%d,%d)\" w l",i,cpt);
@@ -6675,16 +6679,16 @@ Interval (in months) between two waves: Min=%d Max=%d Mean=%.2lf<br>\n",\
   printf("Starting graphs with: %s\n",plotcmd);fflush(stdout);
 
   if((outcmd=system(plotcmd)) != 0){
-    printf("\n Problem with gnuplot command %s, err=%d\n", plotcmd, outcmd);
-    printf("\n Trying on same directory\n");
+    printf("gnuplot command might not be in your path: %s, err=%d\n", plotcmd, outcmd);
+    printf("\n Trying if gnuplot resides on the same directory that IMaCh\n");
     sprintf(plotcmd,"%sgnuplot %s", pathimach, optionfilegnuplot);
     if((outcmd=system(plotcmd)) != 0)
       printf("\n Still a problem with gnuplot command %s, err=%d\n", plotcmd, outcmd);
   }
-  printf(" Wait...");
+  printf(" Successul, please wait...");
   while (z[0] != 'q') {
     /* chdir(path); */
-    printf("\nType e to edit output files, g to graph again and q for exiting: ");
+    printf("\nType e to edit results with your browser, g to graph again and q for exit: ");
     scanf("%s",z);
 /*     if (z[0] == 'c') system("./imach"); */
     if (z[0] == 'e') {