Diff for /imach/src/imach.c between versions 1.192 and 1.193

version 1.192, 2015/07/16 16:49:02 version 1.193, 2015/08/04 07:17:42
Line 1 Line 1
 /* $Id$  /* $Id$
   $State$    $State$
   $Log$    $Log$
     Revision 1.193  2015/08/04 07:17:42  brouard
     Summary: 0.98q4
   
   Revision 1.192  2015/07/16 16:49:02  brouard    Revision 1.192  2015/07/16 16:49:02  brouard
   Summary: Fixing some outputs    Summary: Fixing some outputs
   
Line 696  typedef struct { Line 699  typedef struct {
 /* $Id$ */  /* $Id$ */
 /* $State$ */  /* $State$ */
   
 char version[]="Imach version 0.98q3, July 2015,INED-EUROREVES-Institut de longevite-Japan Society for the Promotion of Science (Grant-in-Aid for Scientific Research 25293121), Intel Software 2015";  char version[]="Imach version 0.98q4, July 2015,INED-EUROREVES-Institut de longevite-Japan Society for the Promotion of Science (Grant-in-Aid for Scientific Research 25293121), Intel Software 2015";
 char fullversion[]="$Revision$ $Date$";   char fullversion[]="$Revision$ $Date$"; 
 char strstart[80];  char strstart[80];
 char optionfilext[10], optionfilefiname[FILENAMELENGTH];  char optionfilext[10], optionfilefiname[FILENAMELENGTH];
