Diff for /imach/src/imach.c between versions 1.366 and 1.367

version 1.366, 2024/07/02 09:42:10 version 1.367, 2024/07/08 14:26:18
Line 1 Line 1
 /* $Id$  /* $Id$
   $State$    $State$
   $Log$    $Log$
     Revision 1.367  2024/07/08 14:26:18  brouard
     Summary: 0.99s7
   
     * imach.c (Module): Some bug fixes: in drawings when age*age is
     included in the model as well as with quantitative variables.
   
   Revision 1.366  2024/07/02 09:42:10  brouard    Revision 1.366  2024/07/02 09:42:10  brouard
   Summary: trying clang on Linux    Summary: trying clang on Linux
   
Line 10203  void printinggnuplot(char fileresu[], ch Line 10209  void printinggnuplot(char fileresu[], ch
         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 model=1+age+%s\" font \"Helvetica,12\"\n",cpt,gplotlabel,model);          fprintf(ficgp,"set title \"Alive state %d %s model=1+age+%s\" font \"Helvetica,12\"\n",cpt,gplotlabel,model);
         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] [0:1] \"%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*/
         for (i=1; i<= nlstate ; i ++) {          for (i=1; i<= nlstate ; i ++) {
Line 10768  set ter svg size 640, 480\nunset log y\n Line 10774  set ter svg size 640, 480\nunset log y\n
           }else{            }else{
             fprintf(ficgp,",\\\n '' ");              fprintf(ficgp,",\\\n '' ");
           }            }
           if(cptcoveff ==0){ /* No covariate */            /* if(cptcoveff ==0){ /\* No covariate *\/ */
             if(cptcovs ==0){ /* No covariate */
             ioffset=2; /* Age is in 2 */              ioffset=2; /* Age is in 2 */
             /*# yearproj age p11 p21 p31 p.1 p12 p22 p32 p.2 p13 p23 p33 p.3 p14 p24 p34 p.4*/              /*# yearproj age p11 p21 p31 p.1 p12 p22 p32 p.2 p13 p23 p33 p.3 p14 p24 p34 p.4*/
             /*#   1       2   3   4   5  6    7  8   9   10  11  12  13  14  15  16  17  18 */              /*#   1       2   3   4   5  6    7  8   9   10  11  12  13  14  15  16  17  18 */
             /*# V1  = 1 yearproj age p11 p21 p31 p.1 p12 p22 p32 p.2 p13 p23 p33 p.3 p14 p24 p34 p.4*/              /*# V1  = 1 yearproj age p11 p21 p31 p.1 p12 p22 p32 p.2 p13 p23 p33 p.3 p14 p24 p34 p.4*/
             /*#  1    2        3   4   5  6    7  8   9   10  11  12  13  14  15  16  17  18 */              /*#  1    2        3   4   5  6    7  8   9   10  11  12  13  14  15  16  17  18 */
               /*# V1  = 1 yearproj age age*p11 p21 p31 p.1 p12 p22 p32 p.2 p13 p23 p33 p.3 p14 p24 p34 p.4*/
               /*#  1    2        3   4   5  6    7  8   9   10  11  12  13  14  15  16  17  18 */
             fprintf(ficgp," u %d:(", ioffset);               fprintf(ficgp," u %d:(", ioffset); 
             if(i==nlstate+1){              if(i==nlstate+1){
               fprintf(ficgp," $%d/(1.-$%d)):1 t 'pw.%d' with line lc variable ",        \                fprintf(ficgp," $%d/(1.-$%d)):1 t 'pw.%d' with line lc variable ",        \
Line 10787  set ter svg size 640, 480\nunset log y\n Line 10796  set ter svg size 640, 480\nunset log y\n
               fprintf(ficgp," $%d/(1.-$%d)) t 'p%d%d' with line ",      \                fprintf(ficgp," $%d/(1.-$%d)) t 'p%d%d' with line ",      \
                       ioffset+(cpt-1)*(nlstate+1)+1+(i-1),  ioffset+1+(i-1)+(nlstate+1)*nlstate,i,cpt );                        ioffset+(cpt-1)*(nlstate+1)+1+(i-1),  ioffset+1+(i-1)+(nlstate+1)*nlstate,i,cpt );
           }else{ /* more than 2 covariates */            }else{ /* more than 2 covariates */
             ioffset=2*cptcoveff+2; /* Age is in 4 or 6 or etc.*/              /* ioffset=2*cptcoveff+2; */ /* Age is in 4 or 6 or etc.*/
               ioffset=2*cptcovs+2; /* Age is in 4 or 6 or etc.*/
             /*#  V1  = 1  V2 =  0 yearproj age p11 p21 p.1 p12 p22 p.2 p13 p23 p.3*/              /*#  V1  = 1  V2 =  0 yearproj age p11 p21 p.1 p12 p22 p.2 p13 p23 p.3*/
             /*#   1    2   3    4    5      6  7   8   9   10   11 12  13   14  15 */              /*#   1    2   3    4    5      6  7   8   9   10   11 12  13   14  15 */
               /* # Forecasting at date 3/1/2003  */
               /* V1=0 V2=1 V3=0 V6=2.47 yearproj age */       
               /* # 2 3 4 5 6 7  8    9   10   11    12     13    14   15     16    17    18    19   20    21    22     23    24   25    26 */
               /* #                             p11  p21    p31   wp.1 p12    p22   p32   wp.2  p13   p23  p33  wp.3    p14   p24   p34  wp.4 */
               /* 1 0 2 1 3 0 6 2.47 2003 100  1.000 0.000 0.000 0.297 0.000 1.000 0.000 0.207 0.000 0.000 1.000 0.497 0.000 0.000 0.000 0.000 */
             iyearc=ioffset-1;              iyearc=ioffset-1;
             iagec=ioffset;              iagec=ioffset;
             fprintf(ficgp," u %d:(",ioffset);               fprintf(ficgp," u %d:(",ioffset); 
Line 10906  set ter svg size 640, 480\nunset log y\n Line 10921  set ter svg size 640, 480\nunset log y\n
             /*#  1    2        3   4   5  6    7  8   9   10  11  12  13  14  15  16  17  18 */              /*#  1    2        3   4   5  6    7  8   9   10  11  12  13  14  15  16  17  18 */
             fprintf(ficgp," u %d:(", ioffset);               fprintf(ficgp," u %d:(", ioffset); 
             if(i==nlstate+1){              if(i==nlstate+1){
               fprintf(ficgp," $%d/(1.-$%d)):1 t 'bw%d' with line lc variable ", \                fprintf(ficgp," $%d):1 t 'bw%d' with line lc variable ",  \
                       ioffset+(cpt-1)*(nlstate+1)+1+(i-1),  ioffset+1+(i-1)+(nlstate+1)*nlstate,cpt );                        ioffset+(cpt-1)*(nlstate+1)+1+(i-1),cpt );
                 /* fprintf(ficgp," $%d/(1.-$%d)):1 t 'bw%d' with line lc variable ",      \ */
                 /*              ioffset+(cpt-1)*(nlstate+1)+1+(i-1),  ioffset+1+(i-1)+(nlstate+1)*nlstate,cpt ); */
               fprintf(ficgp,",\\\n '' ");                fprintf(ficgp,",\\\n '' ");
               fprintf(ficgp," u %d:(",ioffset);                 fprintf(ficgp," u %d:(",ioffset); 
               fprintf(ficgp," (($1-$2) == %d ) ? $%d : 1/0):1 with labels center not ", \                fprintf(ficgp," (($1-$2) == %d ) ? $%d : 1/0):1 with labels center not ", \
                      offbyear,                          \                       offbyear,                          \
                       ioffset+(cpt-1)*(nlstate+1)+1+(i-1) );                        ioffset+(cpt-1)*(nlstate+1)+1+(i-1) );
             }else              }else  /* not sure divided by 1- to be checked */
               fprintf(ficgp," $%d/(1.-$%d)) t 'b%d%d' with line ",      \                fprintf(ficgp," $%d) t 'b%d%d' with line ",       \
                       ioffset+(cpt-1)*(nlstate+1)+1+(i-1),  ioffset+1+(i-1)+(nlstate+1)*nlstate,cpt,i );                        ioffset+(cpt-1)*(nlstate+1)+1+(i-1),cpt,i );
                 /* fprintf(ficgp," $%d/(1.-$%d)) t 'b%d%d' with line ",   \ */
                 /*              ioffset+(cpt-1)*(nlstate+1)+1+(i-1),  ioffset+1+(i-1)+(nlstate+1)*nlstate,cpt,i ); */
           }else{ /* more than 2 covariates */            }else{ /* more than 2 covariates */
             ioffset=2*cptcoveff+2; /* Age is in 4 or 6 or etc.*/              /* ioffset=2*cptcoveff+2; /\* Age is in 4 or 6 or etc.*\/ */
               ioffset=2*cptcovs+2; /* Age is in 4 or 6 or etc.*/
             /*#  V1  = 1  V2 =  0 yearproj age p11 p21 p.1 p12 p22 p.2 p13 p23 p.3*/              /*#  V1  = 1  V2 =  0 yearproj age p11 p21 p.1 p12 p22 p.2 p13 p23 p.3*/
             /*#   1    2   3    4    5      6  7   8   9   10   11 12  13   14  15 */              /*#   1    2   3    4    5      6  7   8   9   10   11 12  13   14  15 */
   /* #****** hbijx=probability over h years, hb.jx is weighted by observed prev  */
   /* # V1=0  V2=1  V3=0  V6=2.47 */
   /*              yearbproj age b11     b21    b31   b.1   b12  b22  b32    b.2   b13   b23   b33   b.3   b14   b24   b34    b.4 */
   /* # Back Forecasting at date 3/1/2003  */
   /* 1 2 3 4 5 6 7   8    9  10  11     12     13    14    15   16    17    18    19    20    21     22    23   24    25    26   */           
   /* 1 0 2 1 3 0 6 2.47 2003 50  1.000 0.000 0.000 0.714 0.000 1.000 0.000 0.286 0.000 0.000 1.000 0.000 0.000 0.000 0.000 0.000 */
             iyearc=ioffset-1;              iyearc=ioffset-1;
             iagec=ioffset;              iagec=ioffset;
             fprintf(ficgp," u %d:(",ioffset);               fprintf(ficgp," u %d:(",ioffset); 
             kl=0;              kl=0;
             strcpy(gplotcondition,"(");              strcpy(gplotcondition,"(");
             for (k=1; k<=cptcovs; k++){    /* For each covariate k of the resultline, get corresponding value lv for combination k1 */              for (k=1; k<=cptcovs; k++){    /* For each covariate k of the resultline, get corresponding value lv for combination k1 */
               if(Dummy[modelresult[nres][k]]==0){  /* To be verified */                /* if(Dummy[modelresult[nres][k]]==0){  /\* To be verified *\/ */
                 /* for (k=1; k<=cptcoveff; k++){    /\* For each covariate writing the chain of conditions *\/ */                  /* for (k=1; k<=cptcoveff; k++){    /\* For each covariate writing the chain of conditions *\/ */
                 /* lv= decodtabm(k1,k,cptcoveff); /\* Should be the covariate value corresponding to combination k1 and covariate k *\/ */                  /* lv= decodtabm(k1,k,cptcoveff); /\* Should be the covariate value corresponding to combination k1 and covariate k *\/ */
                 /* lv= codtabm(k1,TnsdVar[Tvaraff[k]]); /\* Should be the covariate value corresponding to combination k1 and covariate k *\/ */                  /* lv= codtabm(k1,TnsdVar[Tvaraff[k]]); /\* Should be the covariate value corresponding to combination k1 and covariate k *\/ */
Line 10943  set ter svg size 640, 480\nunset log y\n Line 10969  set ter svg size 640, 480\nunset log y\n
                 kl++;                  kl++;
                 if(k <cptcovs && cptcovs>1)                  if(k <cptcovs && cptcovs>1)
                   sprintf(gplotcondition+strlen(gplotcondition)," && ");                    sprintf(gplotcondition+strlen(gplotcondition)," && ");
               }                  /* } */ /* end dummy */
             }              }
             strcpy(gplotcondition+strlen(gplotcondition),")");              strcpy(gplotcondition+strlen(gplotcondition),")");
             /* kl=6+(cpt-1)*(nlstate+1)+1+(i-1); /\* 6+(1-1)*(2+1)+1+(1-1)=7, 6+(2-1)(2+1)+1+(1-1)=10 *\/ */              /* kl=6+(cpt-1)*(nlstate+1)+1+(i-1); /\* 6+(1-1)*(2+1)+1+(1-1)=7, 6+(2-1)(2+1)+1+(1-1)=10 *\/ */

Removed from v.1.366  
changed lines
  Added in v.1.367


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