]> henry.ined.fr Git - .git/commitdiff
Summary: 0.98q6 changing default small png format for graph to vectorized svg.
authorN. Brouard <brouard@ined.fr>
Mon, 7 Sep 2015 14:09:23 +0000 (14:09 +0000)
committerN. Brouard <brouard@ined.fr>
Mon, 7 Sep 2015 14:09:23 +0000 (14:09 +0000)
src/imach.c

index 9f608c68e0078479ea165f4e07905db4040fa01d..c7fe66de87a87c1234617da288dcecb9de158ee2 100644 (file)
@@ -1,6 +1,9 @@
 /* $Id$
   $State$
   $Log$
+  Revision 1.198  2015/09/03 07:14:39  brouard
+  Summary: 0.98q5 Flavia
+
   Revision 1.197  2015/09/01 18:24:39  brouard
   *** empty log message ***
 
@@ -4048,7 +4051,8 @@ void varevsij(char optionfilefiname[], double ***vareij, double **matcov, double
   free_vector(gmp,nlstate+1,nlstate+ndeath);
   free_matrix(gradgp,1,npar,nlstate+1,nlstate+ndeath);
   free_matrix(trgradgp,nlstate+1,nlstate+ndeath,1,npar); /* mu or p point j*/
-  fprintf(ficgp,"\nunset parametric;unset label; set ter png small size 320, 240");
+  /* fprintf(ficgp,"\nunset parametric;unset label; set ter png small size 320, 240"); */
+  fprintf(ficgp,"\nunset parametric;unset label; set ter svg size 640, 480");
   /* for(j=nlstate+1; j<= nlstate+ndeath; j++){ *//* Only the first actually */
   fprintf(ficgp,"\n set log y; unset log x;set xlabel \"Age\"; set ylabel \"Force of mortality (year-1)\";");
 /*   fprintf(ficgp,"\n plot \"%s\"  u 1:($3*%6.3f) not w l 1 ",fileresprobmorprev,YEARM/estepm); */
