Diff for /imach/src/imach.c between versions 1.308 and 1.309

version 1.308, 2021/03/31 13:11:57 version 1.309, 2021/05/20 12:39:14
Line 1 Line 1
 /* $Id$  /* $Id$
   $State$    $State$
   $Log$    $Log$
     Revision 1.309  2021/05/20 12:39:14  brouard
     Summary: Version 0.99r24
   
   Revision 1.308  2021/03/31 13:11:57  brouard    Revision 1.308  2021/03/31 13:11:57  brouard
   Summary: Version 0.99r23    Summary: Version 0.99r23
   
Line 5271  void  concatwav(int wav[], int **dh, int Line 5274  void  concatwav(int wav[], int **dh, int
   for(i=1; i<=imx; i++){  /* For simple cases and if state is death */    for(i=1; i<=imx; i++){  /* For simple cases and if state is death */
     mi=0;  /* First valid wave */      mi=0;  /* First valid wave */
     mli=0; /* Last valid wave */      mli=0; /* Last valid wave */
     m=firstpass;      m=firstpass;  /* Loop on waves */
     while(s[m][i] <= nlstate){  /* a live state */      while(s[m][i] <= nlstate){  /* a live state or unknown state  */
       if(m >firstpass && s[m][i]==s[m-1][i] && mint[m][i]==mint[m-1][i] && anint[m][i]==anint[m-1][i]){/* Two succesive identical information on wave m */        if(m >firstpass && s[m][i]==s[m-1][i] && mint[m][i]==mint[m-1][i] && anint[m][i]==anint[m-1][i]){/* Two succesive identical information on wave m */
         mli=m-1;/* mw[++mi][i]=m-1; */          mli=m-1;/* mw[++mi][i]=m-1; */
       }else if(s[m][i]>=1 || s[m][i]==-4 || s[m][i]==-5){ /* Since 0.98r4 if status=-2 vital status is really unknown, wave should be skipped */        }else if(s[m][i]>=1 || s[m][i]==-4 || s[m][i]==-5){ /* Since 0.98r4 if status=-2 vital status is really unknown, wave should be skipped */
         mw[++mi][i]=m;          mw[++mi][i]=m; /* Valid wave: incrementing mi and updating mi; mw[mi] is the wave number of mi_th valid transition   */
         mli=m;          mli=m;
       } /* else might be a useless wave  -1 and mi is not incremented and mw[mi] not updated */        } /* else might be a useless wave  -1 and mi is not incremented and mw[mi] not updated */
       if(m < lastpass){ /* m < lastpass, standard case */        if(m < lastpass){ /* m < lastpass, standard case */
         m++; /* mi gives the "effective" current wave, m the current wave, go to next wave by incrementing m */          m++; /* mi gives the "effective" current wave, m the current wave, go to next wave by incrementing m */
       }        }
       else{ /* m >= lastpass, eventual special issue with warning */        else{ /* m = lastpass, eventual special issue with warning */
 #ifdef UNKNOWNSTATUSNOTCONTRIBUTING  #ifdef UNKNOWNSTATUSNOTCONTRIBUTING
         break;          break;
 #else  #else
         if(s[m][i]==-1 && (int) andc[i] == 9999 && (int)anint[m][i] != 9999){          if(s[m][i]==-1 && (int) andc[i] == 9999 && (int)anint[m][i] != 9999){ /* case -2 (vital status unknown is warned later */
           if(firsthree == 0){            if(firsthree == 0){
             printf("Information! Unknown status for individual %ld line=%d occurred at last wave %d at known date %d/%d. Please, check if your unknown date of death %d/%d means a live state %d at wave %d. This case(%d)/wave(%d) contributes to the likelihood as 1-p_{%d%d} .\nOthers in log file only\n",num[i],i,lastpass,(int)mint[m][i],(int)anint[m][i], (int) moisdc[i], (int) andc[i], s[m][i], m, i, m, s[m][i], nlstate+ndeath);              printf("Information! Unknown status for individual %ld line=%d occurred at last wave %d at known date %d/%d. Please, check if your unknown date of death %d/%d means a live state %d at wave %d. This case(%d)/wave(%d) contributes to the likelihood as 1-p_{%d%d} .\nOthers in log file only\n",num[i],i,lastpass,(int)mint[m][i],(int)anint[m][i], (int) moisdc[i], (int) andc[i], s[m][i], m, i, m, s[m][i], nlstate+ndeath);
             firsthree=1;              firsthree=1;
           }            }
           fprintf(ficlog,"Information! Unknown status for individual %ld line=%d occurred at last wave %d at known date %d/%d. Please, check if your unknown date of death %d/%d means a live state %d at wave %d. This case(%d)/wave(%d) contributes to the likelihood as 1-p_{%d%d} .\n",num[i],i,lastpass,(int)mint[m][i],(int)anint[m][i], (int) moisdc[i], (int) andc[i], s[m][i], m, i, m, s[m][i], nlstate+ndeath);            fprintf(ficlog,"Information! Unknown status for individual %ld line=%d occurred at last wave %d at known date %d/%d. Please, check if your unknown date of death %d/%d means a live state %d at wave %d. This case(%d)/wave(%d) contributes to the likelihood as 1-p_{%d%d} .\n",num[i],i,lastpass,(int)mint[m][i],(int)anint[m][i], (int) moisdc[i], (int) andc[i], s[m][i], m, i, m, s[m][i], nlstate+ndeath);
           mw[++mi][i]=m;            mw[++mi][i]=m; /* Valid transition with unknown status */
           mli=m;            mli=m;
         }          }
         if(s[m][i]==-2){ /* Vital status is really unknown */          if(s[m][i]==-2){ /* Vital status is really unknown */
           nbwarn++;            nbwarn++;
           if((int)anint[m][i] == 9999){  /*  Has the vital status really been verified? */            if((int)anint[m][i] == 9999){  /*  Has the vital status really been verified?not a transition */
             printf("Warning! Vital status for individual %ld (line=%d) at last wave %d interviewed at date %d/%d is unknown %d. Please, check if the vital status and the date of death %d/%d are really unknown. This case (%d)/wave (%d) is skipped, no contribution to likelihood.\nOthers in log file only\n",num[i],i,lastpass,(int)mint[m][i],(int)anint[m][i], s[m][i], (int) moisdc[i], (int) andc[i], i, m);              printf("Warning! Vital status for individual %ld (line=%d) at last wave %d interviewed at date %d/%d is unknown %d. Please, check if the vital status and the date of death %d/%d are really unknown. This case (%d)/wave (%d) is skipped, no contribution to likelihood.\nOthers in log file only\n",num[i],i,lastpass,(int)mint[m][i],(int)anint[m][i], s[m][i], (int) moisdc[i], (int) andc[i], i, m);
             fprintf(ficlog,"Warning! Vital status for individual %ld (line=%d) at last wave %d interviewed at date %d/%d is unknown %d. Please, check if the vital status and the date of death %d/%d are really unknown. This case (%d)/wave (%d) is skipped, no contribution to likelihood.\n",num[i],i,lastpass,(int)mint[m][i],(int)anint[m][i], s[m][i], (int) moisdc[i], (int) andc[i], i, m);              fprintf(ficlog,"Warning! Vital status for individual %ld (line=%d) at last wave %d interviewed at date %d/%d is unknown %d. Please, check if the vital status and the date of death %d/%d are really unknown. This case (%d)/wave (%d) is skipped, no contribution to likelihood.\n",num[i],i,lastpass,(int)mint[m][i],(int)anint[m][i], s[m][i], (int) moisdc[i], (int) andc[i], i, m);
           }            }
Line 5322  void  concatwav(int wav[], int **dh, int Line 5325  void  concatwav(int wav[], int **dh, int
 #ifndef DISPATCHINGKNOWNDEATHAFTERLASTWAVE  #ifndef DISPATCHINGKNOWNDEATHAFTERLASTWAVE
     else if ((int) andc[i] != 9999) {  /* Date of death is known */      else if ((int) andc[i] != 9999) {  /* Date of death is known */
       if ((int)anint[m][i]!= 9999) { /* date of last interview is known */        if ((int)anint[m][i]!= 9999) { /* date of last interview is known */
         if((andc[i]+moisdc[i]/12.) <=(anint[m][i]+mint[m][i]/12.)){ /* death occured before last wave and status should have been death instead of -1 */          if((andc[i]+moisdc[i]/12.) <=(anint[m][i]+mint[m][i]/12.)){ /* month of death occured before last wave month and status should have been death instead of -1 */
           nbwarn++;            nbwarn++;
           if(firstfiv==0){            if(firstfiv==0){
             printf("Warning! Death for individual %ld line=%d occurred at %d/%d before last wave %d interviewed at %d/%d and should have been coded as death instead of '%d'. This case (%d)/wave (%d) is contributing to likelihood.\nOthers in log file only\n",num[i],i,(int) moisdc[i], (int) andc[i], lastpass,(int)mint[m][i],(int)anint[m][i], s[m][i], i,m );              printf("Warning! Death for individual %ld line=%d occurred at %d/%d before last wave %d, interviewed on %d/%d and should have been coded as death instead of '%d'. This case (%d)/wave (%d) is contributing to likelihood.\nOthers in log file only\n",num[i],i,(int) moisdc[i], (int) andc[i], lastpass,(int)mint[m][i],(int)anint[m][i], s[m][i], i,m );
             firstfiv=1;              firstfiv=1;
           }else{            }else{
             fprintf(ficlog,"Warning! Death for individual %ld line=%d occurred at %d/%d before last wave %d interviewed at %d/%d and should have been coded as death instead of '%d'. This case (%d)/wave (%d) is contributing to likelihood.\n",num[i],i,(int) moisdc[i], (int) andc[i], lastpass,(int)mint[m][i],(int)anint[m][i], s[m][i], i,m );              fprintf(ficlog,"Warning! Death for individual %ld line=%d occurred at %d/%d before last wave %d, interviewed on %d/%d and should have been coded as death instead of '%d'. This case (%d)/wave (%d) is contributing to likelihood.\n",num[i],i,(int) moisdc[i], (int) andc[i], lastpass,(int)mint[m][i],(int)anint[m][i], s[m][i], i,m );
           }            }
         }else{ /* Death occured afer last wave potential bias */              s[m][i]=nlstate+1; /* Fixing the status as death. Be careful if multiple death states */
           }else{ /* Month of Death occured afer last wave month, potential bias */
           nberr++;            nberr++;
           if(firstwo==0){            if(firstwo==0){
             printf("Error! Death for individual %ld line=%d occurred at %d/%d after last wave %d interviewed at %d/%d. Potential bias if other individuals are still alive at this date but ignored. This case (%d)/wave (%d) is skipped, no contribution to likelihood. Please add a new fictive wave at the date of last vital status scan, with a dead status or alive but unknown state status (-1). See documentation\nOthers in log file only\n",num[i],i,(int) moisdc[i], (int) andc[i], lastpass,(int)mint[m][i],(int)anint[m][i], i,m );              printf("Error! Death for individual %ld line=%d occurred at %d/%d after last wave %d interviewed at %d/%d with status %d. Potential bias if other individuals are still alive on this date but ignored. This case (%d)/wave (%d) is skipped, no contribution to likelihood. Please add a new fictitious wave at the date of last vital status scan, with a dead status. See documentation\nOthers in log file only\n",num[i],i,(int) moisdc[i], (int) andc[i], lastpass,(int)mint[m][i],(int)anint[m][i], s[m][i], i,m );
             firstwo=1;              firstwo=1;
           }            }
           fprintf(ficlog,"Error! Death for individual %ld line=%d occurred at %d/%d after last wave %d interviewed at %d/%d. Potential bias if other individuals are still alive at this date but ignored. This case (%d)/wave (%d) is skipped, no contribution to likelihood. Please add a new fictive wave at the date of last vital status scan, with a dead status or alive but unknown state status (-1). See documentation\n\n",num[i],i,(int) moisdc[i], (int) andc[i], lastpass,(int)mint[m][i],(int)anint[m][i], i,m );            fprintf(ficlog,"Error! Death for individual %ld line=%d occurred at %d/%d after last wave %d interviewed at %d/%d with status %d. Potential bias if other individuals are still alive on this date but ignored. This case (%d)/wave (%d) is skipped, no contribution to likelihood. Please add a new fictitious wave at the date of last vital status scan, with a dead status. See documentation\n\n",num[i],i,(int) moisdc[i], (int) andc[i], lastpass,(int)mint[m][i],(int)anint[m][i], s[m][i], i,m );
         }          }
       }else{ /* if date of interview is unknown */        }else{ /* if date of interview is unknown */
         /* death is known but not confirmed by death status at any wave */          /* death is known but not confirmed by death status at any wave */
         if(firstfour==0){          if(firstfour==0){
           printf("Error! Death for individual %ld line=%d  occurred %d/%d but not confirmed by any death status for any wave, including last wave %d at unknown date %d/%d. Potential bias if other individuals are still alive at this date but ignored. This case (%d)/wave (%d) is skipped, no contribution to likelihood.\nOthers in log file only\n",num[i],i,(int) moisdc[i], (int) andc[i], lastpass,(int)mint[m][i],(int)anint[m][i], i,m );            printf("Error! Death for individual %ld line=%d  occurred %d/%d but not confirmed by any death status for any wave, including last wave %d at unknown date %d/%d with status %d. Potential bias if other individuals are still alive at this date but ignored. This case (%d)/wave (%d) is skipped, no contribution to likelihood.\nOthers in log file only\n",num[i],i,(int) moisdc[i], (int) andc[i], lastpass,(int)mint[m][i],(int)anint[m][i], s[m][i], i,m );
           firstfour=1;            firstfour=1;
         }          }
         fprintf(ficlog,"Error! Death for individual %ld line=%d  occurred %d/%d but not confirmed by any death status for any wave, including last wave %d at unknown date %d/%d. Potential bias if other individuals are still alive at this date but ignored. This case (%d)/wave (%d) is skipped, no contribution to likelihood.\n",num[i],i,(int) moisdc[i], (int) andc[i], lastpass,(int)mint[m][i],(int)anint[m][i], i,m );          fprintf(ficlog,"Error! Death for individual %ld line=%d  occurred %d/%d but not confirmed by any death status for any wave, including last wave %d at unknown date %d/%d  with status %d. Potential bias if other individuals are still alive at this date but ignored. This case (%d)/wave (%d) is skipped, no contribution to likelihood.\n",num[i],i,(int) moisdc[i], (int) andc[i], lastpass,(int)mint[m][i],(int)anint[m][i], s[m][i], i,m );
       }        }
     } /* end if date of death is known */      } /* end if date of death is known */
 #endif  #endif
     wav[i]=mi; /* mi should be the last effective wave (or mli) */      wav[i]=mi; /* mi should be the last effective wave (or mli),  */
     /* wav[i]=mw[mi][i]; */      /* wav[i]=mw[mi][i];   */
     if(mi==0){      if(mi==0){
       nbwarn++;        nbwarn++;
       if(first==0){        if(first==0){

Removed from v.1.308  
changed lines
  Added in v.1.309


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