Line 4536  fprintf(fichtm," \n<ul><li><b>Graphs</b> Line 4539  fprintf(fichtm," \n<ul><li><b>Graphs</b>
  }/* End k1 */   }/* End k1 */
  fprintf(fichtm,"</ul>");   fprintf(fichtm,"</ul>");
   
   
  fprintf(fichtm,"\   fprintf(fichtm,"\
 \n<br><li><h4> <a name='secondorder'>Result files (second order: variances)</a></h4>\n\  \n<br><li><h4> <a name='secondorder'>Result files (second order: variances)</a></h4>\n\
  - Parameter file with estimated parameters and covariance matrix: <a href=\"%s\">%s</a> <br>\n", rfileres,rfileres);   - Parameter file with estimated parameters and covariance matrix: <a href=\"%s\">%s</a> <br> \
    - 95%% confidence intervals and T statistics are in the log file.<br>\n", rfileres,rfileres);
   
  fprintf(fichtm," - Variance of one-step probabilities: <a href=\"%s\">%s</a> <br>\n",   fprintf(fichtm," - Standard deviation of one-step probabilities: <a href=\"%s\">%s</a> <br>\n",
          subdirf2(fileres,"prob"),subdirf2(fileres,"prob"));           subdirf2(fileres,"prob"),subdirf2(fileres,"prob"));
  fprintf(fichtm,"\   fprintf(fichtm,"\
  - Variance-covariance of one-step probabilities: <a href=\"%s\">%s</a> <br>\n",   - Variance-covariance of one-step probabilities: <a href=\"%s\">%s</a> <br>\n",
Line 6561  int main(int argc, char *argv[]) Line 6564  int main(int argc, char *argv[])
         if(jj==i) continue;          if(jj==i) continue;
         j++;          j++;
         fscanf(ficpar,"%1d%1d",&i1,&j1);          fscanf(ficpar,"%1d%1d",&i1,&j1);
         if ((i1 != i) && (j1 != j)){          if ((i1 != i) || (j1 != jj)){
           printf("Error in line parameters number %d, %1d%1d instead of %1d%1d \n \            printf("Error in line parameters number %d, %1d%1d instead of %1d%1d \n \
 It might be a problem of design; if ncovcol and the model are correct\n \  It might be a problem of design; if ncovcol and the model are correct\n \
 run imach with mle=-1 to get a correct template of the parameter file.\n",numlinepar, i,j, i1, j1);  run imach with mle=-1 to get a correct template of the parameter file.\n",numlinepar, i,j, i1, j1);
Line 6569  run imach with mle=-1 to get a correct t Line 6572  run imach with mle=-1 to get a correct t
         }          }
         fprintf(ficparo,"%1d%1d",i1,j1);          fprintf(ficparo,"%1d%1d",i1,j1);
         if(mle==1)          if(mle==1)
           printf("%1d%1d",i,j);            printf("%1d%1d",i,jj);
         fprintf(ficlog,"%1d%1d",i,j);          fprintf(ficlog,"%1d%1d",i,jj);
         for(k=1; k<=ncovmodel;k++){          for(k=1; k<=ncovmodel;k++){
           fscanf(ficpar," %lf",&param[i][j][k]);            fscanf(ficpar," %lf",&param[i][j][k]);
           if(mle==1){            if(mle==1){
Line 7111  Interval (in months) between two waves: Line 7114  Interval (in months) between two waves:
     }      }
           
     printf("iter=%d MLE=%f Eq=%lf*exp(%lf*(age-%d))\n",iter,-gompertz(p),p[1],p[2],agegomp);      printf("iter=%d MLE=%f Eq=%lf*exp(%lf*(age-%d))\n",iter,-gompertz(p),p[1],p[2],agegomp);
     for (i=1;i<=NDIM;i++)       for (i=1;i<=NDIM;i++) {
       printf("%f [%f ; %f]\n",p[i],p[i]-2*sqrt(matcov[i][i]),p[i]+2*sqrt(matcov[i][i]));        printf("%f [%f ; %f]\n",p[i],p[i]-2*sqrt(matcov[i][i]),p[i]+2*sqrt(matcov[i][i]));
         fprintf(ficlog,"%f [%f ; %f]\n",p[i],p[i]-2*sqrt(matcov[i][i]),p[i]+2*sqrt(matcov[i][i]));
       }
     lsurv=vector(1,AGESUP);      lsurv=vector(1,AGESUP);
     lpop=vector(1,AGESUP);      lpop=vector(1,AGESUP);
     tpop=vector(1,AGESUP);      tpop=vector(1,AGESUP);
Line 7210  Interval (in months) between two waves: Line 7214  Interval (in months) between two waves:
       ftolhess=ftol; /* Usually correct */        ftolhess=ftol; /* Usually correct */
       hesscov(matcov, p, npar, delti, ftolhess, func);        hesscov(matcov, p, npar, delti, ftolhess, func);
     }      }
       printf("Parameters and 95%% confidence intervals\n");
       fprintf(ficlog, "Parameters, T and confidence intervals\n");
       for(i=1,jk=1; i <=nlstate; i++){
         for(k=1; k <=(nlstate+ndeath); k++){
           if (k != i) {
             printf("%d%d ",i,k);
             fprintf(ficlog,"%d%d ",i,k);
             for(j=1; j <=ncovmodel; j++){
               printf("%12.7f T=%8.3f CI=[%12.7f ; %12.7f] ",p[jk], p[jk]/sqrt(matcov[jk][jk]), p[jk]-2*sqrt(matcov[jk][jk]),p[jk]+2*sqrt(matcov[jk][jk]));
               fprintf(ficlog,"%12.7f T=%8.3f CI=[%12.7f ; %12.7f] ",p[jk], p[jk]/sqrt(matcov[jk][jk]), p[jk]-2*sqrt(matcov[jk][jk]),p[jk]+2*sqrt(matcov[jk][jk]));
               jk++; 
             }
             printf("\n");
             fprintf(ficlog,"\n");
           }
         }
       }
   
     fprintf(ficres,"# Scales (for hessian or gradient estimation)\n");      fprintf(ficres,"# Scales (for hessian or gradient estimation)\n");
     printf("# Scales (for hessian or gradient estimation)\n");      printf("# Scales (for hessian or gradient estimation)\n");
     fprintf(ficlog,"# Scales (for hessian or gradient estimation)\n");      fprintf(ficlog,"# Scales (for hessian or gradient estimation)\n");
Line 7366  Interval (in months) between two waves: Line 7388  Interval (in months) between two waves:
     dateprev2=anprev2+(mprev2-1)/12.+(jprev2-1)/365.;      dateprev2=anprev2+(mprev2-1)/12.+(jprev2-1)/365.;
           
     fscanf(ficpar,"pop_based=%d\n",&popbased);      fscanf(ficpar,"pop_based=%d\n",&popbased);
       fprintf(ficlog,"pop_based=%d\n",popbased);
     fprintf(ficparo,"pop_based=%d\n",popbased);         fprintf(ficparo,"pop_based=%d\n",popbased);   
     fprintf(ficres,"pop_based=%d\n",popbased);         fprintf(ficres,"pop_based=%d\n",popbased);   
           

Removed from v.1.192  
changed lines
  Added in v.1.193


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