--- imach/src/imach.c 2017/04/04 13:01:16 1.259 +++ imach/src/imach.c 2017/04/04 17:46:59 1.260 @@ -1,6 +1,9 @@ -/* $Id: imach.c,v 1.259 2017/04/04 13:01:16 brouard Exp $ +/* $Id: imach.c,v 1.260 2017/04/04 17:46:59 brouard Exp $ $State: Exp $ $Log: imach.c,v $ + Revision 1.260 2017/04/04 17:46:59 brouard + Summary: Gnuplot indexations fixed (humm) + Revision 1.259 2017/04/04 13:01:16 brouard Summary: Some errors to warnings only if date of death is unknown but status is death we could set to pi3 @@ -979,12 +982,12 @@ typedef struct { #define ODIRSEPARATOR '\\' #endif -/* $Id: imach.c,v 1.259 2017/04/04 13:01:16 brouard Exp $ */ +/* $Id: imach.c,v 1.260 2017/04/04 17:46:59 brouard Exp $ */ /* $State: Exp $ */ #include "version.h" char version[]=__IMACH_VERSION__; char copyright[]="February 2016,INED-EUROREVES-Institut de longevite-Japan Society for the Promotion of Science (Grant-in-Aid for Scientific Research 25293121), Intel Software 2015-2018"; -char fullversion[]="$Revision: 1.259 $ $Date: 2017/04/04 13:01:16 $"; +char fullversion[]="$Revision: 1.260 $ $Date: 2017/04/04 17:46:59 $"; char strstart[80]; char optionfilext[10], optionfilefiname[FILENAMELENGTH]; int erreur=0, nberr=0, nbwarn=0; /* Error number, number of errors number of warnings */ @@ -4659,7 +4662,8 @@ Title=%s
Datafile=%s Firstpass=%d La if(posproptt < 1.e-5){ fprintf(ficresphtm,"\n

This combination (%d) is not valid and no result will be produced

",j1); fprintf(ficresphtmfr,"\n

This combination (%d) is not valid and no result will be produced

",j1); - fprintf(ficres,"\n This combination (%d) is not valid and no result will be produced\n\n",j1); + fprintf(ficlog,"# This combination (%d) is not valid and no result will be produced\n",j1); + printf("# This combination (%d) is not valid and no result will be produced\n",j1); invalidvarcomb[j1]=1; }else{ fprintf(ficresphtm,"\n

This combination (%d) is valid and result will be produced.

",j1); @@ -5022,7 +5026,7 @@ void concatwav(int wav[], int **dh, int if (stepm <=0) dh[mi][i]=1; else{ - if (s[mw[mi+1][i]][i] > nlstate) { /* A death */ + if (s[mw[mi+1][i]][i] > nlstate) { /* A death, but what if date is unknown? */ if (agedc[i] < 2*AGESUP) { j= rint(agedc[i]*12-agev[mw[mi][i]][i]*12); if(j==0) j=1; /* Survives at least one month after exam */ @@ -6681,24 +6685,26 @@ void printinggnuplot(char fileresu[], ch /* printf("\n#\n"); */ fprintf(ficgp,"\n#\n"); if(invalidvarcomb[k1]){ + /*k1=k1-1;*/ /* To be checked */ fprintf(ficgp,"#Combination (%d) ignored because no cases \n",k1); continue; } fprintf(ficgp,"\nset out \"%s_%d-%d-%d.svg\" \n",subdirf2(optionfilefiname,"V_"),cpt,k1,nres); fprintf(ficgp,"\n#set out \"V_%s_%d-%d-%d.svg\" \n",optionfilefiname,cpt,k1,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_"),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); */ + /* k1-1 error should be nres-1*/ for (i=1; i<= nlstate ; i ++) { if (i==cpt) fprintf(ficgp," %%lf (%%lf)"); else fprintf(ficgp," %%*lf (%%*lf)"); } - fprintf(ficgp,"\" t\"Period (stable) prevalence\" w l lt 0,\"%s\" every :::%d::%d u 1:($2==%d ? $3+1.96*$4 : 1/0) \"%%lf %%lf",subdirf2(fileresu,"VPL_"),k1-1,k1-1,nres); + fprintf(ficgp,"\" t\"Period (stable) prevalence\" w l lt 0,\"%s\" every :::%d::%d u 1:($2==%d ? $3+1.96*$4 : 1/0) \"%%lf %%lf",subdirf2(fileresu,"VPL_"),nres-1,nres-1,nres); for (i=1; i<= nlstate ; i ++) { if (i==cpt) fprintf(ficgp," %%lf (%%lf)"); else fprintf(ficgp," %%*lf (%%*lf)"); } - fprintf(ficgp,"\" t\"95%% CI\" w l lt 1,\"%s\" every :::%d::%d u 1:($2==%d ? $3-1.96*$4 : 1/0) \"%%lf %%lf",subdirf2(fileresu,"VPL_"),k1-1,k1-1,nres); + fprintf(ficgp,"\" t\"95%% CI\" w l lt 1,\"%s\" every :::%d::%d u 1:($2==%d ? $3-1.96*$4 : 1/0) \"%%lf %%lf",subdirf2(fileresu,"VPL_"),nres-1,nres-1,nres); for (i=1; i<= nlstate ; i ++) { if (i==cpt) fprintf(ficgp," %%lf (%%lf)"); else fprintf(ficgp," %%*lf (%%*lf)"); @@ -9108,13 +9114,13 @@ int calandcheckages(int imx, int maxwav, s[m][i]=-1; } if((int)moisdc[i]==99 && (int)andc[i]==9999 && s[m][i]>nlstate){ - *nbwarn = *nbwarn + 1; + *nberr = *nberr + 1; if(firstone == 0){ firstone=1; - printf("Warning (#%d)! Date of death (month %2d and year %4d) of individual %ld on line %d was unknown but status is a death state %d at wave %d. If you don't know the vital status, please enter -2. If he/she is still alive but don't know the state, please code with '-1 or '.'. Here, we believe in a death.\nOther similar cases in log file\n", *nbwarn,(int)moisdc[i],(int)andc[i],num[i],i,s[m][i],m); + printf("Warning (#%d)! Date of death (month %2d and year %4d) of individual %ld on line %d was unknown but status is a death state %d at wave %d. If you don't know the vital status, please enter -2. If he/she is still alive but don't know the state, please code with '-1 or '.'. Here, we do not believe in a death, skipped.\nOther similar cases in log file\n", *nberr,(int)moisdc[i],(int)andc[i],num[i],i,s[m][i],m); } - fprintf(ficlog,"Warning (#%d)! Date of death (month %2d and year %4d) of individual %ld on line %d was unknown but status is a death state %d at wave %d. If you don't know the vital status, please enter -2. If he/she is still alive but don't know the state, please code with '-1 or '.'. Here, we believe in a death.\nOther similar cases in log file\n", *nbwarn,(int)moisdc[i],(int)andc[i],num[i],i,s[m][i],m); - /* s[m][i]=-1; */ /* Keeping the death status */ + fprintf(ficlog,"Warning (#%d)! Date of death (month %2d and year %4d) of individual %ld on line %d was unknown but status is a death state %d at wave %d. If you don't know the vital status, please enter -2. If he/she is still alive but don't know the state, please code with '-1 or '.'. Here, we do not believe in a death, skipped.\nOther similar cases in log file\n", *nberr,(int)moisdc[i],(int)andc[i],num[i],i,s[m][i],m); + s[m][i]=-1; /* Droping the death status */ } if((int)moisdc[i]==99 && (int)andc[i]!=9999 && s[m][i]>nlstate){ (*nberr)++;