Diff for /imach/src/imach.c between versions 1.275 and 1.276

version 1.275, 2017/06/30 13:39:33 version 1.276, 2017/06/30 15:48:31
Line 1 Line 1
 /* $Id$  /* $Id$
   $State$    $State$
   $Log$    $Log$
     Revision 1.276  2017/06/30 15:48:31  brouard
     Summary: Graphs improvements
   
   Revision 1.275  2017/06/30 13:39:33  brouard    Revision 1.275  2017/06/30 13:39:33  brouard
   Summary: Saito's color    Summary: Saito's color
   
Line 7052  void printinggnuplot(char fileresu[], ch Line 7055  void printinggnuplot(char fileresu[], ch
               
         fprintf(ficgp,"\nset out \"%s_%d-%d-%d.svg\" \n",subdirf2(optionfilefiname,"V_"),cpt,k1,nres);          fprintf(ficgp,"\nset out \"%s_%d-%d-%d.svg\" \n",subdirf2(optionfilefiname,"V_"),cpt,k1,nres);
         fprintf(ficgp,"\n#set out \"V_%s_%d-%d-%d.svg\" \n",optionfilefiname,cpt,k1,nres);          fprintf(ficgp,"\n#set out \"V_%s_%d-%d-%d.svg\" \n",optionfilefiname,cpt,k1,nres);
         fprintf(ficgp,"set label \"Alive state %d %s\" at graph 0.98,0.5 center rotate font \"Helvetica,12\"\n",cpt,gplotlabel);          /* fprintf(ficgp,"set label \"Alive state %d %s\" at graph 0.98,0.5 center rotate font \"Helvetica,12\"\n",cpt,gplotlabel); */
           fprintf(ficgp,"set title \"Alive state %d %s\" font \"Helvetica,12\"\n",cpt,gplotlabel);
         fprintf(ficgp,"set xlabel \"Age\" \nset ylabel \"Probability\" \nset ter svg size 640, 480\nplot [%.f:%.f] \"%s\" every :::%d::%d u 1:($2==%d ? $3:1/0) \"%%lf %%lf",ageminpar,fage,subdirf2(fileresu,"VPL_"),nres-1,nres-1,nres);          fprintf(ficgp,"set xlabel \"Age\" \nset ylabel \"Probability\" \nset ter svg size 640, 480\nplot [%.f:%.f] \"%s\" every :::%d::%d u 1:($2==%d ? $3:1/0) \"%%lf %%lf",ageminpar,fage,subdirf2(fileresu,"VPL_"),nres-1,nres-1,nres);
         /* fprintf(ficgp,"set xlabel \"Age\" \nset ylabel \"Probability\" \nset ter svg size 640, 480\nplot [%.f:%.f] \"%s\" every :::%d::%d u 1:($2==%d ? $3:1/0) \"%%lf %%lf",ageminpar,fage,subdirf2(fileresu,"VPL_"),k1-1,k1-1,nres); */          /* fprintf(ficgp,"set xlabel \"Age\" \nset ylabel \"Probability\" \nset ter svg size 640, 480\nplot [%.f:%.f] \"%s\" every :::%d::%d u 1:($2==%d ? $3:1/0) \"%%lf %%lf",ageminpar,fage,subdirf2(fileresu,"VPL_"),k1-1,k1-1,nres); */
       /* k1-1 error should be nres-1*/        /* k1-1 error should be nres-1*/
Line 7137  void printinggnuplot(char fileresu[], ch Line 7141  void printinggnuplot(char fileresu[], ch
               if (i==cpt) fprintf(ficgp," %%lf (%%lf)");                if (i==cpt) fprintf(ficgp," %%lf (%%lf)");
               else fprintf(ficgp," %%*lf (%%*lf)");                else fprintf(ficgp," %%*lf (%%*lf)");
             }               } 
             fprintf(ficgp,"\" t\"95%% CI\" w l lt 5,\"%s\" every :::%d::%d u 1:($2==%d ? $3-1.96*$4 : 1/0) \"%%lf %%lf",subdirf2(fileresu,"VBL_"),nres-1,nres-1,nres);               fprintf(ficgp,"\" t\"95%% CI\" w l lt 4,\"%s\" every :::%d::%d u 1:($2==%d ? $3-1.96*$4 : 1/0) \"%%lf %%lf",subdirf2(fileresu,"VBL_"),nres-1,nres-1,nres); 
             for (i=1; i<= nlstate ; i ++) {              for (i=1; i<= nlstate ; i ++) {
               if (i==cpt) fprintf(ficgp," %%lf (%%lf)");                if (i==cpt) fprintf(ficgp," %%lf (%%lf)");
               else fprintf(ficgp," %%*lf (%%*lf)");                else fprintf(ficgp," %%*lf (%%*lf)");
Line 7145  void printinggnuplot(char fileresu[], ch Line 7149  void printinggnuplot(char fileresu[], ch
             fprintf(ficgp,"\" t\"\" w l lt 4");              fprintf(ficgp,"\" t\"\" w l lt 4");
           } /* end if backprojcast */            } /* end if backprojcast */
         } /* end if backcast */          } /* end if backcast */
         fprintf(ficgp,"\nset out ;unset label;\n");          /* fprintf(ficgp,"\nset out ;unset label;\n"); */
           fprintf(ficgp,"\nset out ;unset title;\n");
       } /* nres */        } /* nres */
     } /* k1 */      } /* k1 */
   } /* cpt */    } /* cpt */
