--- imach/src/imach.c 2016/08/25 06:59:23 1.235 +++ imach/src/imach.c 2016/08/25 10:50:18 1.236 @@ -1,6 +1,9 @@ -/* $Id: imach.c,v 1.235 2016/08/25 06:59:23 brouard Exp $ +/* $Id: imach.c,v 1.236 2016/08/25 10:50:18 brouard Exp $ $State: Exp $ $Log: imach.c,v $ + Revision 1.236 2016/08/25 10:50:18 brouard + *** empty log message *** + Revision 1.235 2016/08/25 06:59:23 brouard *** empty log message *** @@ -905,12 +908,12 @@ typedef struct { #define ODIRSEPARATOR '\\' #endif -/* $Id: imach.c,v 1.235 2016/08/25 06:59:23 brouard Exp $ */ +/* $Id: imach.c,v 1.236 2016/08/25 10:50:18 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.235 $ $Date: 2016/08/25 06:59:23 $"; +char fullversion[]="$Revision: 1.236 $ $Date: 2016/08/25 10:50:18 $"; char strstart[80]; char optionfilext[10], optionfilefiname[FILENAMELENGTH]; int erreur=0, nberr=0, nbwarn=0; /* Error number, number of errors number of warnings */ @@ -6229,8 +6232,8 @@ void printinggnuplot(char fileresu[], ch strcpy(optfileres,"vpl"); /* 1eme*/ for (cpt=1; cpt<= nlstate ; cpt ++) { /* For each live state */ - for(nres=1; nres <= nresult; nres++) /* For each resultline */ - for (k1=1; k1<= m ; k1 ++) { /* For each valid combination of covariate */ + for (k1=1; k1<= m ; k1 ++) /* For each valid combination of covariate */ + for(nres=1; nres <= nresult; nres++){ /* For each resultline */ /* plot [100000000000000000000:-100000000000000000000] "mysbiaspar/vplrmysbiaspar.txt to check */ if(TKresult[nres]!= k1) continue; @@ -6314,22 +6317,22 @@ plot [%.f:%.f] \"%s\" every :::%d::%d u /*2 eme*/ - for (k1=1; k1<= m ; k1 ++) { + for (k1=1; k1<= m ; k1 ++) + for(nres=1; nres <= nresult; nres++){ /* For each resultline */ + if(TKresult[nres]!= k1) + continue; fprintf(ficgp,"\n# 2nd: Total life expectancy with CI: 't' files "); - for(nres=1; nres <= nresult; nres++) /* For each resultline */ for (k=1; k<=cptcoveff; k++){ /* For each covariate and each value */ - if(TKresult[nres]!= k) - continue; 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 */ /* decodtabm(1,2,4) = 1 because h=1 k= 1 (1) 1 1 */ /* decodtabm(13,3,4)= 2 because h=13 k= 1 1 (2) 2 */ vlv= nbcode[Tvaraff[k]][lv]; fprintf(ficgp," V%d=%d ",Tvaraff[k],vlv); - for (k4=1; k4<= nsq; k4++){ /* For each selected (single) quantitative value */ - printf(" V%d=%f ",Tvqresult[nres][k4],Tqresult[nres][k4]); - fprintf(ficgp," V%d=%f ",Tvqresult[nres][k4],Tqresult[nres][k4]); - } + } + for (k4=1; k4<= nsq; k4++){ /* For each selected (single) quantitative value */ + printf(" V%d=%f ",Tvqresult[nres][k4],Tqresult[nres][k4]); + fprintf(ficgp," V%d=%f ",Tvqresult[nres][k4],Tqresult[nres][k4]); } fprintf(ficgp,"\n#\n"); if(invalidvarcomb[k1]){ @@ -6372,25 +6375,24 @@ plot [%.f:%.f] \"%s\" every :::%d::%d u /*3eme*/ - for (k1=1; k1<= m ; k1 ++) { + for (k1=1; k1<= m ; k1 ++) + for(nres=1; nres <= nresult; nres++){ /* For each resultline */ + if(TKresult[nres]!= k) + continue; for (cpt=1; cpt<= nlstate ; cpt ++) { - fprintf(ficgp,"\n# 3d: Life expectancy with EXP_ files: cov=%d state=%d",k1, cpt); - for(nres=1; nres <= nresult; nres++) /* For each resultline */ + fprintf(ficgp,"\n# 3d: Life expectancy with EXP_ files: combination=%d state=%d",k1, cpt); for (k=1; k<=cptcoveff; k++){ /* For each covariate and each value */ - if(TKresult[nres]!= k) - continue; 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 */ /* decodtabm(1,2,4) = 1 because h=1 k= 1 (1) 1 1 */ /* decodtabm(13,3,4)= 2 because h=13 k= 1 1 (2) 2 */ vlv= nbcode[Tvaraff[k]][lv]; fprintf(ficgp," V%d=%d ",Tvaraff[k],vlv); - for (k4=1; k4<= nsq; k4++){ /* For each selected (single) quantitative value */ - printf(" V%d=%f ",Tvqresult[nres][k4],Tqresult[nres][k4]); - fprintf(ficgp," V%d=%f ",Tvqresult[nres][k4],Tqresult[nres][k4]); - } } + for (k4=1; k4<= nsq; k4++){ /* For each selected (single) quantitative value */ + fprintf(ficgp," V%d=%f ",Tvqresult[nres][k4],Tqresult[nres][k4]); + } fprintf(ficgp,"\n#\n"); if(invalidvarcomb[k1]){ fprintf(ficgp,"#Combination (%d) ignored because no cases \n",k1); @@ -6421,11 +6423,13 @@ plot [%.f:%.f] \"%s\" every :::%d::%d u /* 4eme */ /* Survival functions (period) from state i in state j by initial state i */ - for (k1=1; k1<= m ; k1 ++) { /* For each multivariate if any */ + for (k=1; k<=cptcoveff; k++){ /* For each covariate and each value */ + for(nres=1; nres <= nresult; nres++) /* For each resultline */ + if(TKresult[nres]!= k) + continue; for (cpt=1; cpt<=nlstate ; cpt ++) { /* For each life state */ fprintf(ficgp,"\n#\n#\n# Survival functions in state j : 'LIJ_' files, cov=%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 */ /* decodtabm(1,2,4) = 1 because h=1 k= 1 (1) 1 1 */ @@ -6433,6 +6437,9 @@ plot [%.f:%.f] \"%s\" every :::%d::%d u vlv= nbcode[Tvaraff[k]][lv]; fprintf(ficgp," V%d=%d ",Tvaraff[k],vlv); } + for (k4=1; k4<= nsq; k4++){ /* For each selected (single) quantitative value */ + fprintf(ficgp," V%d=%f ",Tvqresult[nres][k4],Tqresult[nres][k4]); + } fprintf(ficgp,"\n#\n"); if(invalidvarcomb[k1]){ fprintf(ficgp,"#Combination (%d) ignored because no cases \n",k1); @@ -6463,7 +6470,10 @@ plot [%.f:%.f] ", ageminpar, agemaxpar) /* 5eme */ /* Survival functions (period) from state i in state j by final state j */ - for (k1=1; k1<= m ; k1 ++) { /* For each covariate if any */ + for (k1=1; k1<= m ; k1 ++) /* For each covariate combination if any */ + for(nres=1; nres <= nresult; nres++){ /* For each resultline */ + if(TKresult[nres]!= k1) + continue; for (cpt=1; cpt<=nlstate ; cpt ++) { /* For each inital state */ fprintf(ficgp,"\n#\n#\n# Survival functions in state j and all livestates from state i by final state j: 'lij' files, cov=%d state=%d",k1, cpt); @@ -6475,6 +6485,9 @@ plot [%.f:%.f] ", ageminpar, agemaxpar) vlv= nbcode[Tvaraff[k]][lv]; fprintf(ficgp," V%d=%d ",Tvaraff[k],vlv); } + for (k4=1; k4<= nsq; k4++){ /* For each selected (single) quantitative value */ + fprintf(ficgp," V%d=%f ",Tvqresult[nres][k4],Tqresult[nres][k4]); + } fprintf(ficgp,"\n#\n"); if(invalidvarcomb[k1]){ fprintf(ficgp,"#Combination (%d) ignored because no cases \n",k1); @@ -8003,12 +8016,12 @@ int decoderesult ( char resultline[], in strcpy(resultsav,stra); /* and analyzes it */ } /* Checking for missing or useless values in comparison of current model needs */ - for(k1=1; k1<= cptcovt ;k1++){ /* model line */ - if(Typevar[k1]==0){ + for(k1=1; k1<= cptcovt ;k1++){ /* model line V5+V4+V3+V4*V3+V5*age+V2+V1*V2+V1*age+V1 */ + if(Typevar[k1]==0){ /* Single covariate in model */ match=0; - for(k2=1; k2 <=j;k2++){ - if(Tvar[k1]==Tvarsel[k2]) { - modelresult[k2]=k1; + for(k2=1; k2 <=j;k2++){/* result line V4=1 V5=24.1 V3=1 V2=8 V1=0 */ + if(Tvar[k1]==Tvarsel[k2]) {/* Tvar[2]=5 == Tvarsel[1]=4 */ + modelresult[k2]=k1;/* modelresult[2]=1 modelresult[1]=2 modelresult[3]=3 modelresult[6]=4 modelresult[9]=5 */ match=1; break; }