]> henry.ined.fr Git - .git/commitdiff
*** empty log message ***
authorN. Brouard <brouard@ined.fr>
Thu, 25 Aug 2016 10:50:18 +0000 (10:50 +0000)
committerN. Brouard <brouard@ined.fr>
Thu, 25 Aug 2016 10:50:18 +0000 (10:50 +0000)
src/imach.c

index c0fce0f547012d4017b0e562968a00b23a864d96..5636832c584f70d24ff483344afdb0686bce5ea9 100644 (file)
@@ -1,6 +1,9 @@
 /* $Id$
   $State$
   $Log$
+  Revision 1.235  2016/08/25 06:59:23  brouard
+  *** empty log message ***
+
   Revision 1.234  2016/08/23 16:51:20  brouard
   *** empty log message ***
 
@@ -6226,8 +6229,8 @@ void printinggnuplot(char fileresu[], char optionfilefiname[], double ageminpar,
   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;
@@ -6311,22 +6314,22 @@ plot [%.f:%.f] \"%s\" every :::%d::%d u 1:2 \"%%lf",ageminpar,fage,subdirf2(file
 
   
   /*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]){
@@ -6369,25 +6372,24 @@ plot [%.f:%.f] \"%s\" every :::%d::%d u 1:2 \"%%lf",ageminpar,fage,subdirf2(file
        
        
   /*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); 
@@ -6418,11 +6420,13 @@ plot [%.f:%.f] \"%s\" every :::%d::%d u 1:%d t \"e%d1\" w l",ageminpar,fage,subd
   
   /* 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 */
@@ -6430,6 +6434,9 @@ plot [%.f:%.f] \"%s\" every :::%d::%d u 1:%d t \"e%d1\" w l",ageminpar,fage,subd
        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); 
@@ -6460,7 +6467,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);
@@ -6472,6 +6482,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); 
@@ -8000,12 +8013,12 @@ int decoderesult ( char resultline[], int nres)
       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;
        }