Diff for /imach/src/imach.c between versions 1.95 and 1.96

version 1.95, 2003/07/08 07:54:34 version 1.96, 2003/07/15 15:38:55
Line 1 Line 1
 /* $Id$  /* $Id$
   $State$    $State$
   $Log$    $Log$
     Revision 1.96  2003/07/15 15:38:55  brouard
     * imach.c (Repository): Errors in subdirf, 2, 3 while printing tmpout is
     rewritten within the same printf. Workaround: many printfs.
   
   Revision 1.95  2003/07/08 07:54:34  brouard    Revision 1.95  2003/07/08 07:54:34  brouard
   * imach.c (Repository):    * imach.c (Repository):
   (Repository): Using imachwizard code to output a more meaningful covariance    (Repository): Using imachwizard code to output a more meaningful covariance
Line 204 Line 208
 /* $Id$ */  /* $Id$ */
 /* $State$ */  /* $State$ */
   
 char version[]="Imach version 0.96b, June 2003, INED-EUROREVES ";  char version[]="Imach version 0.96c, July 2003, INED-EUROREVES ";
 char fullversion[]="$Revision$ $Date$";   char fullversion[]="$Revision$ $Date$"; 
 int erreur, nberr=0, nbwarn=0; /* Error number, number of errors number of warnings  */  int erreur, nberr=0, nbwarn=0; /* Error number, number of errors number of warnings  */
 int nvar;  int nvar;
Line 248  char fileresvpl[FILENAMELENGTH]; Line 252  char fileresvpl[FILENAMELENGTH];
 char title[MAXLINE];  char title[MAXLINE];
 char optionfile[FILENAMELENGTH], datafile[FILENAMELENGTH],  filerespl[FILENAMELENGTH];  char optionfile[FILENAMELENGTH], datafile[FILENAMELENGTH],  filerespl[FILENAMELENGTH];
 char optionfilext[10], optionfilefiname[FILENAMELENGTH], plotcmd[FILENAMELENGTH];  char optionfilext[10], optionfilefiname[FILENAMELENGTH], plotcmd[FILENAMELENGTH];
 char tmpout[FILENAMELENGTH];   char tmpout[FILENAMELENGTH],  tmpout2[FILENAMELENGTH]; 
 char command[FILENAMELENGTH];  char command[FILENAMELENGTH];
 int  outcmd=0;  int  outcmd=0;
   
Line 2887  To be simple, these graphs help to under Line 2891  To be simple, these graphs help to under
         fprintf(ficgp, "**********\n#\n");          fprintf(ficgp, "**********\n#\n");
                   
                   
         fprintf(fichtm, "\n<hr  size=\"2\" color=\"#EC5E5E\">********** Variable ");           fprintf(fichtmcov, "\n<hr  size=\"2\" color=\"#EC5E5E\">********** Variable "); 
         for (z1=1; z1<=cptcoveff; z1++) fprintf(fichtm, "V%d=%d ",Tvaraff[z1],nbcode[Tvaraff[z1]][codtab[j1][z1]]);          for (z1=1; z1<=cptcoveff; z1++) fprintf(fichtm, "V%d=%d ",Tvaraff[z1],nbcode[Tvaraff[z1]][codtab[j1][z1]]);
         fprintf(fichtm, "**********\n<hr size=\"2\" color=\"#EC5E5E\">");          fprintf(fichtmcov, "**********\n<hr size=\"2\" color=\"#EC5E5E\">");
                   
         fprintf(ficresprobcor, "\n#********** Variable ");              fprintf(ficresprobcor, "\n#********** Variable ");    
         for (z1=1; z1<=cptcoveff; z1++) fprintf(ficresprobcor, "V%d=%d ",Tvaraff[z1],nbcode[Tvaraff[z1]][codtab[j1][z1]]);          for (z1=1; z1<=cptcoveff; z1++) fprintf(ficresprobcor, "V%d=%d ",Tvaraff[z1],nbcode[Tvaraff[z1]][codtab[j1][z1]]);