Line 7759  set ter svg size 640, 480\nunset log y\n Line 7764  set ter svg size 640, 480\nunset log y\n
         continue;          continue;
       fprintf(ficgp,"\n\n# Combination of dummy  k1=%d which is ",k1);        fprintf(ficgp,"\n\n# Combination of dummy  k1=%d which is ",k1);
       strcpy(gplotlabel,"(");        strcpy(gplotlabel,"(");
       sprintf(gplotlabel+strlen(gplotlabel)," Dummy combination %d ",k1);        /*sprintf(gplotlabel+strlen(gplotlabel)," Dummy combination %d ",k1);*/
       for (k=1; k<=cptcoveff; k++){    /* For each correspondig covariate value  */        for (k=1; k<=cptcoveff; k++){    /* For each correspondig covariate value  */
         lv= decodtabm(k1,k,cptcoveff); /* Should be the covariate value corresponding to k1 combination and kth covariate */          lv= decodtabm(k1,k,cptcoveff); /* Should be the covariate value corresponding to k1 combination and kth covariate */
         /* decodtabm(1,1,4) = 1 because h=1  k= (1) 1  1  1 */          /* decodtabm(1,1,4) = 1 because h=1  k= (1) 1  1  1 */
Line 7776  set ter svg size 640, 480\nunset log y\n Line 7781  set ter svg size 640, 480\nunset log y\n
       strcpy(gplotlabel+strlen(gplotlabel),")");        strcpy(gplotlabel+strlen(gplotlabel),")");
       fprintf(ficgp,"\n#\n");        fprintf(ficgp,"\n#\n");
       fprintf(ficgp,"\nset out \"%s_%d-%d-%d.svg\" ",subdirf2(optionfilefiname,"PE_"),k1,ng,nres);        fprintf(ficgp,"\nset out \"%s_%d-%d-%d.svg\" ",subdirf2(optionfilefiname,"PE_"),k1,ng,nres);
       fprintf(ficgp,"\nset label \"%s\" at graph 0.98,0.5 center rotate font \"Helvetica,12\"\n",gplotlabel);        fprintf(ficgp,"\nset key outside ");
         /* fprintf(ficgp,"\nset label \"%s\" at graph 1.2,0.5 center rotate font \"Helvetica,12\"\n",gplotlabel); */
         fprintf(ficgp,"\nset title \"%s\" font \"Helvetica,12\"\n",gplotlabel);
       fprintf(ficgp,"\nset ter svg size 640, 480 ");        fprintf(ficgp,"\nset ter svg size 640, 480 ");
       if (ng==1){        if (ng==1){
         fprintf(ficgp,"\nset ylabel \"Value of the logit of the model\"\n"); /* exp(a12+b12*x) could be nice */          fprintf(ficgp,"\nset ylabel \"Value of the logit of the model\"\n"); /* exp(a12+b12*x) could be nice */
Line 7896  set ter svg size 640, 480\nunset log y\n Line 7903  set ter svg size 640, 480\nunset log y\n
             }              }
             fprintf(ficgp,")");              fprintf(ficgp,")");
             if(ng ==2)              if(ng ==2)
               fprintf(ficgp," w l lt (%d*%d+%d)%%%d+1 dt %d t \"p%d%d\" ", nlstate+ndeath, k2, k, nlstate+ndeath, k2, k2,k);                fprintf(ficgp," w l lw 2 lt (%d*%d+%d)%%%d+1 dt %d t \"p%d%d\" ", nlstate+ndeath, k2, k, nlstate+ndeath, k2, k2,k);
             else /* ng= 3 */              else /* ng= 3 */
               fprintf(ficgp," w l lt (%d*%d+%d)%%%d+1 dt %d t \"i%d%d\" ",  nlstate+ndeath, k2, k, nlstate+ndeath, k2, k2,k);                fprintf(ficgp," w l lw 2 lt (%d*%d+%d)%%%d+1 dt %d t \"i%d%d\" ",  nlstate+ndeath, k2, k, nlstate+ndeath, k2, k2,k);
           }else{ /* end ng <> 1 */            }else{ /* end ng <> 1 */
             if( k !=k2) /* logit p11 is hard to draw */              if( k !=k2) /* logit p11 is hard to draw */
               fprintf(ficgp," w l lt (%d*%d+%d)%%%d+1 dt %d t \"logit(p%d%d)\" ",  nlstate+ndeath, k2, k, nlstate+ndeath, k2, k2,k);                fprintf(ficgp," w l lw 2 lt (%d*%d+%d)%%%d+1 dt %d t \"logit(p%d%d)\" ",  nlstate+ndeath, k2, k, nlstate+ndeath, k2, k2,k);
           }            }
           if ((k+k2)!= (nlstate*2+ndeath) && ng != 1)            if ((k+k2)!= (nlstate*2+ndeath) && ng != 1)
             fprintf(ficgp,",");              fprintf(ficgp,",");
Line 7910  set ter svg size 640, 480\nunset log y\n Line 7917  set ter svg size 640, 480\nunset log y\n
           i=i+ncovmodel;            i=i+ncovmodel;
         } /* end k */          } /* end k */
       } /* end k2 */        } /* end k2 */
       fprintf(ficgp,"\n set out; unset label;\n");        /* fprintf(ficgp,"\n set out; unset label;set key default;\n"); */
         fprintf(ficgp,"\n set out; unset title;set key default;\n");
     } /* end k1 */      } /* end k1 */
   } /* end ng */    } /* end ng */
   /* avoid: */    /* avoid: */

Removed from v.1.275  
changed lines
  Added in v.1.276


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>