@@ -4058,11 +4062,11 @@ void varevsij(char optionfilefiname[], double ***vareij, double **matcov, double
   fprintf(ficgp,"\n replot \"%s\"  u 1:(($3+1.96*$4)) t \"95%% interval\" w l lt 2 ",subdirf(fileresprobmorprev));
   fprintf(ficgp,"\n replot \"%s\"  u 1:(($3-1.96*$4)) not w l lt 2 ",subdirf(fileresprobmorprev));
   fprintf(fichtm,"\n<br> File (multiple files are possible if covariates are present): <A href=\"%s\">%s</a>\n",subdirf(fileresprobmorprev),subdirf(fileresprobmorprev));
-  fprintf(fichtm,"\n<br> Probability is computed over estepm=%d months. <br> <img src=\"%s%s.png\"> <br>\n", estepm,subdirf3(optionfilefiname,"varmuptjgr",digitp),digit);
-  /*  fprintf(fichtm,"\n<br> Probability is computed over estepm=%d months and then divided by estepm and multiplied by %.0f in order to have the probability to die over a year <br> <img src=\"varmuptjgr%s%s.png\"> <br>\n", stepm,YEARM,digitp,digit);
+  fprintf(fichtm,"\n<br> Probability is computed over estepm=%d months. <br> <img src=\"%s%s.svg\"> <br>\n", estepm,subdirf3(optionfilefiname,"varmuptjgr",digitp),digit);
+  /*  fprintf(fichtm,"\n<br> Probability is computed over estepm=%d months and then divided by estepm and multiplied by %.0f in order to have the probability to die over a year <br> <img src=\"varmuptjgr%s%s.svg\"> <br>\n", stepm,YEARM,digitp,digit);
 */
-/*   fprintf(ficgp,"\nset out \"varmuptjgr%s%s%s.png\";replot;",digitp,optionfilefiname,digit); */
-  fprintf(ficgp,"\nset out \"%s%s.png\";replot;\n",subdirf3(optionfilefiname,"varmuptjgr",digitp),digit);
+/*   fprintf(ficgp,"\nset out \"varmuptjgr%s%s%s.svg\";replot;",digitp,optionfilefiname,digit); */
+  fprintf(ficgp,"\nset out \"%s%s.svg\";replot;\n",subdirf3(optionfilefiname,"varmuptjgr",digitp),digit);
 
   free_vector(xp,1,npar);
   free_matrix(doldm,1,nlstate,1,nlstate);
@@ -4447,15 +4451,15 @@ To be simple, these graphs help to understand the significativity of each parame
                    first=0;
                    fprintf(ficgp,"\nset parametric;unset label");
                    fprintf(ficgp,"\nset log y;set log x; set xlabel \"p%1d%1d (year-1)\";set ylabel \"p%1d%1d (year-1)\"",k1,l1,k2,l2);
-                   fprintf(ficgp,"\nset ter png small size 320, 240");
+                   fprintf(ficgp,"\nset ter svg size 640, 480");
                    fprintf(fichtmcov,"\n<br>Ellipsoids of confidence cov(p%1d%1d,p%1d%1d) expressed in year<sup>-1</sup>\
- :<a href=\"%s%d%1d%1d-%1d%1d.png\">\
-%s%d%1d%1d-%1d%1d.png</A>, ",k1,l1,k2,l2,\
+ :<a href=\"%s%d%1d%1d-%1d%1d.svg\">\
+%s%d%1d%1d-%1d%1d.svg</A>, ",k1,l1,k2,l2,\
                            subdirf2(optionfilefiname,"varpijgr"), j1,k1,l1,k2,l2,\
                            subdirf2(optionfilefiname,"varpijgr"), j1,k1,l1,k2,l2);
-                   fprintf(fichtmcov,"\n<br><img src=\"%s%d%1d%1d-%1d%1d.png\"> ",subdirf2(optionfilefiname,"varpijgr"), j1,k1,l1,k2,l2);
+                   fprintf(fichtmcov,"\n<br><img src=\"%s%d%1d%1d-%1d%1d.svg\"> ",subdirf2(optionfilefiname,"varpijgr"), j1,k1,l1,k2,l2);
                    fprintf(fichtmcov,"\n<br> Correlation at age %d (%.3f),",(int) age, c12);
-                   fprintf(ficgp,"\nset out \"%s%d%1d%1d-%1d%1d.png\"",subdirf2(optionfilefiname,"varpijgr"), j1,k1,l1,k2,l2);
+                   fprintf(ficgp,"\nset out \"%s%d%1d%1d-%1d%1d.svg\"",subdirf2(optionfilefiname,"varpijgr"), j1,k1,l1,k2,l2);
                    fprintf(ficgp,"\nset label \"%d\" at %11.3e,%11.3e center",(int) age, mu1,mu2);
                    fprintf(ficgp,"\n# Age %d, p%1d%1d - p%1d%1d",(int) age, k1,l1,k2,l2);
                    fprintf(ficgp,"\nplot [-pi:pi] %11.3e+ %.3f*(%11.3e*%11.3e*cos(t)+%11.3e*%11.3e*sin(t)), %11.3e +%.3f*(%11.3e*%11.3e*cos(t)+%11.3e*%11.3e*sin(t)) not",\
@@ -4472,7 +4476,7 @@ To be simple, these graphs help to understand the significativity of each parame
                  }/* if first */
                } /* age mod 5 */
              } /* end loop age */
-             fprintf(ficgp,"\nset out \"%s%d%1d%1d-%1d%1d.png\";replot;",subdirf2(optionfilefiname,"varpijgr"), j1,k1,l1,k2,l2);
+             fprintf(ficgp,"\nset out \"%s%d%1d%1d-%1d%1d.svg\";replot;",subdirf2(optionfilefiname,"varpijgr"), j1,k1,l1,k2,l2);
              first=1;
            } /*l12 */
          } /* k12 */
