Diff for /imach/src/imach.c between versions 1.323 and 1.324

version 1.323, 2022/07/22 12:30:08 version 1.324, 2022/07/23 17:44:26
Line 1 Line 1
 /* $Id$  /* $Id$
   $State$    $State$
   $Log$    $Log$
     Revision 1.324  2022/07/23 17:44:26  brouard
     *** empty log message ***
   
   Revision 1.323  2022/07/22 12:30:08  brouard    Revision 1.323  2022/07/22 12:30:08  brouard
   *  imach.c (Module): Output of Wald test in the htm file and not only in the log.    *  imach.c (Module): Output of Wald test in the htm file and not only in the log.
   
Line 869 Line 872
   
   The same imach parameter file can be used but the option for mle should be -3.    The same imach parameter file can be used but the option for mle should be -3.
   
   Agnès, who wrote this part of the code, tried to keep most of the    Agnès, who wrote this part of the code, tried to keep most of the
   former routines in order to include the new code within the former code.    former routines in order to include the new code within the former code.
   
   The output is very simple: only an estimate of the intercept and of    The output is very simple: only an estimate of the intercept and of
Line 1048  Important routines Line 1051  Important routines
 - Tricode which tests the modality of dummy variables (in order to warn with wrong or empty modalities)  - Tricode which tests the modality of dummy variables (in order to warn with wrong or empty modalities)
   and returns the number of efficient covariates cptcoveff and modalities nbcode[Tvar[k]][1]= 0 and nbcode[Tvar[k]][2]= 1 usually.    and returns the number of efficient covariates cptcoveff and modalities nbcode[Tvar[k]][1]= 0 and nbcode[Tvar[k]][2]= 1 usually.
 - printinghtml which outputs results like life expectancy in and from a state for a combination of modalities of dummy variables  - printinghtml which outputs results like life expectancy in and from a state for a combination of modalities of dummy variables
   o There are 2*cptcoveff combinations of (0,1) for cptcoveff variables. Outputting only combinations with people, éliminating 1 1 if    o There are 2*cptcoveff combinations of (0,1) for cptcoveff variables. Outputting only combinations with people, éliminating 1 1 if
     race White (0 0), Black vs White (1 0), Hispanic (0 1) and 1 1 being meaningless.      race White (0 0), Black vs White (1 0), Hispanic (0 1) and 1 1 being meaningless.
   
   
       
   Authors: Nicolas Brouard (brouard@ined.fr) and Agnès Lièvre (lievre@ined.fr).    Authors: Nicolas Brouard (brouard@ined.fr) and Agnès Lièvre (lievre@ined.fr).
            Institut national d'études démographiques, Paris.             Institut national d'études démographiques, Paris.
   This software have been partly granted by Euro-REVES, a concerted action    This software have been partly granted by Euro-REVES, a concerted action
   from the European Union.    from the European Union.
   It is copyrighted identically to a GNU software product, ie programme and    It is copyrighted identically to a GNU software product, ie programme and
Line 2416  void powell(double p[], double **xi, int Line 2419  void powell(double p[], double **xi, int
   for (j=1;j<=n;j++) pt[j]=p[j];     for (j=1;j<=n;j++) pt[j]=p[j]; 
   rcurr_time = time(NULL);      rcurr_time = time(NULL);  
   for (*iter=1;;++(*iter)) {     for (*iter=1;;++(*iter)) { 
     fp=(*fret); /* From former iteration or initial value */  
     ibig=0;       ibig=0; 
     del=0.0;       del=0.0; 
     rlast_time=rcurr_time;      rlast_time=rcurr_time;
     /* (void) gettimeofday(&curr_time,&tzp); */      /* (void) gettimeofday(&curr_time,&tzp); */
     rcurr_time = time(NULL);        rcurr_time = time(NULL);  
     curr_time = *localtime(&rcurr_time);      curr_time = *localtime(&rcurr_time);
     printf("\nPowell iter=%d -2*LL=%.12f %ld sec. %ld sec.",*iter,*fret, rcurr_time-rlast_time, rcurr_time-rstart_time);fflush(stdout);      printf("\nPowell iter=%d -2*LL=%.12f gain=%.12f=%.3g %ld sec. %ld sec.",*iter,*fret, fp-*fret,fp-*fret, rcurr_time-rlast_time, rcurr_time-rstart_time);fflush(stdout);
     fprintf(ficlog,"\nPowell iter=%d -2*LL=%.12f %ld sec. %ld sec.",*iter,*fret,rcurr_time-rlast_time, rcurr_time-rstart_time); fflush(ficlog);      fprintf(ficlog,"\nPowell iter=%d -2*LL=%.12f gain=%.12f=%.3g %ld sec. %ld sec.",*iter,*fret, fp-*fret,fp-*fret,rcurr_time-rlast_time, rcurr_time-rstart_time); fflush(ficlog);
 /*     fprintf(ficrespow,"%d %.12f %ld",*iter,*fret,curr_time.tm_sec-start_time.tm_sec); */  /*     fprintf(ficrespow,"%d %.12f %ld",*iter,*fret,curr_time.tm_sec-start_time.tm_sec); */
       fp=(*fret); /* From former iteration or initial value */
     for (i=1;i<=n;i++) {      for (i=1;i<=n;i++) {
       fprintf(ficrespow," %.12lf", p[i]);        fprintf(ficrespow," %.12lf", p[i]);
     }      }