Line 3098  void printinghtml(char fileres[], char t Line 3102  void printinghtml(char fileres[], char t
                   double jprev1, double mprev1,double anprev1, \                    double jprev1, double mprev1,double anprev1, \
                   double jprev2, double mprev2,double anprev2){                    double jprev2, double mprev2,double anprev2){
   int jj1, k1, i1, cpt;    int jj1, k1, i1, cpt;
   /*char optionfilehtm[FILENAMELENGTH];*/  
 /*   if((fichtm=fopen(optionfilehtm,"a"))==NULL)    { */  
 /*     printf("Problem with %s \n",optionfilehtm), exit(0); */  
 /*     fprintf(ficlog,"Problem with %s \n",optionfilehtm), exit(0); */  
 /*   } */  
   
    fprintf(fichtm,"<ul><li><h4>Result files (first order: no variance)</h4>\n \     fprintf(fichtm,"<ul><li><h4>Result files (first order: no variance)</h4>\n \
  - Observed prevalence in each state (during the period defined between %.lf/%.lf/%.lf and %.lf/%.lf/%.lf): <a href=\"%s\">%s</a> <br>\n \   - Observed prevalence in each state (during the period defined between %.lf/%.lf/%.lf and %.lf/%.lf/%.lf): <a href=\"%s\">%s</a> <br>\n ",
  - Estimated transition probabilities over %d (stepm) months: <a href=\"%s\">%s</a><br>\n \             jprev1, mprev1,anprev1,jprev2, mprev2,anprev2,subdirf2(fileres,"p"),subdirf2(fileres,"p"));
  - Stable prevalence in each health state: <a href=\"%s\">%s</a> <br>\n \     fprintf(fichtm,"\
    - Estimated transition probabilities over %d (stepm) months: <a href=\"%s\">%s</a><br>\n ",
              stepm,subdirf2(fileres,"pij"),subdirf2(fileres,"pij"));
      fprintf(fichtm,"\
    - Stable prevalence in each health state: <a href=\"%s\">%s</a> <br>\n",
              subdirf2(fileres,"pl"),subdirf2(fileres,"pl"));
      fprintf(fichtm,"\
  - Life expectancies by age and initial health status (estepm=%2d months): \   - Life expectancies by age and initial health status (estepm=%2d months): \
    <a href=\"%s\">%s</a> <br>\n</li>", \     <a href=\"%s\">%s</a> <br>\n</li>",
            jprev1, mprev1,anprev1,jprev2, mprev2,anprev2,subdirf2(fileres,"p"),subdirf2(fileres,"p"),\  
            stepm,subdirf2(fileres,"pij"),subdirf2(fileres,"pij"),\  
            subdirf2(fileres,"pl"),subdirf2(fileres,"pl"),\  
            estepm,subdirf2(fileres,"e"),subdirf2(fileres,"e"));             estepm,subdirf2(fileres,"e"),subdirf2(fileres,"e"));
   
 fprintf(fichtm," \n<ul><li><b>Graphs</b></li><p>");  fprintf(fichtm," \n<ul><li><b>Graphs</b></li><p>");
Line 3146  fprintf(fichtm," \n<ul><li><b>Graphs</b> Line 3148  fprintf(fichtm," \n<ul><li><b>Graphs</b>
         fprintf(fichtm,"\n<br>- Health life expectancies by age and initial health state (%d): %s%d%d.png <br> \          fprintf(fichtm,"\n<br>- Health life expectancies by age and initial health state (%d): %s%d%d.png <br> \
 <img src=\"%s%d%d.png\">",cpt,subdirf2(optionfilefiname,"exp"),cpt,jj1,subdirf2(optionfilefiname,"exp"),cpt,jj1);  <img src=\"%s%d%d.png\">",cpt,subdirf2(optionfilefiname,"exp"),cpt,jj1,subdirf2(optionfilefiname,"exp"),cpt,jj1);
      }       }
      fprintf(fichtm,"\n<br>- Total life expectancy by age and \  
 health expectancies in states (1) and (2): %s%d.png<br>\  
 <img src=\"%s%d.png\">",subdirf2(optionfilefiname,"e"),jj1,subdirf2(optionfilefiname,"e"),jj1);  
    } /* end i1 */     } /* end i1 */
  }/* End k1 */   }/* End k1 */
  fprintf(fichtm,"</ul>");   fprintf(fichtm,"</ul>");
   
   
  fprintf(fichtm,"\n<br><li><h4> Result files (second order: variances)</h4>\n\   fprintf(fichtm,"\
  - Parameter file with estimated parameters and covariance matrix: <a href=\"%s\">%s</a> <br>\n\  \n<br><li><h4> Result files (second order: variances)</h4>\n\
  - Variance of one-step probabilities: <a href=\"%s\">%s</a> <br>\n\   - Parameter file with estimated parameters and covariance matrix: <a href=\"%s\">%s</a> <br>\n", rfileres,rfileres);
  - Variance-covariance of one-step probabilities: <a href=\"%s\">%s</a> <br>\n\  
  - Correlation matrix of one-step probabilities: <a href=\"%s\">%s</a> <br>\n\   fprintf(fichtm," - Variance of one-step probabilities: <a href=\"%s\">%s</a> <br>\n",
  - Variances and covariances of life expectancies by age and initial health status (estepm=%d months): <a href=\"%s\">%s</a><br>\n\           subdirf2(fileres,"prob"),subdirf2(fileres,"prob"));
  - Health expectancies with their variances (no covariance): <a href=\"%s\">%s</a> <br>\n\   fprintf(fichtm,"\
    - Variance-covariance of one-step probabilities: <a href=\"%s\">%s</a> <br>\n",
            subdirf2(fileres,"probcov"),subdirf2(fileres,"probcov"));
   
    fprintf(fichtm,"\
    - Correlation matrix of one-step probabilities: <a href=\"%s\">%s</a> <br>\n",
            subdirf2(fileres,"probcor"),subdirf2(fileres,"probcor"));
    fprintf(fichtm,"\
    - Variances and covariances of life expectancies by age and initial health status (estepm=%d months): <a href=\"%s\">%s</a><br>\n",
            estepm, subdirf2(fileres,"v"),subdirf2(fileres,"v"));
    fprintf(fichtm,"\
    - Health expectancies with their variances (no covariance): <a href=\"%s\">%s</a> <br>\n",
            subdirf2(fileres,"t"),subdirf2(fileres,"t"));
    fprintf(fichtm,"\
  - Standard deviation of stable prevalences: <a href=\"%s\">%s</a> <br>\n",\   - Standard deviation of stable prevalences: <a href=\"%s\">%s</a> <br>\n",\
          rfileres,rfileres,\  
          subdirf2(fileres,"prob"),subdirf2(fileres,"prob"),\  
          subdirf2(fileres,"probcov"),subdirf2(fileres,"probcov"),\  
          subdirf2(fileres,"probcor"),subdirf2(fileres,"probcor"),\  
          estepm, subdirf2(fileres,"v"),subdirf2(fileres,"v"),\  
          subdirf2(fileres,"t"),subdirf2(fileres,"t"),\  
          subdirf2(fileres,"vpl"),subdirf2(fileres,"vpl"));           subdirf2(fileres,"vpl"),subdirf2(fileres,"vpl"));
   
 /*  if(popforecast==1) fprintf(fichtm,"\n */  /*  if(popforecast==1) fprintf(fichtm,"\n */