@@ -4540,20 +4544,20 @@ fprintf(fichtm," \n<ul><li><b>Graphs</b></li><p>");
        fprintf(fichtm," ************\n<hr size=\"2\" color=\"#EC5E5E\">");
      }
      /* Pij */
-     fprintf(fichtm,"<br>- Pij or Conditional probabilities to be observed in state j being in state i, %d (stepm) months before: <a href=\"%s%d_1.png\">%s%d_1.png</a><br> \
-<img src=\"%s%d_1.png\">",stepm,subdirf2(optionfilefiname,"pe"),jj1,subdirf2(optionfilefiname,"pe"),jj1,subdirf2(optionfilefiname,"pe"),jj1);     
+     fprintf(fichtm,"<br>- Pij or Conditional probabilities to be observed in state j being in state i, %d (stepm) months before: <a href=\"%s%d_1.svg\">%s%d_1.svg</a><br> \
+<img src=\"%s%d_1.svg\">",stepm,subdirf2(optionfilefiname,"pe"),jj1,subdirf2(optionfilefiname,"pe"),jj1,subdirf2(optionfilefiname,"pe"),jj1);     
      /* Quasi-incidences */
      fprintf(fichtm,"<br>- Pij or Conditional probabilities to be observed in state j being in state i %d (stepm) months\
- 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); 
+ before but expressed in per year i.e. quasi incidences if stepm is small and probabilities too: <a href=\"%s%d_2.svg\">%s%d_2.svg</a><br> \
+<img src=\"%s%d_2.svg\">",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>- Convergence to period (stable) prevalence in state %d. Or probability to be in state %d being in state (1 to %d) at different ages. <a href=\"%s%d_%d.png\">%s%d_%d.png</a><br> \
-<img src=\"%s%d_%d.png\">", cpt, cpt, nlstate, subdirf2(optionfilefiname,"p"),cpt,jj1,subdirf2(optionfilefiname,"p"),cpt,jj1,subdirf2(optionfilefiname,"p"),cpt,jj1);
+        fprintf(fichtm,"<br>- Convergence to period (stable) prevalence in state %d. Or probability to be in state %d being in state (1 to %d) at different ages. <a href=\"%s%d_%d.svg\">%s%d_%d.svg</a><br> \
+<img src=\"%s%d_%d.svg\">", cpt, cpt, nlstate, 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 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);
+        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.svg\">%s%d%d.svg</a> <br> \
+<img src=\"%s%d%d.svg\">",cpt,nlstate,subdirf2(optionfilefiname,"exp"),cpt,jj1,subdirf2(optionfilefiname,"exp"),cpt,jj1,subdirf2(optionfilefiname,"exp"),cpt,jj1);
      }
    /* } /\* end i1 *\/ */
  }/* End k1 */
@@ -4622,15 +4626,15 @@ See page 'Matrix of variance-covariance of one-step probabilities' below. \n", r
      }
      for(cpt=1; cpt<=nlstate;cpt++) {
        fprintf(fichtm,"<br>- Observed (cross-sectional) and period (incidence based) \
-prevalence (with 95%% confidence interval) in state (%d): %s%d_%d.png <br>\
-<img src=\"%s%d_%d.png\">",cpt,subdirf2(optionfilefiname,"v"),cpt,jj1,subdirf2(optionfilefiname,"v"),cpt,jj1);  
+prevalence (with 95%% confidence interval) in state (%d): %s%d_%d.svg <br>\
+<img src=\"%s%d_%d.svg\">",cpt,subdirf2(optionfilefiname,"v"),cpt,jj1,subdirf2(optionfilefiname,"v"),cpt,jj1);  
      }
      fprintf(fichtm,"\n<br>- Total life expectancy by age and \
 health expectancies in states (1) and (2). If popbased=1 the smooth (due to the model) \
 true period expectancies (those weighted with period prevalences are also\
  drawn in addition to the population based expectancies computed using\
- observed and cahotic prevalences: %s%d.png<br>\
-<img src=\"%s%d.png\">",subdirf2(optionfilefiname,"e"),jj1,subdirf2(optionfilefiname,"e"),jj1);
+ observed and cahotic prevalences: %s%d.svg<br>\
+<img src=\"%s%d.svg\">",subdirf2(optionfilefiname,"e"),jj1,subdirf2(optionfilefiname,"e"),jj1);
    /* } /\* end i1 *\/ */
  }/* End k1 */
  fprintf(fichtm,"</ul>");