Line 7995  set ter svg size 640, 480\nunset log y\n Line 7998  set ter svg size 640, 480\nunset log y\n
             fprintf(ficgp,", '' ");              fprintf(ficgp,", '' ");
           /* l=(nlstate+ndeath)*(i-1)+1; */            /* l=(nlstate+ndeath)*(i-1)+1; */
           l=(nlstate+ndeath)*(cpt-1)+1; /* fixed for i; cpt=1 1, cpt=2 1+ nlstate+ndeath, 1+2*(nlstate+ndeath) */            l=(nlstate+ndeath)*(cpt-1)+1; /* fixed for i; cpt=1 1, cpt=2 1+ nlstate+ndeath, 1+2*(nlstate+ndeath) */
           /* fprintf(ficgp," u ($1==%d ? ($3):1/0):($%d/($%d",k1,k+l+(cpt-1),k+l); /\* a vérifier *\/ */            /* fprintf(ficgp," u ($1==%d ? ($3):1/0):($%d/($%d",k1,k+l+(cpt-1),k+l); /\* a vérifier *\/ */
           /* fprintf(ficgp," u ($1==%d ? ($3):1/0):($%d/($%d",k1,k+l+(cpt-1),k+l+(cpt-1)+i-1); /\* a vérifier *\/ */            /* fprintf(ficgp," u ($1==%d ? ($3):1/0):($%d/($%d",k1,k+l+(cpt-1),k+l+(cpt-1)+i-1); /\* a vérifier *\/ */
           fprintf(ficgp," u ($1==%d ? ($3):1/0):($%d",k1,k+l+i-1); /* To be verified */            fprintf(ficgp," u ($1==%d ? ($3):1/0):($%d",k1,k+l+i-1); /* To be verified */
           /* for (j=2; j<= nlstate ; j ++) */            /* for (j=2; j<= nlstate ; j ++) */
           /*    fprintf(ficgp,"+$%d",k+l+j-1); */            /*    fprintf(ficgp,"+$%d",k+l+j-1); */