Line 3176  health expectancies in states (1) and (2 Line 3182  health expectancies in states (1) and (2
 /*      <br>",fileres,fileres,fileres,fileres); */  /*      <br>",fileres,fileres,fileres,fileres); */
 /*  else  */  /*  else  */
 /*    fprintf(fichtm,"\n No population forecast: popforecast = %d (instead of 1) or stepm = %d (instead of 1) or model=%s (instead of .)<br><br></li>\n",popforecast, stepm, model); */  /*    fprintf(fichtm,"\n No population forecast: popforecast = %d (instead of 1) or stepm = %d (instead of 1) or model=%s (instead of .)<br><br></li>\n",popforecast, stepm, model); */
 fprintf(fichtm," <ul><li><b>Graphs</b></li><p>");   fflush(fichtm);
    fprintf(fichtm," <ul><li><b>Graphs</b></li><p>");
   
  m=cptcoveff;   m=cptcoveff;
  if (cptcovn < 1) {m=1;ncodemax[1]=1;}   if (cptcovn < 1) {m=1;ncodemax[1]=1;}
Line 3196  fprintf(fichtm," <ul><li><b>Graphs</b></ Line 3203  fprintf(fichtm," <ul><li><b>Graphs</b></
 prevalence (with 95%% confidence interval) in state (%d): %s%d%d.png <br>\  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);    <img src=\"%s%d%d.png\">",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): %s%d.png<br>\
   <img src=\"%s%d.png\">",subdirf2(optionfilefiname,"e"),jj1,subdirf2(optionfilefiname,"e"),jj1);
    } /* end i1 */     } /* end i1 */
  }/* End k1 */   }/* End k1 */
  fprintf(fichtm,"</ul>");   fprintf(fichtm,"</ul>");
Line 4967  Interval (in months) between two waves: Line 4977  Interval (in months) between two waves:
   fclose(ficrespij);    fclose(ficrespij);
   
   probs= ma3x(1,AGESUP,1,NCOVMAX, 1,NCOVMAX);    probs= ma3x(1,AGESUP,1,NCOVMAX, 1,NCOVMAX);
     for(i=1;i<=AGESUP;i++)
       for(j=1;j<=NCOVMAX;j++)
         for(k=1;k<=NCOVMAX;k++)
           probs[i][j][k]=0.;
   
   /*---------- Forecasting ------------------*/    /*---------- Forecasting ------------------*/
   /*if((stepm == 1) && (strcmp(model,".")==0)){*/    /*if((stepm == 1) && (strcmp(model,".")==0)){*/

Removed from v.1.95  
changed lines
  Added in v.1.96


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