@@ -4659,11 +4663,11 @@ void printinggnuplot(char fileres[], char optionfilefiname[], double ageminpar,
   fprintf(ficgp,"\n# 1st: Period (stable) prevalence with CI: 'vpl' files\n");
   for (cpt=1; cpt<= nlstate ; cpt ++) {
     for (k1=1; k1<= m ; k1 ++) { /* plot [100000000000000000000:-100000000000000000000] "mysbiaspar/vplrmysbiaspar.txt to check */
-     fprintf(ficgp,"\nset out \"%s%d_%d.png\" \n",subdirf2(optionfilefiname,"v"),cpt,k1);
-     fprintf(ficgp,"\n#set out \"v%s%d_%d.png\" \n",optionfilefiname,cpt,k1);
+     fprintf(ficgp,"\nset out \"%s%d_%d.svg\" \n",subdirf2(optionfilefiname,"v"),cpt,k1);
+     fprintf(ficgp,"\n#set out \"v%s%d_%d.svg\" \n",optionfilefiname,cpt,k1);
      fprintf(ficgp,"set xlabel \"Age\" \n\
 set ylabel \"Probability\" \n\
-set ter png small size 320, 240\n\
+set ter svg size 640, 480\n\
 plot [%.f:%.f] \"%s\" every :::%d::%d u 1:2 \"%%lf",ageminpar,fage,subdirf2(fileres,"vpl"),k1-1,k1-1);
 
      for (i=1; i<= nlstate ; i ++) {
@@ -4686,8 +4690,8 @@ plot [%.f:%.f] \"%s\" every :::%d::%d u 1:2 \"%%lf",ageminpar,fage,subdirf2(file
   /*2 eme*/
   fprintf(ficgp,"\n# 2nd: Total life expectancy with CI: 't' files\n");
   for (k1=1; k1<= m ; k1 ++) { 
-    fprintf(ficgp,"\nset out \"%s%d.png\" \n",subdirf2(optionfilefiname,"e"),k1);
-    fprintf(ficgp,"set ylabel \"Years\" \nset ter png small size 320, 240\nplot [%.f:%.f] ",ageminpar,fage);
+    fprintf(ficgp,"\nset out \"%s%d.svg\" \n",subdirf2(optionfilefiname,"e"),k1);
+    fprintf(ficgp,"set ylabel \"Years\" \nset ter svg size 640, 480\nplot [%.f:%.f] ",ageminpar,fage);
     
     for (i=1; i<= nlstate+1 ; i ++) {
       k=2*i;
@@ -4720,8 +4724,8 @@ plot [%.f:%.f] \"%s\" every :::%d::%d u 1:2 \"%%lf",ageminpar,fage,subdirf2(file
     for (cpt=1; cpt<= nlstate ; cpt ++) {
       /*       k=2+nlstate*(2*cpt-2); */
       k=2+(nlstate+1)*(cpt-1);
-      fprintf(ficgp,"\nset out \"%s%d%d.png\" \n",subdirf2(optionfilefiname,"exp"),cpt,k1);
-      fprintf(ficgp,"set ter png small size 320, 240\n\
+      fprintf(ficgp,"\nset out \"%s%d%d.svg\" \n",subdirf2(optionfilefiname,"exp"),cpt,k1);
+      fprintf(ficgp,"set ter svg size 640, 480\n\
 plot [%.f:%.f] \"%s\" every :::%d::%d u 1:%d t \"e%d1\" w l",ageminpar,fage,subdirf2(fileres,"e"),k1-1,k1-1,k,cpt);
       /*fprintf(ficgp,",\"e%s\" every :::%d::%d u 1:($%d-2*$%d) \"\%%lf ",fileres,k1-1,k1-1,k,k+1);
        for (i=1; i<= nlstate*2 ; i ++) fprintf(ficgp,"\%%lf (\%%lf) ");
@@ -4745,9 +4749,9 @@ plot [%.f:%.f] \"%s\" every :::%d::%d u 1:%d t \"e%d1\" w l",ageminpar,fage,subd
     for (cpt=1; cpt<=nlstate ; cpt ++) { /* For each life state */
       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);
+      fprintf(ficgp,"\nset out \"%s%d_%d.svg\" \n",subdirf2(optionfilefiname,"p"),cpt,k1);
       fprintf(ficgp,"set xlabel \"Age\" \nset ylabel \"Probability\" \n\
-set ter png small size 320, 240\n\
+set ter svg size 640, 480\n\
 unset log y\n\
 plot [%.f:%.f]  ", ageminpar, agemaxpar);
       for (i=1; i<= nlstate ; i ++){
@@ -4802,12 +4806,12 @@ plot [%.f:%.f]  ", ageminpar, agemaxpar);
      fprintf(ficgp,"#   jk=1 to 2^%d=%d\n",cptcoveff,m);
      for(jk=1; jk <=m; jk++) {
        fprintf(ficgp,"#    jk=%d\n",jk);
-       fprintf(ficgp,"\nset out \"%s%d_%d.png\" \n",subdirf2(optionfilefiname,"pe"),jk,ng); 
+       fprintf(ficgp,"\nset out \"%s%d_%d.svg\" \n",subdirf2(optionfilefiname,"pe"),jk,ng); 
        if (ng==2)
         fprintf(ficgp,"\nset ylabel \"Quasi-incidence per year\"\n");
        else
         fprintf(ficgp,"\nset title \"Probability\"\n");
-       fprintf(ficgp,"\nset ter png small size 320, 240\nset log y\nplot  [%.f:%.f] ",ageminpar,agemaxpar);
+       fprintf(ficgp,"\nset ter svg size 640, 480\nset log y\nplot  [%.f:%.f] ",ageminpar,agemaxpar);
        i=1;
        for(k2=1; k2<=nlstate; k2++) {
         k3=i;
@@ -5416,7 +5420,7 @@ void printinghtmlmort(char fileres[], char title[], char datafile[], int firstpa
   fprintf(fichtm,"  mu(age) =%lf*exp(%lf*(age-%d)) per year<br><br>",p[1],p[2],agegomp);
   for (i=1;i<=2;i++) 
     fprintf(fichtm," p[%d] = %lf [%f ; %f]<br>\n",i,p[i],p[i]-2*sqrt(matcov[i][i]),p[i]+2*sqrt(matcov[i][i]));
-  fprintf(fichtm,"<br><br><img src=\"graphmort.png\">");
+  fprintf(fichtm,"<br><br><img src=\"graphmort.svg\">");
   fprintf(fichtm,"</ul>");
 
 fprintf(fichtm,"<ul><li><h4>Life table</h4>\n <br>");
@@ -5445,9 +5449,9 @@ void printinggnuplotmort(char fileres[], char optionfilefiname[], double ageminp
 
   strcpy(dirfileres,optionfilefiname);
   strcpy(optfileres,"vpl");
-  fprintf(ficgp,"set out \"graphmort.png\"\n "); 
+  fprintf(ficgp,"set out \"graphmort.svg\"\n "); 
   fprintf(ficgp,"set xlabel \"Age\"\n set ylabel \"Force of mortality (per year)\" \n "); 
-  fprintf(ficgp, "set ter png small size 320, 240\n set log y\n"); 
+  fprintf(ficgp, "set ter svg size 640, 480\n set log y\n"); 
   /* fprintf(ficgp, "set size 0.65,0.65\n"); */
   fprintf(ficgp,"plot [%d:100] %lf*exp(%lf*(x-%d))",agegomp,p[1],p[2],agegomp);
 
@@ -6571,7 +6575,7 @@ int main(int argc, char *argv[])
       }
       strcpy(model,modeltemp); 
     }
-    printf(" model=1+age%s modeltemp= %s, model=%s\n",model, modeltemp, model);fflush(stdout);
+    /* printf(" model=1+age%s modeltemp= %s, model=%s\n",model, modeltemp, model);fflush(stdout); */
   }
   /* fscanf(ficpar,"title=%s datafile=%s lastobs=%d firstpass=%d lastpass=%d\nftol=%lf stepm=%d ncovcol=%d nlstate=%d ndeath=%d maxwav=%d mle=%d weight=%d model=1+age+%s\n",title, datafile, &lastobs, &firstpass,&lastpass,&ftol, &stepm, &ncovcol, &nlstate,&ndeath, &maxwav, &mle, &weightopt,model); */
   /* numlinepar=numlinepar+3; /\* In general *\/ */
@@ -7735,7 +7739,7 @@ Please run with mle=-1 to get a correct covariance matrix.\n",ageminpar,agemaxpa
 
 
        for(vpopbased=0; vpopbased <= popbased; vpopbased++){ /* Done for vpopbased=0 and vpopbased=1 if popbased==1*/
-         oldm=oldms;savm=savms; /* Segmentation fault */
+         oldm=oldms;savm=savms; /* ZZ Segmentation fault */
          cptcod= 0; /* To be deleted */
          varevsij(optionfilefiname, vareij, matcov, p, delti, nlstate, stepm, (int) bage, (int) fage, oldm, savm, prlim, ftolpl,k, estepm, cptcov,cptcod,vpopbased,mobilav, strstart); /* cptcod not initialized Intel */
          fprintf(ficrest,"# Total life expectancy with std error and decomposition into time to be expected in each health state\n#  (weighted average of eij where weights are ");
@@ -7746,10 +7750,10 @@ Please run with mle=-1 to get a correct covariance matrix.\n",ageminpar,agemaxpa
          fprintf(ficrest,"# Age e.. (std) ");
          for (i=1;i<=nlstate;i++) fprintf(ficrest,"e.%d (std) ",i);
          fprintf(ficrest,"\n");
-
+         /* printf("Which p?\n"); for(i=1;i<=npar;i++)printf("p[i=%d]=%lf,",i,p[i]);printf("\n"); */
          epj=vector(1,nlstate+1);
          for(age=bage; age <=fage ;age++){
-           prevalim(prlim, nlstate, p, age, oldm, savm,ftolpl,k);
+           prevalim(prlim, nlstate, p, age, oldm, savm,ftolpl,k); /*ZZ Is it the correct prevalim */
            if (vpopbased==1) {
              if(mobilav ==0){
                for(i=1; i<=nlstate;i++)
@@ -7761,13 +7765,16 @@ Please run with mle=-1 to get a correct covariance matrix.\n",ageminpar,agemaxpa
            }
        
            fprintf(ficrest," %4.0f",age);
+           /* printf(" age %4.0f ",age); */
            for(j=1, epj[nlstate+1]=0.;j <=nlstate;j++){
              for(i=1, epj[j]=0.;i <=nlstate;i++) {
                epj[j] += prlim[i][i]*eij[i][j][(int)age];
-               /*  printf("%lf %lf ", prlim[i][i] ,eij[i][j][(int)age]);*/
+               /*ZZZ  printf("%lf %lf ", prlim[i][i] ,eij[i][j][(int)age]);*/
+               /* printf("%lf %lf ", prlim[i][i] ,eij[i][j][(int)age]); */
              }
              epj[nlstate+1] +=epj[j];
            }
+           /* printf(" age %4.0f \n",age); */
 
            for(i=1, vepp=0.;i <=nlstate;i++)
              for(j=1;j <=nlstate;j++)