Line 12152  Title=%s <br>Datafile=%s Firstpass=%d La Line 12155  Title=%s <br>Datafile=%s Firstpass=%d La
           optionfilehtmcov,version,fullversion,title,datafile,firstpass,lastpass,stepm, weightopt, model);            optionfilehtmcov,version,fullversion,title,datafile,firstpass,lastpass,stepm, weightopt, model);
   }    }
   
   fprintf(fichtm,"<html><head>\n<head>\n<meta charset=\"utf-8\"/><meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\n<title>IMaCh %s</title></head>\n <body><font size=\"7\"><a href=http:/euroreves.ined.fr/imach>IMaCh for Interpolated Markov Chain</a> </font><br>\n<font size=\"3\">Sponsored by Copyright (C)  2002-2015 <a href=http://www.ined.fr>INED</a>-EUROREVES-Institut de longévité-2013-2016-Japan Society for the Promotion of Sciences 日本学術振興会 (<a href=https://www.jsps.go.jp/english/e-grants/>Grant-in-Aid for Scientific Research 25293121</a>) - <a href=https://software.intel.com/en-us>Intel Software 2015-2018</a></font><br>  \    fprintf(fichtm,"<html><head>\n<head>\n<meta charset=\"utf-8\"/><meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\n<title>IMaCh %s</title></head>\n <body><font size=\"7\"><a href=http:/euroreves.ined.fr/imach>IMaCh for Interpolated Markov Chain</a> </font><br>\n<font size=\"3\">Sponsored by Copyright (C)  2002-2015 <a href=http://www.ined.fr>INED</a>-EUROREVES-Institut de longévité-2013-2016-Japan Society for the Promotion of Sciences 日本学術振興会 (<a href=https://www.jsps.go.jp/english/e-grants/>Grant-in-Aid for Scientific Research 25293121</a>) - <a href=https://software.intel.com/en-us>Intel Software 2015-2018</a></font><br>  \
 <hr size=\"2\" color=\"#EC5E5E\"> \n\  <hr size=\"2\" color=\"#EC5E5E\"> \n\
 <font size=\"2\">IMaCh-%s <br> %s</font> \  <font size=\"2\">IMaCh-%s <br> %s</font> \
 <hr size=\"2\" color=\"#EC5E5E\"> \n\  <hr size=\"2\" color=\"#EC5E5E\"> \n\
Line 12593  Please run with mle=-1 to get a correct Line 12596  Please run with mle=-1 to get a correct
             fprintf(fichtm, "<td>%1d%1d</td>",i,k);              fprintf(fichtm, "<td>%1d%1d</td>",i,k);
             for(j=1; j <=ncovmodel; j++){              for(j=1; j <=ncovmodel; j++){
               wald=p[jk]/sqrt(matcov[jk][jk]);                wald=p[jk]/sqrt(matcov[jk][jk]);
               printf("%12.7f(%12.7f) sqrt(W)=%8.3f CI=[%12.7f ; %12.7f] ",p[jk],sqrt(matcov[jk][jk]), p[jk]/sqrt(matcov[jk][jk]), p[jk]-1.96*sqrt(matcov[jk][jk]),p[jk]+1.96*sqrt(matcov[jk][jk]));                printf("%12.7f(%12.7f) W=%8.3f CI=[%12.7f ; %12.7f] ",p[jk],sqrt(matcov[jk][jk]), p[jk]/sqrt(matcov[jk][jk]), p[jk]-1.96*sqrt(matcov[jk][jk]),p[jk]+1.96*sqrt(matcov[jk][jk]));
               fprintf(ficlog,"%12.7f(%12.7f) sqrt(W)=%8.3f CI=[%12.7f ; %12.7f] ",p[jk],sqrt(matcov[jk][jk]), p[jk]/sqrt(matcov[jk][jk]), p[jk]-1.96*sqrt(matcov[jk][jk]),p[jk]+1.96*sqrt(matcov[jk][jk]));                fprintf(ficlog,"%12.7f(%12.7f) W=%8.3f CI=[%12.7f ; %12.7f] ",p[jk],sqrt(matcov[jk][jk]), p[jk]/sqrt(matcov[jk][jk]), p[jk]-1.96*sqrt(matcov[jk][jk]),p[jk]+1.96*sqrt(matcov[jk][jk]));
               if(fabs(wald) > 1.96){                if(fabs(wald) > 1.96){
                 fprintf(fichtm, "<td><b>%12.7f</b></br> (%12.7f)</br>",p[jk],sqrt(matcov[jk][jk]));                  fprintf(fichtm, "<td><b>%12.7f</b></br> (%12.7f)</br>",p[jk],sqrt(matcov[jk][jk]));
               }else{                }else{
                 fprintf(fichtm, "<td>%12.7f (%12.7f)</br>",p[jk],sqrt(matcov[jk][jk]));                  fprintf(fichtm, "<td>%12.7f (%12.7f)</br>",p[jk],sqrt(matcov[jk][jk]));
               }                }
               fprintf(fichtm,"sqrt(W)=%8.3f</br>",wald);                fprintf(fichtm,"W=%8.3f</br>",wald);
               fprintf(fichtm,"[%12.7f;%12.7f]</br></td>", p[jk]-1.96*sqrt(matcov[jk][jk]),p[jk]+1.96*sqrt(matcov[jk][jk]));                fprintf(fichtm,"[%12.7f;%12.7f]</br></td>", p[jk]-1.96*sqrt(matcov[jk][jk]),p[jk]+1.96*sqrt(matcov[jk][jk]));
               jk++;                 jk++; 
             }              }

Removed from v.1.323  
changed lines
  Added in v.1.324


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