--- imach/src/imach.c 2017/03/08 07:13:00 1.254
+++ imach/src/imach.c 2017/03/08 16:02:28 1.255
@@ -1,6 +1,9 @@
-/* $Id: imach.c,v 1.254 2017/03/08 07:13:00 brouard Exp $
+/* $Id: imach.c,v 1.255 2017/03/08 16:02:28 brouard Exp $
$State: Exp $
$Log: imach.c,v $
+ Revision 1.255 2017/03/08 16:02:28 brouard
+ Summary: IMaCh version 0.99r10 bugs in gnuplot fixed
+
Revision 1.254 2017/03/08 07:13:00 brouard
Summary: Fixing data parameter line
@@ -962,12 +965,12 @@ typedef struct {
#define ODIRSEPARATOR '\\'
#endif
-/* $Id: imach.c,v 1.254 2017/03/08 07:13:00 brouard Exp $ */
+/* $Id: imach.c,v 1.255 2017/03/08 16:02:28 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.254 $ $Date: 2017/03/08 07:13:00 $";
+char fullversion[]="$Revision: 1.255 $ $Date: 2017/03/08 16:02:28 $";
char strstart[80];
char optionfilext[10], optionfilefiname[FILENAMELENGTH];
int erreur=0, nberr=0, nbwarn=0; /* Error number, number of errors number of warnings */
@@ -2400,8 +2403,8 @@ void powell(double p[], double **xi, int
flatd++;
}
if(flatd >0){
- printf("%d flat directions\n",flatd);
- fprintf(ficlog,"%d flat directions\n",flatd);
+ printf("%d flat directions: ",flatd);
+ fprintf(ficlog,"%d flat directions :",flatd);
for (j=1;j<=n;j++) {
if(flatdir[j]>0){
printf("%d ",j);
@@ -6459,13 +6462,13 @@ divided by h: hPij
}
/* Period (stable) prevalence in each health state */
for(cpt=1; cpt<=nlstate;cpt++){
- fprintf(fichtm,"
\n- Convergence to period (stable) prevalence in state %d. Or probability to be in state %d being in state (1 to %d) at different ages. %s_%d-%d-%d.svg
\
+ fprintf(fichtm,"
\n- Convergence to period (stable) prevalence in state %d. Or probability to be in state %d some years earlier, knowing that we will be in state (1 to %d) at different ages. %s_%d-%d-%d.svg
\
", cpt, cpt, nlstate, subdirf2(optionfilefiname,"P_"),cpt,k1,nres,subdirf2(optionfilefiname,"P_"),cpt,k1,nres,subdirf2(optionfilefiname,"P_"),cpt,k1,nres);
}
if(backcast==1){
/* Period (stable) back prevalence in each health state */
for(cpt=1; cpt<=nlstate;cpt++){
- fprintf(fichtm,"
\n- Convergence to period (stable) back prevalence in state %d. Or probability to be in state %d being in state (1 to %d) at different ages. %s_%d-%d-%d.svg
\
+ fprintf(fichtm,"
\n- Convergence to mixed (stable) back prevalence in state %d. Or probability to be in state %d at a younger age, knowing that we will be in state (1 to %d) at different older ages. %s_%d-%d-%d.svg
\
", cpt, cpt, nlstate, subdirf2(optionfilefiname,"PB_"),cpt,k1,nres,subdirf2(optionfilefiname,"PB_"),cpt,k1,nres,subdirf2(optionfilefiname,"PB_"),cpt,k1,nres);
}
}
@@ -6929,7 +6932,7 @@ set ter svg size 640, 480\nunset log y\n
for(nres=1; nres <= nresult; nres++){ /* For each resultline */
if(m != 1 && TKresult[nres]!= k1)
continue;
- for (cpt=1; cpt<=nlstate ; cpt ++) { /* For each life state */
+ for (cpt=1; cpt<=nlstate ; cpt ++) { /* For each life state of arrival */
fprintf(ficgp,"\n#\n#\n#CV preval stable (period): 'pij' files, covariatecombination#=%d state=%d",k1, cpt);
for (k=1; k<=cptcoveff; k++){ /* For each covariate and each value */
@@ -6953,12 +6956,12 @@ set ter svg size 640, 480\nunset log y\n
fprintf(ficgp,"set xlabel \"Age\" \nset ylabel \"Probability\" \n\
set ter svg size 640, 480\nunset log y\nplot [%.f:%.f] ", ageminpar, agemaxpar);
k=3; /* Offset */
- for (i=1; i<= nlstate ; i ++){
+ for (i=1; i<= nlstate ; i ++){ /* State of origin */
if(i==1)
fprintf(ficgp,"\"%s\"",subdirf2(fileresu,"PIJ_"));
else
fprintf(ficgp,", '' ");
- l=(nlstate+ndeath)*(i-1)+1;
+ l=(nlstate+ndeath)*(i-1)+1; /* 1, 1+ nlstate+ndeath, 1+2*(nlstate+ndeath) */
fprintf(ficgp," u ($1==%d ? ($3):1/0):($%d/($%d",k1,k+l+(cpt-1),k+l);
for (j=2; j<= nlstate ; j ++)
fprintf(ficgp,"+$%d",k+l+j-1);
@@ -6976,8 +6979,8 @@ set ter svg size 640, 480\nunset log y\n
for(nres=1; nres <= nresult; nres++){ /* For each resultline */
if(m != 1 && TKresult[nres]!= k1)
continue;
- for (cpt=1; cpt<=nlstate ; cpt ++) { /* For each life state */
- fprintf(ficgp,"\n#\n#\n#CV Back preval stable (period): 'pij' files, covariatecombination#=%d state=%d",k1, cpt);
+ for (cpt=1; cpt<=nlstate ; cpt ++) { /* For each life ending state */
+ fprintf(ficgp,"\n#\n#\n#CV Back preval stable (period): 'pijb' files, covariatecombination#=%d state=%d",k1, cpt);
for (k=1; k<=cptcoveff; k++){ /* For each covariate and each value */
lv= decodtabm(k1,k,cptcoveff); /* Should be the covariate number corresponding to k1 combination */
/* decodtabm(1,1,4) = 1 because h=1 k= (1) 1 1 1 */
@@ -6999,16 +7002,16 @@ set ter svg size 640, 480\nunset log y\n
fprintf(ficgp,"set xlabel \"Age\" \nset ylabel \"Probability\" \n\
set ter svg size 640, 480\nunset log y\nplot [%.f:%.f] ", ageminpar, agemaxpar);
k=3; /* Offset */
- for (i=1; i<= nlstate ; i ++){
+ for (i=1; i<= nlstate ; i ++){ /* State of origin */
if(i==1)
fprintf(ficgp,"\"%s\"",subdirf2(fileresu,"PIJB_"));
else
fprintf(ficgp,", '' ");
/* l=(nlstate+ndeath)*(i-1)+1; */
- l=(nlstate+ndeath)*(cpt-1)+1;
+ 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+(cpt-1)+i-1); /\* a vérifier *\/ */
- fprintf(ficgp," u ($1==%d ? ($3):1/0):($%d",k1,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 */
/* for (j=2; j<= nlstate ; j ++) */
/* fprintf(ficgp,"+$%d",k+l+j-1); */
/* /\* fprintf(ficgp,"+$%d",k+l+j-1); *\/ */
@@ -9566,6 +9569,7 @@ int back_prevalence_limit(double *p, dou
fprintf(ficresplb," %.3f %d\n", tot, *ncvyearp);
} /* Age */
/* was end of cptcod */
+ /*fprintf(ficresplb,"\n");*/ /* Seems to be necessary for gnuplot only if two result lines and no covariate. */
} /* end of any combination */
} /* end of nres */
/* hBijx(p, bage, fage); */
@@ -9682,7 +9686,7 @@ int hPijx(double *p, int bage, int fage)
/* hstepm=1; aff par mois*/
pstamp(ficrespijb);
- fprintf(ficrespijb,"#****** h Pij x Back Probability to be in state i at age x-h being in j at x ");
+ fprintf(ficrespijb,"#****** h Bij x Back probability to be in state i at age x-h being in j at x: B1j+B2j+...=1 ");
i1= pow(2,cptcoveff);
/* for(cptcov=1,k=0;cptcov<=i1;cptcov++){ */
/* /\*for(cptcod=1;cptcod<=ncodemax[cptcov];cptcod++){*\/ */
@@ -9716,7 +9720,7 @@ int hPijx(double *p, int bage, int fage)
/* hbxij(p3mat,nhstepm,agedeb,hstepm,p,nlstate,stepm,oldm,savm, k); */
hbxij(p3mat,nhstepm,agedeb,hstepm,p,prevacurrent,nlstate,stepm, k);
/* hbxij(p3mat,nhstepm,agedeb,hstepm,p,prevacurrent,nlstate,stepm,oldm,savm, dnewm, doldm, dsavm, k); */
- fprintf(ficrespijb,"# Cov Agex agex-h hpijx with i,j=");
+ fprintf(ficrespijb,"# Cov Agex agex-h hbijx with i,j=");
for(i=1; i<=nlstate;i++)
for(j=1; j<=nlstate+ndeath;j++)
fprintf(ficrespijb," %1d-%1d",i,j);