|
|
| version 1.263, 2017/04/24 15:23:15 | version 1.264, 2017/04/26 06:01:29 |
|---|---|
| Line 1 | Line 1 |
| /* $Id$ | /* $Id$ |
| $State$ | $State$ |
| $Log$ | $Log$ |
| Revision 1.264 2017/04/26 06:01:29 brouard | |
| Summary: Labels in graphs | |
| Revision 1.263 2017/04/24 15:23:15 brouard | Revision 1.263 2017/04/24 15:23:15 brouard |
| Summary: to save | Summary: to save |
| Line 2615 Earliest age to start was %d-%d=%d, ncvl | Line 2618 Earliest age to start was %d-%d=%d, ncvl |
| /* double **bprevalim(double **bprlim, double ***prevacurrent, int nlstate, double x[], double age, double **oldm, double **savm, double **dnewm, double **doldm, double **dsavm, double ftolpl, int *ncvyear, int ij) */ | /* double **bprevalim(double **bprlim, double ***prevacurrent, int nlstate, double x[], double age, double **oldm, double **savm, double **dnewm, double **doldm, double **dsavm, double ftolpl, int *ncvyear, int ij) */ |
| double **bprevalim(double **bprlim, double ***prevacurrent, int nlstate, double x[], double age, double ftolpl, int *ncvyear, int ij, int nres) | double **bprevalim(double **bprlim, double ***prevacurrent, int nlstate, double x[], double age, double ftolpl, int *ncvyear, int ij, int nres) |
| { | { |
| /* Computes the prevalence limit in each live state at age x and covariate ij by left multiplying the unit | /* Computes the prevalence limit in each live state at age x and for covariate combination ij (<=2**cptcoveff) by left multiplying the unit |
| matrix by transitions matrix until convergence is reached with precision ftolpl */ | matrix by transitions matrix until convergence is reached with precision ftolpl */ |
| /* Wx= Wx-1 Px-1= Wx-2 Px-2 Px-1 = Wx-n Px-n ... Px-2 Px-1 I */ | /* Wx= Wx-1 Px-1= Wx-2 Px-2 Px-1 = Wx-n Px-n ... Px-2 Px-1 I */ |
| /* Wx is row vector: population in state 1, population in state 2, population dead */ | /* Wx is row vector: population in state 1, population in state 2, population dead */ |
| Line 2676 Earliest age to start was %d-%d=%d, ncvl | Line 2679 Earliest age to start was %d-%d=%d, ncvl |
| for (k=1; k<=nsd;k++) { /* For single dummy covariates only */ | for (k=1; k<=nsd;k++) { /* For single dummy covariates only */ |
| /* Here comes the value of the covariate 'ij' after renumbering k with single dummy covariates */ | /* Here comes the value of the covariate 'ij' after renumbering k with single dummy covariates */ |
| cov[2+nagesqr+TvarsDind[k]]=nbcode[TvarsD[k]][codtabm(ij,k)]; | cov[2+nagesqr+TvarsDind[k]]=nbcode[TvarsD[k]][codtabm(ij,k)]; |
| /* printf("bprevalim Dummy combi=%d k=%d TvarsD[%d]=V%d TvarsDind[%d]=%d nbcode=%d cov=%lf codtabm(%d,Tvar[%d])=%d \n",ij,k, k, TvarsD[k],k,TvarsDind[k],nbcode[TvarsD[k]][codtabm(ij,k)],cov[2+nagesqr+TvarsDind[k]], ij, k, codtabm(ij,k)); */ | /* printf("bprevalim Dummy agefin=%.0f combi=%d k=%d TvarsD[%d]=V%d TvarsDind[%d]=%d nbcode=%d cov[%d]=%lf codtabm(%d,Tvar[%d])=%d \n",agefin,ij,k, k, TvarsD[k],k,TvarsDind[k],nbcode[TvarsD[k]][codtabm(ij,k)],2+nagesqr+TvarsDind[k],cov[2+nagesqr+TvarsDind[k]], ij, k, codtabm(ij,k)); */ |
| } | } |
| /* for (k=1; k<=cptcovn;k++) { */ | /* for (k=1; k<=cptcovn;k++) { */ |
| /* /\* cov[2+nagesqr+k]=nbcode[Tvar[k]][codtabm(ij,Tvar[k])]; *\/ */ | /* /\* cov[2+nagesqr+k]=nbcode[Tvar[k]][codtabm(ij,Tvar[k])]; *\/ */ |
| Line 4619 Title=%s <br>Datafile=%s Firstpass=%d La | Line 4622 Title=%s <br>Datafile=%s Firstpass=%d La |
| if( iage <= iagemax){ | if( iage <= iagemax){ |
| if(pos>=1.e-5){ | if(pos>=1.e-5){ |
| fprintf(ficresp," %d %.5f %.0f %.0f",iage,prop[jk][iage]/pospropta, prop[jk][iage],pospropta); | fprintf(ficresp," %d %.5f %.0f %.0f",iage,prop[jk][iage]/pospropta, prop[jk][iage],pospropta); |
| /* fprintf(ficresp, "%d %d %d %.5f %.0f %.0f",Tvaraff[z1],nbcode[Tvaraff[z1]][codtabm(j1,z1)],iage,prop[jk][iage]/pospropta, prop[jk][iage],pospropta); */ | |
| fprintf(ficresphtm,"<th>%d</th><td>%.5f</td><td>%.0f</td><td>%.0f</td>",iage,prop[jk][iage]/pospropta, prop[jk][iage],pospropta); | fprintf(ficresphtm,"<th>%d</th><td>%.5f</td><td>%.0f</td><td>%.0f</td>",iage,prop[jk][iage]/pospropta, prop[jk][iage],pospropta); |
| /*probs[iage][jk][j1]= pp[jk]/pos;*/ | /*probs[iage][jk][j1]= pp[jk]/pos;*/ |
| /*printf("\niage=%d jk=%d j1=%d %.5f %.0f %.0f %f",iage,jk,j1,pp[jk]/pos, pp[jk],pos,probs[iage][jk][j1]);*/ | /*printf("\niage=%d jk=%d j1=%d %.5f %.0f %.0f %f",iage,jk,j1,pp[jk]/pos, pp[jk],pos,probs[iage][jk][j1]);*/ |
| Line 6435 void printinghtml(char fileresu[], char | Line 6440 void printinghtml(char fileresu[], char |
| <a href=\"%s\">%s</a> <br>\n</li>", subdirf2(fileresu,"F_"),subdirf2(fileresu,"F_")); | <a href=\"%s\">%s</a> <br>\n</li>", subdirf2(fileresu,"F_"),subdirf2(fileresu,"F_")); |
| } | } |
| fprintf(fichtm," \n<ul><li><b>Graphs</b></li><p>"); | |
| m=pow(2,cptcoveff); | m=pow(2,cptcoveff); |
| if (cptcovn < 1) {m=1;ncodemax[1]=1;} | if (cptcovn < 1) {m=1;ncodemax[1]=1;} |
| fprintf(fichtm," \n<ul><li><b>Graphs</b></li><p>"); | |
| jj1=0; | |
| fprintf(fichtm," \n<ul>"); | |
| for(nres=1; nres <= nresult; nres++) /* For each resultline */ | |
| for(k1=1; k1<=m;k1++){ /* For each combination of covariate */ | |
| if(m != 1 && TKresult[nres]!= k1) | |
| continue; | |
| jj1++; | |
| if (cptcovn > 0) { | |
| fprintf(fichtm,"\n<li><a size=\"1\" color=\"#EC5E5E\" href=\"#rescov"); | |
| for (cpt=1; cpt<=cptcoveff;cpt++){ | |
| fprintf(fichtm,"_V%d=%d_",Tvresult[nres][cpt],(int)Tresult[nres][cpt]); | |
| } | |
| for (k4=1; k4<= nsq; k4++){ /* For each selected (single) quantitative value */ | |
| fprintf(fichtm,"_V%d=%f_",Tvqresult[nres][k4],Tqresult[nres][k4]); | |
| } | |
| fprintf(fichtm,"\">"); | |
| /* if(nqfveff+nqtveff 0) */ /* Test to be done */ | |
| fprintf(fichtm,"************ Results for covariates"); | |
| for (cpt=1; cpt<=cptcoveff;cpt++){ | |
| fprintf(fichtm," V%d=%d ",Tvresult[nres][cpt],(int)Tresult[nres][cpt]); | |
| } | |
| for (k4=1; k4<= nsq; k4++){ /* For each selected (single) quantitative value */ | |
| fprintf(fichtm," V%d=%f ",Tvqresult[nres][k4],Tqresult[nres][k4]); | |
| } | |
| if(invalidvarcomb[k1]){ | |
| fprintf(fichtm," Warning Combination (%d) ignored because no cases ",k1); | |
| continue; | |
| } | |
| fprintf(fichtm,"</a></li>"); | |
| } /* cptcovn >0 */ | |
| } | |
| fprintf(fichtm," \n</ul>"); | |
| jj1=0; | jj1=0; |
| for(nres=1; nres <= nresult; nres++) /* For each resultline */ | for(nres=1; nres <= nresult; nres++) /* For each resultline */ |
| Line 6450 void printinghtml(char fileresu[], char | Line 6491 void printinghtml(char fileresu[], char |
| /* for(i1=1; i1<=ncodemax[k1];i1++){ */ | /* for(i1=1; i1<=ncodemax[k1];i1++){ */ |
| jj1++; | jj1++; |
| if (cptcovn > 0) { | if (cptcovn > 0) { |
| fprintf(fichtm,"\n<p><a name=\"rescov"); | |
| for (cpt=1; cpt<=cptcoveff;cpt++){ | |
| fprintf(fichtm,"_V%d=%d_",Tvresult[nres][cpt],(int)Tresult[nres][cpt]); | |
| } | |
| for (k4=1; k4<= nsq; k4++){ /* For each selected (single) quantitative value */ | |
| fprintf(fichtm,"_V%d=%f_",Tvqresult[nres][k4],Tqresult[nres][k4]); | |
| } | |
| fprintf(fichtm,"\"</a>"); | |
| fprintf(fichtm,"<hr size=\"2\" color=\"#EC5E5E\">************ Results for covariates"); | fprintf(fichtm,"<hr size=\"2\" color=\"#EC5E5E\">************ Results for covariates"); |
| for (cpt=1; cpt<=cptcoveff;cpt++){ | for (cpt=1; cpt<=cptcoveff;cpt++){ |
| fprintf(fichtm," V%d=%d ",Tvresult[nres][cpt],(int)Tresult[nres][cpt]); | fprintf(fichtm," V%d=%d ",Tvresult[nres][cpt],(int)Tresult[nres][cpt]); |
| Line 6495 divided by h: <sub>h</sub>P<sub>ij</sub> | Line 6545 divided by h: <sub>h</sub>P<sub>ij</sub> |
| } | } |
| /* Period (stable) prevalence in each health state */ | /* Period (stable) prevalence in each health state */ |
| for(cpt=1; cpt<=nlstate;cpt++){ | for(cpt=1; cpt<=nlstate;cpt++){ |
| fprintf(fichtm,"<br>\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. <a href=\"%s_%d-%d-%d.svg\">%s_%d-%d-%d.svg</a><br> \ | fprintf(fichtm,"<br>\n- Convergence to period (stable) prevalence in state %d. Or probability for a person being in state (1 to %d) at different ages, to be in state %d some years after. <a href=\"%s_%d-%d-%d.svg\">%s_%d-%d-%d.svg</a><br> \ |
| <img src=\"%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); | <img src=\"%s_%d-%d-%d.svg\">", cpt, nlstate, cpt, subdirf2(optionfilefiname,"P_"),cpt,k1,nres,subdirf2(optionfilefiname,"P_"),cpt,k1,nres,subdirf2(optionfilefiname,"P_"),cpt,k1,nres); |
| } | } |
| if(backcast==1){ | if(backcast==1){ |
| /* Period (stable) back prevalence in each health state */ | /* Period (stable) back prevalence in each health state */ |
| for(cpt=1; cpt<=nlstate;cpt++){ | for(cpt=1; cpt<=nlstate;cpt++){ |
| fprintf(fichtm,"<br>\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. <a href=\"%s_%d-%d-%d.svg\">%s_%d-%d-%d.svg</a><br> \ | fprintf(fichtm,"<br>\n- Convergence to mixed (stable) back prevalence in state %d. Or probability for a person to be in state %d at a younger age, knowing that she/he was in state (1 to %d) at different older ages. <a href=\"%s_%d-%d-%d.svg\">%s_%d-%d-%d.svg</a><br> \ |
| <img src=\"%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); | <img src=\"%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); |
| } | } |
| } | } |
| Line 6618 true period expectancies (those weighted | Line 6668 true period expectancies (those weighted |
| void printinggnuplot(char fileresu[], char optionfilefiname[], double ageminpar, double agemaxpar, double fage , int prevfcast, int backcast, char pathc[], double p[]){ | void printinggnuplot(char fileresu[], char optionfilefiname[], double ageminpar, double agemaxpar, double fage , int prevfcast, int backcast, char pathc[], double p[]){ |
| char dirfileres[132],optfileres[132]; | char dirfileres[132],optfileres[132]; |
| char gplotcondition[132]; | char gplotcondition[132], gplotlabel[132]; |
| int cpt=0,k1=0,i=0,k=0,j=0,jk=0,k2=0,k3=0,k4=0,ij=0, ijp=0, l=0; | int cpt=0,k1=0,i=0,k=0,j=0,jk=0,k2=0,k3=0,k4=0,ij=0, ijp=0, l=0; |
| int lv=0, vlv=0, kl=0; | int lv=0, vlv=0, kl=0; |
| int ng=0; | int ng=0; |
| Line 6677 void printinggnuplot(char fileresu[], ch | Line 6727 void printinggnuplot(char fileresu[], ch |
| /* We are interested in selected combination by the resultline */ | /* We are interested in selected combination by the resultline */ |
| /* printf("\n# 1st: Period (stable) prevalence with CI: 'VPL_' files and live state =%d ", cpt); */ | /* printf("\n# 1st: Period (stable) prevalence with CI: 'VPL_' files and live state =%d ", cpt); */ |
| fprintf(ficgp,"\n# 1st: Period (stable) prevalence with CI: 'VPL_' files and live state =%d ", cpt); | fprintf(ficgp,"\n# 1st: Period (stable) prevalence with CI: 'VPL_' files and live state =%d ", cpt); |
| strcpy(gplotlabel,"("); | |
| for (k=1; k<=cptcoveff; k++){ /* For each covariate k get corresponding value lv for combination k1 */ | for (k=1; k<=cptcoveff; k++){ /* For each covariate k get corresponding value lv for combination k1 */ |
| lv= decodtabm(k1,k,cptcoveff); /* Should be the value of the covariate corresponding to k1 combination */ | lv= decodtabm(k1,k,cptcoveff); /* Should be the value of the covariate corresponding to k1 combination */ |
| /* decodtabm(1,1,4) = 1 because h=1 k= (1) 1 1 1 */ | /* decodtabm(1,1,4) = 1 because h=1 k= (1) 1 1 1 */ |
| Line 6686 void printinggnuplot(char fileresu[], ch | Line 6737 void printinggnuplot(char fileresu[], ch |
| /* For each combination of covariate k1 (V1=1, V3=0), we printed the current covariate k and its value vlv */ | /* For each combination of covariate k1 (V1=1, V3=0), we printed the current covariate k and its value vlv */ |
| /* printf(" V%d=%d ",Tvaraff[k],vlv); */ | /* printf(" V%d=%d ",Tvaraff[k],vlv); */ |
| fprintf(ficgp," V%d=%d ",Tvaraff[k],vlv); | fprintf(ficgp," V%d=%d ",Tvaraff[k],vlv); |
| sprintf(gplotlabel+strlen(gplotlabel)," V%d=%d ",Tvaraff[k],vlv); | |
| } | } |
| for (k4=1; k4<= nsq; k4++){ /* For each selected (single) quantitative value */ | for (k4=1; k4<= nsq; k4++){ /* For each selected (single) quantitative value */ |
| /* printf(" V%d=%f ",Tvqresult[nres][k4],Tqresult[nres][k4]); */ | /* printf(" V%d=%f ",Tvqresult[nres][k4],Tqresult[nres][k4]); */ |
| fprintf(ficgp," V%d=%f ",Tvqresult[nres][k4],Tqresult[nres][k4]); | fprintf(ficgp," V%d=%f ",Tvqresult[nres][k4],Tqresult[nres][k4]); |
| } | sprintf(gplotlabel+strlen(gplotlabel)," V%d=%f ",Tvqresult[nres][k4],Tqresult[nres][k4]); |
| } | |
| strcpy(gplotlabel+strlen(gplotlabel),")"); | |
| /* printf("\n#\n"); */ | /* printf("\n#\n"); */ |
| fprintf(ficgp,"\n#\n"); | fprintf(ficgp,"\n#\n"); |
| if(invalidvarcomb[k1]){ | if(invalidvarcomb[k1]){ |
| Line 6701 void printinggnuplot(char fileresu[], ch | Line 6755 void printinggnuplot(char fileresu[], ch |
| fprintf(ficgp,"\nset out \"%s_%d-%d-%d.svg\" \n",subdirf2(optionfilefiname,"V_"),cpt,k1,nres); | 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,"\n#set out \"V_%s_%d-%d-%d.svg\" \n",optionfilefiname,cpt,k1,nres); |
| fprintf(ficgp,"set label \"Alive state %d %s\" at graph 0.98,0.5 center rotate font \"Helvetica,12\"\n",cpt,gplotlabel); | |
| 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_"),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); */ | /* 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*/ | /* k1-1 error should be nres-1*/ |
| Line 6747 void printinggnuplot(char fileresu[], ch | Line 6802 void printinggnuplot(char fileresu[], ch |
| } /* end covariate */ | } /* end covariate */ |
| } /* end if no covariate */ | } /* end if no covariate */ |
| } /* end if backcast */ | } /* end if backcast */ |
| fprintf(ficgp,"\nset out \n"); | fprintf(ficgp,"\nset out ;unset label;\n"); |
| } /* nres */ | } /* nres */ |
| } /* k1 */ | } /* k1 */ |
| } /* cpt */ | } /* cpt */ |
| Line 6759 void printinggnuplot(char fileresu[], ch | Line 6814 void printinggnuplot(char fileresu[], ch |
| if(m != 1 && TKresult[nres]!= k1) | if(m != 1 && TKresult[nres]!= k1) |
| continue; | continue; |
| fprintf(ficgp,"\n# 2nd: Total life expectancy with CI: 't' files "); | fprintf(ficgp,"\n# 2nd: Total life expectancy with CI: 't' files "); |
| strcpy(gplotlabel,"("); | |
| for (k=1; k<=cptcoveff; k++){ /* For each covariate and each value */ | 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 */ | 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,1,4) = 1 because h=1 k= (1) 1 1 1 */ |
| Line 6766 void printinggnuplot(char fileresu[], ch | Line 6822 void printinggnuplot(char fileresu[], ch |
| /* decodtabm(13,3,4)= 2 because h=13 k= 1 1 (2) 2 */ | /* decodtabm(13,3,4)= 2 because h=13 k= 1 1 (2) 2 */ |
| vlv= nbcode[Tvaraff[k]][lv]; | vlv= nbcode[Tvaraff[k]][lv]; |
| fprintf(ficgp," V%d=%d ",Tvaraff[k],vlv); | fprintf(ficgp," V%d=%d ",Tvaraff[k],vlv); |
| sprintf(gplotlabel+strlen(gplotlabel)," V%d=%d ",Tvaraff[k],vlv); | |
| } | } |
| /* for(k=1; k <= ncovds; k++){ */ | /* for(k=1; k <= ncovds; k++){ */ |
| for (k4=1; k4<= nsq; k4++){ /* For each selected (single) quantitative value */ | for (k4=1; k4<= nsq; k4++){ /* For each selected (single) quantitative value */ |
| printf(" V%d=%f ",Tvqresult[nres][k4],Tqresult[nres][k4]); | printf(" V%d=%f ",Tvqresult[nres][k4],Tqresult[nres][k4]); |
| fprintf(ficgp," V%d=%f ",Tvqresult[nres][k4],Tqresult[nres][k4]); | fprintf(ficgp," V%d=%f ",Tvqresult[nres][k4],Tqresult[nres][k4]); |
| sprintf(gplotlabel+strlen(gplotlabel)," V%d=%f ",Tvqresult[nres][k4],Tqresult[nres][k4]); | |
| } | } |
| strcpy(gplotlabel+strlen(gplotlabel),")"); | |
| fprintf(ficgp,"\n#\n"); | fprintf(ficgp,"\n#\n"); |
| if(invalidvarcomb[k1]){ | if(invalidvarcomb[k1]){ |
| fprintf(ficgp,"#Combination (%d) ignored because no cases \n",k1); | fprintf(ficgp,"#Combination (%d) ignored because no cases \n",k1); |
| Line 6780 void printinggnuplot(char fileresu[], ch | Line 6839 void printinggnuplot(char fileresu[], ch |
| fprintf(ficgp,"\nset out \"%s_%d-%d.svg\" \n",subdirf2(optionfilefiname,"E_"),k1,nres); | fprintf(ficgp,"\nset out \"%s_%d-%d.svg\" \n",subdirf2(optionfilefiname,"E_"),k1,nres); |
| for(vpopbased=0; vpopbased <= popbased; vpopbased++){ /* Done for vpopbased=0 and vpopbased=1 if popbased==1*/ | for(vpopbased=0; vpopbased <= popbased; vpopbased++){ /* Done for vpopbased=0 and vpopbased=1 if popbased==1*/ |
| if(vpopbased==0) | fprintf(ficgp,"\nset label \"popbased %d %s\" at graph 0.98,0.5 center rotate font \"Helvetica,12\"\n",vpopbased,gplotlabel); |
| if(vpopbased==0){ | |
| fprintf(ficgp,"set ylabel \"Years\" \nset ter svg size 640, 480\nplot [%.f:%.f] ",ageminpar,fage); | fprintf(ficgp,"set ylabel \"Years\" \nset ter svg size 640, 480\nplot [%.f:%.f] ",ageminpar,fage); |
| else | }else |
| fprintf(ficgp,"\nreplot "); | fprintf(ficgp,"\nreplot "); |
| for (i=1; i<= nlstate+1 ; i ++) { | for (i=1; i<= nlstate+1 ; i ++) { |
| k=2*i; | k=2*i; |
| Line 6808 void printinggnuplot(char fileresu[], ch | Line 6868 void printinggnuplot(char fileresu[], ch |
| else fprintf(ficgp,"\" t\"\" w l lt 0,\\\n"); | else fprintf(ficgp,"\" t\"\" w l lt 0,\\\n"); |
| } /* state */ | } /* state */ |
| } /* vpopbased */ | } /* vpopbased */ |
| fprintf(ficgp,"\nset out;set out \"%s_%d-%d.svg\"; replot; set out; \n",subdirf2(optionfilefiname,"E_"),k1,nres); /* Buggy gnuplot */ | fprintf(ficgp,"\nset out;set out \"%s_%d-%d.svg\"; replot; set out; unset label;\n",subdirf2(optionfilefiname,"E_"),k1,nres); /* Buggy gnuplot */ |
| } /* end nres */ | } /* end nres */ |
| } /* k1 end 2 eme*/ | } /* k1 end 2 eme*/ |
| Line 6821 void printinggnuplot(char fileresu[], ch | Line 6881 void printinggnuplot(char fileresu[], ch |
| for (cpt=1; cpt<= nlstate ; cpt ++) { | for (cpt=1; cpt<= nlstate ; cpt ++) { |
| fprintf(ficgp,"\n\n# 3d: Life expectancy with EXP_ files: combination=%d state=%d",k1, cpt); | fprintf(ficgp,"\n\n# 3d: Life expectancy with EXP_ files: combination=%d state=%d",k1, cpt); |
| strcpy(gplotlabel,"("); | |
| for (k=1; k<=cptcoveff; k++){ /* For each covariate and each value */ | 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 */ | 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,1,4) = 1 because h=1 k= (1) 1 1 1 */ |
| Line 6828 void printinggnuplot(char fileresu[], ch | Line 6889 void printinggnuplot(char fileresu[], ch |
| /* decodtabm(13,3,4)= 2 because h=13 k= 1 1 (2) 2 */ | /* decodtabm(13,3,4)= 2 because h=13 k= 1 1 (2) 2 */ |
| vlv= nbcode[Tvaraff[k]][lv]; | vlv= nbcode[Tvaraff[k]][lv]; |
| fprintf(ficgp," V%d=%d ",Tvaraff[k],vlv); | fprintf(ficgp," V%d=%d ",Tvaraff[k],vlv); |
| sprintf(gplotlabel+strlen(gplotlabel)," V%d=%d ",Tvaraff[k],vlv); | |
| } | } |
| for (k4=1; k4<= nsq; k4++){ /* For each selected (single) quantitative value */ | 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," V%d=%f ",Tvqresult[nres][k4],Tqresult[nres][k4]); |
| sprintf(gplotlabel+strlen(gplotlabel)," V%d=%f ",Tvqresult[nres][k4],Tqresult[nres][k4]); | |
| } | } |
| strcpy(gplotlabel+strlen(gplotlabel),")"); | |
| fprintf(ficgp,"\n#\n"); | fprintf(ficgp,"\n#\n"); |
| if(invalidvarcomb[k1]){ | if(invalidvarcomb[k1]){ |
| fprintf(ficgp,"#Combination (%d) ignored because no cases \n",k1); | fprintf(ficgp,"#Combination (%d) ignored because no cases \n",k1); |
| Line 6841 void printinggnuplot(char fileresu[], ch | Line 6905 void printinggnuplot(char fileresu[], ch |
| /* k=2+nlstate*(2*cpt-2); */ | /* k=2+nlstate*(2*cpt-2); */ |
| k=2+(nlstate+1)*(cpt-1); | k=2+(nlstate+1)*(cpt-1); |
| fprintf(ficgp,"\nset out \"%s_%d-%d-%d.svg\" \n",subdirf2(optionfilefiname,"EXP_"),cpt,k1,nres); | fprintf(ficgp,"\nset out \"%s_%d-%d-%d.svg\" \n",subdirf2(optionfilefiname,"EXP_"),cpt,k1,nres); |
| fprintf(ficgp,"set label \"%s\" at graph 0.98,0.5 center rotate font \"Helvetica,12\"\n",gplotlabel); | |
| fprintf(ficgp,"set ter svg size 640, 480\n\ | fprintf(ficgp,"set ter svg size 640, 480\n\ |
| plot [%.f:%.f] \"%s\" every :::%d::%d u 1:%d t \"e%d1\" w l",ageminpar,fage,subdirf2(fileresu,"E_"),nres-1,nres-1,k,cpt); | plot [%.f:%.f] \"%s\" every :::%d::%d u 1:%d t \"e%d1\" w l",ageminpar,fage,subdirf2(fileresu,"E_"),nres-1,nres-1,k,cpt); |
| /*fprintf(ficgp,",\"e%s\" every :::%d::%d u 1:($%d-2*$%d) \"\%%lf ",fileres,k1-1,k1-1,k,k+1); | /*fprintf(ficgp,",\"e%s\" every :::%d::%d u 1:($%d-2*$%d) \"\%%lf ",fileres,k1-1,k1-1,k,k+1); |
| Line 6858 plot [%.f:%.f] \"%s\" every :::%d::%d u | Line 6923 plot [%.f:%.f] \"%s\" every :::%d::%d u |
| } | } |
| fprintf(ficgp," ,\"%s\" every :::%d::%d u 1:%d t \"e%d.\" w l",subdirf2(fileresu,"E_"),nres-1,nres-1,k+nlstate,cpt); | fprintf(ficgp," ,\"%s\" every :::%d::%d u 1:%d t \"e%d.\" w l",subdirf2(fileresu,"E_"),nres-1,nres-1,k+nlstate,cpt); |
| } | } |
| fprintf(ficgp,"\nunset label;\n"); | |
| } /* end nres */ | } /* end nres */ |
| } /* end kl 3eme */ | } /* end kl 3eme */ |
| Line 6868 plot [%.f:%.f] \"%s\" every :::%d::%d u | Line 6934 plot [%.f:%.f] \"%s\" every :::%d::%d u |
| if(m != 1 && TKresult[nres]!= k1) | if(m != 1 && TKresult[nres]!= k1) |
| continue; | continue; |
| for (cpt=1; cpt<=nlstate ; cpt ++) { /* For each life state cpt*/ | for (cpt=1; cpt<=nlstate ; cpt ++) { /* For each life state cpt*/ |
| strcpy(gplotlabel,"("); | |
| fprintf(ficgp,"\n#\n#\n# Survival functions in state j : 'LIJ_' files, cov=%d state=%d",k1, cpt); | 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 */ | 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 */ | lv= decodtabm(k1,k,cptcoveff); /* Should be the covariate number corresponding to k1 combination */ |
| Line 6876 plot [%.f:%.f] \"%s\" every :::%d::%d u | Line 6943 plot [%.f:%.f] \"%s\" every :::%d::%d u |
| /* decodtabm(13,3,4)= 2 because h=13 k= 1 1 (2) 2 */ | /* decodtabm(13,3,4)= 2 because h=13 k= 1 1 (2) 2 */ |
| vlv= nbcode[Tvaraff[k]][lv]; | vlv= nbcode[Tvaraff[k]][lv]; |
| fprintf(ficgp," V%d=%d ",Tvaraff[k],vlv); | fprintf(ficgp," V%d=%d ",Tvaraff[k],vlv); |
| sprintf(gplotlabel+strlen(gplotlabel)," V%d=%d ",Tvaraff[k],vlv); | |
| } | } |
| for (k4=1; k4<= nsq; k4++){ /* For each selected (single) quantitative value */ | 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," V%d=%f ",Tvqresult[nres][k4],Tqresult[nres][k4]); |
| sprintf(gplotlabel+strlen(gplotlabel)," V%d=%f ",Tvqresult[nres][k4],Tqresult[nres][k4]); | |
| } | } |
| strcpy(gplotlabel+strlen(gplotlabel),")"); | |
| fprintf(ficgp,"\n#\n"); | fprintf(ficgp,"\n#\n"); |
| if(invalidvarcomb[k1]){ | if(invalidvarcomb[k1]){ |
| fprintf(ficgp,"#Combination (%d) ignored because no cases \n",k1); | fprintf(ficgp,"#Combination (%d) ignored because no cases \n",k1); |
| Line 6887 plot [%.f:%.f] \"%s\" every :::%d::%d u | Line 6957 plot [%.f:%.f] \"%s\" every :::%d::%d u |
| } | } |
| fprintf(ficgp,"\nset out \"%s_%d-%d-%d.svg\" \n",subdirf2(optionfilefiname,"LIJ_"),cpt,k1,nres); | fprintf(ficgp,"\nset out \"%s_%d-%d-%d.svg\" \n",subdirf2(optionfilefiname,"LIJ_"),cpt,k1,nres); |
| fprintf(ficgp,"set label \"Alive state %d %s\" at graph 0.98,0.5 center rotate font \"Helvetica,12\"\n",cpt,gplotlabel); | |
| fprintf(ficgp,"set xlabel \"Age\" \nset ylabel \"Probability to be alive\" \n\ | fprintf(ficgp,"set xlabel \"Age\" \nset ylabel \"Probability to be alive\" \n\ |
| set ter svg size 640, 480\nunset log y\nplot [%.f:%.f] ", ageminpar, agemaxpar); | set ter svg size 640, 480\nunset log y\nplot [%.f:%.f] ", ageminpar, agemaxpar); |
| k=3; | k=3; |
| Line 6902 set ter svg size 640, 480\nunset log y\n | Line 6973 set ter svg size 640, 480\nunset log y\n |
| fprintf(ficgp,"+$%d",k+l+j-1); | fprintf(ficgp,"+$%d",k+l+j-1); |
| fprintf(ficgp,")) t \"l(%d,%d)\" w l",i,cpt); | fprintf(ficgp,")) t \"l(%d,%d)\" w l",i,cpt); |
| } /* nlstate */ | } /* nlstate */ |
| fprintf(ficgp,"\nset out\n"); | fprintf(ficgp,"\nset out; unset label;\n"); |
| } /* end cpt state*/ | } /* end cpt state*/ |
| } /* end nres */ | } /* end nres */ |
| } /* end covariate k1 */ | } /* end covariate k1 */ |
| Line 6914 set ter svg size 640, 480\nunset log y\n | Line 6985 set ter svg size 640, 480\nunset log y\n |
| if(m != 1 && TKresult[nres]!= k1) | if(m != 1 && TKresult[nres]!= k1) |
| continue; | continue; |
| for (cpt=1; cpt<=nlstate ; cpt ++) { /* For each inital state */ | for (cpt=1; cpt<=nlstate ; cpt ++) { /* For each inital state */ |
| strcpy(gplotlabel,"("); | |
| 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); | 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); |
| for (k=1; k<=cptcoveff; k++){ /* For each covariate and each value */ | 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 */ | lv= decodtabm(k1,k,cptcoveff); /* Should be the covariate number corresponding to k1 combination */ |
| Line 6922 set ter svg size 640, 480\nunset log y\n | Line 6994 set ter svg size 640, 480\nunset log y\n |
| /* decodtabm(13,3,4)= 2 because h=13 k= 1 1 (2) 2 */ | /* decodtabm(13,3,4)= 2 because h=13 k= 1 1 (2) 2 */ |
| vlv= nbcode[Tvaraff[k]][lv]; | vlv= nbcode[Tvaraff[k]][lv]; |
| fprintf(ficgp," V%d=%d ",Tvaraff[k],vlv); | fprintf(ficgp," V%d=%d ",Tvaraff[k],vlv); |
| sprintf(gplotlabel+strlen(gplotlabel)," V%d=%d ",Tvaraff[k],vlv); | |
| } | } |
| for (k4=1; k4<= nsq; k4++){ /* For each selected (single) quantitative value */ | 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," V%d=%f ",Tvqresult[nres][k4],Tqresult[nres][k4]); |
| sprintf(gplotlabel+strlen(gplotlabel)," V%d=%f ",Tvqresult[nres][k4],Tqresult[nres][k4]); | |
| } | } |
| strcpy(gplotlabel+strlen(gplotlabel),")"); | |
| fprintf(ficgp,"\n#\n"); | fprintf(ficgp,"\n#\n"); |
| if(invalidvarcomb[k1]){ | if(invalidvarcomb[k1]){ |
| fprintf(ficgp,"#Combination (%d) ignored because no cases \n",k1); | fprintf(ficgp,"#Combination (%d) ignored because no cases \n",k1); |
| Line 6933 set ter svg size 640, 480\nunset log y\n | Line 7008 set ter svg size 640, 480\nunset log y\n |
| } | } |
| fprintf(ficgp,"\nset out \"%s_%d-%d-%d.svg\" \n",subdirf2(optionfilefiname,"LIJT_"),cpt,k1,nres); | fprintf(ficgp,"\nset out \"%s_%d-%d-%d.svg\" \n",subdirf2(optionfilefiname,"LIJT_"),cpt,k1,nres); |
| fprintf(ficgp,"set label \"Alive state %d %s\" at graph 0.98,0.5 center rotate font \"Helvetica,12\"\n",cpt,gplotlabel); | |
| fprintf(ficgp,"set xlabel \"Age\" \nset ylabel \"Probability to be alive\" \n\ | fprintf(ficgp,"set xlabel \"Age\" \nset ylabel \"Probability to be alive\" \n\ |
| set ter svg size 640, 480\nunset log y\nplot [%.f:%.f] ", ageminpar, agemaxpar); | set ter svg size 640, 480\nunset log y\nplot [%.f:%.f] ", ageminpar, agemaxpar); |
| k=3; | k=3; |
| Line 6956 set ter svg size 640, 480\nunset log y\n | Line 7032 set ter svg size 640, 480\nunset log y\n |
| else | else |
| fprintf(ficgp,"$%d) t\"l(%d,.)\" w l",k+l,cpt); | fprintf(ficgp,"$%d) t\"l(%d,.)\" w l",k+l,cpt); |
| } | } |
| fprintf(ficgp,"\nset out\n"); | fprintf(ficgp,"\nset out; unset label;\n"); |
| } /* end cpt state*/ | } /* end cpt state*/ |
| } /* end covariate */ | } /* end covariate */ |
| } /* end nres */ | } /* end nres */ |
| Line 6968 set ter svg size 640, 480\nunset log y\n | Line 7044 set ter svg size 640, 480\nunset log y\n |
| if(m != 1 && TKresult[nres]!= k1) | if(m != 1 && TKresult[nres]!= k1) |
| continue; | continue; |
| for (cpt=1; cpt<=nlstate ; cpt ++) { /* For each life state of arrival */ | for (cpt=1; cpt<=nlstate ; cpt ++) { /* For each life state of arrival */ |
| strcpy(gplotlabel,"("); | |
| fprintf(ficgp,"\n#\n#\n#CV preval stable (period): 'pij' files, covariatecombination#=%d state=%d",k1, cpt); | 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 */ | 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 */ | lv= decodtabm(k1,k,cptcoveff); /* Should be the covariate number corresponding to k1 combination */ |
| Line 6977 set ter svg size 640, 480\nunset log y\n | Line 7053 set ter svg size 640, 480\nunset log y\n |
| /* decodtabm(13,3,4)= 2 because h=13 k= 1 1 (2) 2 */ | /* decodtabm(13,3,4)= 2 because h=13 k= 1 1 (2) 2 */ |
| vlv= nbcode[Tvaraff[k]][lv]; | vlv= nbcode[Tvaraff[k]][lv]; |
| fprintf(ficgp," V%d=%d ",Tvaraff[k],vlv); | fprintf(ficgp," V%d=%d ",Tvaraff[k],vlv); |
| sprintf(gplotlabel+strlen(gplotlabel)," V%d=%d ",Tvaraff[k],vlv); | |
| } | } |
| for (k4=1; k4<= nsq; k4++){ /* For each selected (single) quantitative value */ | 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," V%d=%f ",Tvqresult[nres][k4],Tqresult[nres][k4]); |
| sprintf(gplotlabel+strlen(gplotlabel)," V%d=%f ",Tvqresult[nres][k4],Tqresult[nres][k4]); | |
| } | } |
| strcpy(gplotlabel+strlen(gplotlabel),")"); | |
| fprintf(ficgp,"\n#\n"); | fprintf(ficgp,"\n#\n"); |
| if(invalidvarcomb[k1]){ | if(invalidvarcomb[k1]){ |
| fprintf(ficgp,"#Combination (%d) ignored because no cases \n",k1); | fprintf(ficgp,"#Combination (%d) ignored because no cases \n",k1); |
| Line 6988 set ter svg size 640, 480\nunset log y\n | Line 7067 set ter svg size 640, 480\nunset log y\n |
| } | } |
| fprintf(ficgp,"\nset out \"%s_%d-%d-%d.svg\" \n",subdirf2(optionfilefiname,"P_"),cpt,k1,nres); | fprintf(ficgp,"\nset out \"%s_%d-%d-%d.svg\" \n",subdirf2(optionfilefiname,"P_"),cpt,k1,nres); |
| fprintf(ficgp,"set label \"Alive state %d %s\" at graph 0.98,0.5 center rotate font \"Helvetica,12\"\n",cpt,gplotlabel); | |
| fprintf(ficgp,"set xlabel \"Age\" \nset ylabel \"Probability\" \n\ | fprintf(ficgp,"set xlabel \"Age\" \nset ylabel \"Probability\" \n\ |
| set ter svg size 640, 480\nunset log y\nplot [%.f:%.f] ", ageminpar, agemaxpar); | set ter svg size 640, 480\nunset log y\nplot [%.f:%.f] ", ageminpar, agemaxpar); |
| k=3; /* Offset */ | k=3; /* Offset */ |
| Line 7002 set ter svg size 640, 480\nunset log y\n | Line 7082 set ter svg size 640, 480\nunset log y\n |
| fprintf(ficgp,"+$%d",k+l+j-1); | fprintf(ficgp,"+$%d",k+l+j-1); |
| fprintf(ficgp,")) t \"prev(%d,%d)\" w l",i,cpt); | fprintf(ficgp,")) t \"prev(%d,%d)\" w l",i,cpt); |
| } /* nlstate */ | } /* nlstate */ |
| fprintf(ficgp,"\nset out\n"); | fprintf(ficgp,"\nset out; unset label;\n"); |
| } /* end cpt state*/ | } /* end cpt state*/ |
| } /* end covariate */ | } /* end covariate */ |
| Line 7015 set ter svg size 640, 480\nunset log y\n | Line 7095 set ter svg size 640, 480\nunset log y\n |
| if(m != 1 && TKresult[nres]!= k1) | if(m != 1 && TKresult[nres]!= k1) |
| continue; | continue; |
| for (cpt=1; cpt<=nlstate ; cpt ++) { /* For each life ending state */ | 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); | strcpy(gplotlabel,"("); |
| 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 */ | 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 */ | 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,1,4) = 1 because h=1 k= (1) 1 1 1 */ |
| Line 7023 set ter svg size 640, 480\nunset log y\n | Line 7104 set ter svg size 640, 480\nunset log y\n |
| /* decodtabm(13,3,4)= 2 because h=13 k= 1 1 (2) 2 */ | /* decodtabm(13,3,4)= 2 because h=13 k= 1 1 (2) 2 */ |
| vlv= nbcode[Tvaraff[k]][lv]; | vlv= nbcode[Tvaraff[k]][lv]; |
| fprintf(ficgp," V%d=%d ",Tvaraff[k],vlv); | fprintf(ficgp," V%d=%d ",Tvaraff[k],vlv); |
| sprintf(gplotlabel+strlen(gplotlabel)," V%d=%d ",Tvaraff[k],vlv); | |
| } | } |
| for (k4=1; k4<= nsq; k4++){ /* For each selected (single) quantitative value */ | 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," V%d=%f ",Tvqresult[nres][k4],Tqresult[nres][k4]); |
| sprintf(gplotlabel+strlen(gplotlabel)," V%d=%f ",Tvqresult[nres][k4],Tqresult[nres][k4]); | |
| } | } |
| strcpy(gplotlabel+strlen(gplotlabel),")"); | |
| fprintf(ficgp,"\n#\n"); | fprintf(ficgp,"\n#\n"); |
| if(invalidvarcomb[k1]){ | if(invalidvarcomb[k1]){ |
| fprintf(ficgp,"#Combination (%d) ignored because no cases \n",k1); | fprintf(ficgp,"#Combination (%d) ignored because no cases \n",k1); |
| Line 7034 set ter svg size 640, 480\nunset log y\n | Line 7118 set ter svg size 640, 480\nunset log y\n |
| } | } |
| fprintf(ficgp,"\nset out \"%s_%d-%d-%d.svg\" \n",subdirf2(optionfilefiname,"PB_"),cpt,k1,nres); | fprintf(ficgp,"\nset out \"%s_%d-%d-%d.svg\" \n",subdirf2(optionfilefiname,"PB_"),cpt,k1,nres); |
| fprintf(ficgp,"set label \"Ending alive state %d %s\" at graph 0.98,0.5 center rotate font \"Helvetica,12\"\n",cpt,gplotlabel); | |
| fprintf(ficgp,"set xlabel \"Age\" \nset ylabel \"Probability\" \n\ | fprintf(ficgp,"set xlabel \"Age\" \nset ylabel \"Probability\" \n\ |
| set ter svg size 640, 480\nunset log y\nplot [%.f:%.f] ", ageminpar, agemaxpar); | set ter svg size 640, 480\nunset log y\nplot [%.f:%.f] ", ageminpar, agemaxpar); |
| k=3; /* Offset */ | k=3; /* Offset */ |
| Line 7052 set ter svg size 640, 480\nunset log y\n | Line 7137 set ter svg size 640, 480\nunset log y\n |
| /* /\* fprintf(ficgp,"+$%d",k+l+j-1); *\/ */ | /* /\* fprintf(ficgp,"+$%d",k+l+j-1); *\/ */ |
| fprintf(ficgp,") t \"bprev(%d,%d)\" w l",i,cpt); | fprintf(ficgp,") t \"bprev(%d,%d)\" w l",i,cpt); |
| } /* nlstate */ | } /* nlstate */ |
| fprintf(ficgp,"\nset out\n"); | fprintf(ficgp,"\nset out; unset label;\n"); |
| } /* end cpt state*/ | } /* end cpt state*/ |
| } /* end covariate */ | } /* end covariate */ |
| } /* End if backcast */ | } /* End if backcast */ |
| Line 7066 set ter svg size 640, 480\nunset log y\n | Line 7151 set ter svg size 640, 480\nunset log y\n |
| if(m != 1 && TKresult[nres]!= k1) | if(m != 1 && TKresult[nres]!= k1) |
| continue; | continue; |
| for (cpt=1; cpt<=nlstate ; cpt ++) { /* For each life state */ | for (cpt=1; cpt<=nlstate ; cpt ++) { /* For each life state */ |
| strcpy(gplotlabel,"("); | |
| fprintf(ficgp,"\n#\n#\n#Projection of prevalence to stable (period): 'PROJ_' files, covariatecombination#=%d state=%d",k1, cpt); | fprintf(ficgp,"\n#\n#\n#Projection of prevalence to stable (period): 'PROJ_' files, covariatecombination#=%d state=%d",k1, cpt); |
| for (k=1; k<=cptcoveff; k++){ /* For each correspondig covariate value */ | for (k=1; k<=cptcoveff; k++){ /* For each correspondig covariate value */ |
| lv= decodtabm(k1,k,cptcoveff); /* Should be the covariate value corresponding to k1 combination and kth covariate */ | lv= decodtabm(k1,k,cptcoveff); /* Should be the covariate value corresponding to k1 combination and kth covariate */ |
| Line 7074 set ter svg size 640, 480\nunset log y\n | Line 7160 set ter svg size 640, 480\nunset log y\n |
| /* decodtabm(13,3,4)= 2 because h=13 k= 1 1 (2) 2 */ | /* decodtabm(13,3,4)= 2 because h=13 k= 1 1 (2) 2 */ |
| vlv= nbcode[Tvaraff[k]][lv]; | vlv= nbcode[Tvaraff[k]][lv]; |
| fprintf(ficgp," V%d=%d ",Tvaraff[k],vlv); | fprintf(ficgp," V%d=%d ",Tvaraff[k],vlv); |
| sprintf(gplotlabel+strlen(gplotlabel)," V%d=%d ",Tvaraff[k],vlv); | |
| } | } |
| for (k4=1; k4<= nsq; k4++){ /* For each selected (single) quantitative value */ | 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," V%d=%f ",Tvqresult[nres][k4],Tqresult[nres][k4]); |
| sprintf(gplotlabel+strlen(gplotlabel)," V%d=%f ",Tvqresult[nres][k4],Tqresult[nres][k4]); | |
| } | } |
| strcpy(gplotlabel+strlen(gplotlabel),")"); | |
| fprintf(ficgp,"\n#\n"); | fprintf(ficgp,"\n#\n"); |
| if(invalidvarcomb[k1]){ | if(invalidvarcomb[k1]){ |
| fprintf(ficgp,"#Combination (%d) ignored because no cases \n",k1); | fprintf(ficgp,"#Combination (%d) ignored because no cases \n",k1); |
| Line 7086 set ter svg size 640, 480\nunset log y\n | Line 7175 set ter svg size 640, 480\nunset log y\n |
| fprintf(ficgp,"# hpijx=probability over h years, hp.jx is weighted by observed prev\n "); | fprintf(ficgp,"# hpijx=probability over h years, hp.jx is weighted by observed prev\n "); |
| fprintf(ficgp,"\nset out \"%s_%d-%d-%d.svg\" \n",subdirf2(optionfilefiname,"PROJ_"),cpt,k1,nres); | fprintf(ficgp,"\nset out \"%s_%d-%d-%d.svg\" \n",subdirf2(optionfilefiname,"PROJ_"),cpt,k1,nres); |
| fprintf(ficgp,"set label \"Alive state %d %s\" at graph 0.98,0.5 center rotate font \"Helvetica,12\"\n",cpt,gplotlabel); | |
| fprintf(ficgp,"set xlabel \"Age\" \nset ylabel \"Prevalence\" \n\ | fprintf(ficgp,"set xlabel \"Age\" \nset ylabel \"Prevalence\" \n\ |
| set ter svg size 640, 480\nunset log y\nplot [%.f:%.f] ", ageminpar, agemaxpar); | set ter svg size 640, 480\nunset log y\nplot [%.f:%.f] ", ageminpar, agemaxpar); |
| for (i=1; i<= nlstate+1 ; i ++){ /* nlstate +1 p11 p21 p.1 */ | for (i=1; i<= nlstate+1 ; i ++){ /* nlstate +1 p11 p21 p.1 */ |
| Line 7148 set ter svg size 640, 480\nunset log y\n | Line 7238 set ter svg size 640, 480\nunset log y\n |
| } | } |
| } /* end if covariate */ | } /* end if covariate */ |
| } /* nlstate */ | } /* nlstate */ |
| fprintf(ficgp,"\nset out\n"); | fprintf(ficgp,"\nset out; unset label;\n"); |
| } /* end cpt state*/ | } /* end cpt state*/ |
| } /* end covariate */ | } /* end covariate */ |
| } /* End if prevfcast */ | } /* End if prevfcast */ |
| Line 7191 set ter svg size 640, 480\nunset log y\n | Line 7281 set ter svg size 640, 480\nunset log y\n |
| fprintf(ficgp,"#Number of graphics: first is logit, 2nd is probabilities, third is incidences per year\n"); | fprintf(ficgp,"#Number of graphics: first is logit, 2nd is probabilities, third is incidences per year\n"); |
| fprintf(ficgp,"#model=%s \n",model); | fprintf(ficgp,"#model=%s \n",model); |
| fprintf(ficgp,"# Type of graphic ng=%d\n",ng); | fprintf(ficgp,"# Type of graphic ng=%d\n",ng); |
| fprintf(ficgp,"# jk=1 to 2^%d=%d\n",cptcoveff,m);/* to be checked */ | fprintf(ficgp,"# k1=1 to 2^%d=%d\n",cptcoveff,m);/* to be checked */ |
| for(jk=1; jk <=m; jk++) /* For each combination of covariate */ | for(k1=1; k1 <=m; k1++) /* For each combination of covariate */ |
| for(nres=1; nres <= nresult; nres++){ /* For each resultline */ | for(nres=1; nres <= nresult; nres++){ /* For each resultline */ |
| if(m != 1 && TKresult[nres]!= jk) | if(m != 1 && TKresult[nres]!= k1) |
| continue; | continue; |
| fprintf(ficgp,"# Combination of dummy jk=%d and ",jk); | fprintf(ficgp,"\n\n# Combination of dummy k1=%d which is ",k1); |
| strcpy(gplotlabel,"("); | |
| sprintf(gplotlabel+strlen(gplotlabel)," Dummy combination %d ",k1); | |
| for (k=1; k<=cptcoveff; k++){ /* For each correspondig covariate value */ | |
| lv= decodtabm(k1,k,cptcoveff); /* Should be the covariate value corresponding to k1 combination and kth covariate */ | |
| /* 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); | |
| sprintf(gplotlabel+strlen(gplotlabel)," V%d=%d ",Tvaraff[k],vlv); | |
| } | |
| for (k4=1; k4<= nsq; k4++){ /* For each selected (single) quantitative value */ | 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," V%d=%f ",Tvqresult[nres][k4],Tqresult[nres][k4]); |
| sprintf(gplotlabel+strlen(gplotlabel)," V%d=%f ",Tvqresult[nres][k4],Tqresult[nres][k4]); | |
| } | } |
| strcpy(gplotlabel+strlen(gplotlabel),")"); | |
| fprintf(ficgp,"\n#\n"); | fprintf(ficgp,"\n#\n"); |
| fprintf(ficgp,"\nset out \"%s_%d-%d-%d.svg\" ",subdirf2(optionfilefiname,"PE_"),jk,ng,nres); | fprintf(ficgp,"\nset out \"%s_%d-%d-%d.svg\" ",subdirf2(optionfilefiname,"PE_"),k1,ng,nres); |
| fprintf(ficgp,"\nset label \"%s\" at graph 0.98,0.5 center rotate font \"Helvetica,12\"\n",gplotlabel); | |
| fprintf(ficgp,"\nset ter svg size 640, 480 "); | fprintf(ficgp,"\nset ter svg size 640, 480 "); |
| if (ng==1){ | if (ng==1){ |
| fprintf(ficgp,"\nset ylabel \"Value of the logit of the model\"\n"); /* exp(a12+b12*x) could be nice */ | fprintf(ficgp,"\nset ylabel \"Value of the logit of the model\"\n"); /* exp(a12+b12*x) could be nice */ |
| Line 7251 set ter svg size 640, 480\nunset log y\n | Line 7355 set ter svg size 640, 480\nunset log y\n |
| fprintf(ficgp,"+p%d*%d*x",i+j+2+nagesqr-1,Tinvresult[nres][Tvar[j]]);; | fprintf(ficgp,"+p%d*%d*x",i+j+2+nagesqr-1,Tinvresult[nres][Tvar[j]]);; |
| }else{ /* quantitative */ | }else{ /* quantitative */ |
| fprintf(ficgp,"+p%d*%f*x",i+j+2+nagesqr-1,Tqinvresult[nres][Tvar[j]]); /* Tqinvresult in decoderesult */ | fprintf(ficgp,"+p%d*%f*x",i+j+2+nagesqr-1,Tqinvresult[nres][Tvar[j]]); /* Tqinvresult in decoderesult */ |
| /* fprintf(ficgp,"+p%d*%d*x",i+j+nagesqr-1,nbcode[Tvar[j-2]][codtabm(jk,Tvar[j-2])]); */ | /* fprintf(ficgp,"+p%d*%d*x",i+j+nagesqr-1,nbcode[Tvar[j-2]][codtabm(k1,Tvar[j-2])]); */ |
| } | } |
| ij++; | ij++; |
| } | } |
| Line 7260 set ter svg size 640, 480\nunset log y\n | Line 7364 set ter svg size 640, 480\nunset log y\n |
| if(ijp <=cptcovprod) { /* Product */ | if(ijp <=cptcovprod) { /* Product */ |
| if(DummyV[Tvard[ijp][1]]==0){/* Vn is dummy */ | if(DummyV[Tvard[ijp][1]]==0){/* Vn is dummy */ |
| if(DummyV[Tvard[ijp][2]]==0){/* Vn and Vm are dummy */ | if(DummyV[Tvard[ijp][2]]==0){/* Vn and Vm are dummy */ |
| /* fprintf(ficgp,"+p%d*%d*%d",i+j+2+nagesqr-1,nbcode[Tvard[ijp][1]][codtabm(jk,j)],nbcode[Tvard[ijp][2]][codtabm(jk,j)]); */ | /* fprintf(ficgp,"+p%d*%d*%d",i+j+2+nagesqr-1,nbcode[Tvard[ijp][1]][codtabm(k1,j)],nbcode[Tvard[ijp][2]][codtabm(k1,j)]); */ |
| fprintf(ficgp,"+p%d*%d*%d",i+j+2+nagesqr-1,Tinvresult[nres][Tvard[ijp][1]],Tinvresult[nres][Tvard[ijp][2]]); | fprintf(ficgp,"+p%d*%d*%d",i+j+2+nagesqr-1,Tinvresult[nres][Tvard[ijp][1]],Tinvresult[nres][Tvard[ijp][2]]); |
| }else{ /* Vn is dummy and Vm is quanti */ | }else{ /* Vn is dummy and Vm is quanti */ |
| /* fprintf(ficgp,"+p%d*%d*%f",i+j+2+nagesqr-1,nbcode[Tvard[ijp][1]][codtabm(jk,j)],Tqinvresult[nres][Tvard[ijp][2]]); */ | /* fprintf(ficgp,"+p%d*%d*%f",i+j+2+nagesqr-1,nbcode[Tvard[ijp][1]][codtabm(k1,j)],Tqinvresult[nres][Tvard[ijp][2]]); */ |
| fprintf(ficgp,"+p%d*%d*%f",i+j+2+nagesqr-1,Tinvresult[nres][Tvard[ijp][1]],Tqinvresult[nres][Tvard[ijp][2]]); | fprintf(ficgp,"+p%d*%d*%f",i+j+2+nagesqr-1,Tinvresult[nres][Tvard[ijp][1]],Tqinvresult[nres][Tvard[ijp][2]]); |
| } | } |
| }else{ /* Vn*Vm Vn is quanti */ | }else{ /* Vn*Vm Vn is quanti */ |
| Line 7276 set ter svg size 640, 480\nunset log y\n | Line 7380 set ter svg size 640, 480\nunset log y\n |
| ijp++; | ijp++; |
| } | } |
| } else{ /* simple covariate */ | } else{ /* simple covariate */ |
| /* fprintf(ficgp,"+p%d*%d",i+j+2+nagesqr-1,nbcode[Tvar[j]][codtabm(jk,j)]); /\* Valgrind bug nbcode *\/ */ | /* fprintf(ficgp,"+p%d*%d",i+j+2+nagesqr-1,nbcode[Tvar[j]][codtabm(k1,j)]); /\* Valgrind bug nbcode *\/ */ |
| if(Dummy[j]==0){ | if(Dummy[j]==0){ |
| fprintf(ficgp,"+p%d*%d",i+j+2+nagesqr-1,Tinvresult[nres][Tvar[j]]); /* */ | fprintf(ficgp,"+p%d*%d",i+j+2+nagesqr-1,Tinvresult[nres][Tvar[j]]); /* */ |
| }else{ /* quantitative */ | }else{ /* quantitative */ |
| fprintf(ficgp,"+p%d*%f",i+j+2+nagesqr-1,Tqinvresult[nres][Tvar[j]]); /* */ | fprintf(ficgp,"+p%d*%f",i+j+2+nagesqr-1,Tqinvresult[nres][Tvar[j]]); /* */ |
| /* fprintf(ficgp,"+p%d*%d*x",i+j+nagesqr-1,nbcode[Tvar[j-2]][codtabm(jk,Tvar[j-2])]); */ | /* fprintf(ficgp,"+p%d*%d*x",i+j+nagesqr-1,nbcode[Tvar[j-2]][codtabm(k1,Tvar[j-2])]); */ |
| } | } |
| } /* end simple */ | } /* end simple */ |
| } /* end j */ | } /* end j */ |
| Line 7294 set ter svg size 640, 480\nunset log y\n | Line 7398 set ter svg size 640, 480\nunset log y\n |
| if(ng != 1){ | if(ng != 1){ |
| fprintf(ficgp,")/(1"); | fprintf(ficgp,")/(1"); |
| for(k1=1; k1 <=nlstate; k1++){ | for(cpt=1; cpt <=nlstate; cpt++){ |
| if(nagesqr==0) | if(nagesqr==0) |
| fprintf(ficgp,"+exp(p%d+p%d*x",k3+(k1-1)*ncovmodel,k3+(k1-1)*ncovmodel+1); | fprintf(ficgp,"+exp(p%d+p%d*x",k3+(cpt-1)*ncovmodel,k3+(cpt-1)*ncovmodel+1); |
| else /* nagesqr =1 */ | else /* nagesqr =1 */ |
| fprintf(ficgp,"+exp(p%d+p%d*x+p%d*x*x",k3+(k1-1)*ncovmodel,k3+(k1-1)*ncovmodel+1,k3+(k1-1)*ncovmodel+1+nagesqr); | fprintf(ficgp,"+exp(p%d+p%d*x+p%d*x*x",k3+(cpt-1)*ncovmodel,k3+(cpt-1)*ncovmodel+1,k3+(cpt-1)*ncovmodel+1+nagesqr); |
| ij=1; | ij=1; |
| for(j=3; j <=ncovmodel-nagesqr; j++){ | for(j=3; j <=ncovmodel-nagesqr; j++){ |
| if((j-2)==Tage[ij]) { /* Bug valgrind */ | if((j-2)==Tage[ij]) { /* Bug valgrind */ |
| if(ij <=cptcovage) { /* Bug valgrind */ | if(ij <=cptcovage) { /* Bug valgrind */ |
| fprintf(ficgp,"+p%d*%d*x",k3+(k1-1)*ncovmodel+1+j-2+nagesqr,nbcode[Tvar[j-2]][codtabm(jk,j-2)]); | fprintf(ficgp,"+p%d*%d*x",k3+(cpt-1)*ncovmodel+1+j-2+nagesqr,nbcode[Tvar[j-2]][codtabm(k1,j-2)]); |
| /* fprintf(ficgp,"+p%d*%d*x",k3+(k1-1)*ncovmodel+1+j-2+nagesqr,nbcode[Tvar[j-2]][codtabm(jk,Tvar[j-2])]); */ | /* fprintf(ficgp,"+p%d*%d*x",k3+(cpt-1)*ncovmodel+1+j-2+nagesqr,nbcode[Tvar[j-2]][codtabm(k1,Tvar[j-2])]); */ |
| ij++; | ij++; |
| } | } |
| } | } |
| else | else |
| fprintf(ficgp,"+p%d*%d",k3+(k1-1)*ncovmodel+1+j-2+nagesqr,nbcode[Tvar[j-2]][codtabm(jk,j-2)]);/* Valgrind bug nbcode */ | fprintf(ficgp,"+p%d*%d",k3+(cpt-1)*ncovmodel+1+j-2+nagesqr,nbcode[Tvar[j-2]][codtabm(k1,j-2)]);/* Valgrind bug nbcode */ |
| } | } |
| fprintf(ficgp,")"); | fprintf(ficgp,")"); |
| } | } |
| Line 7330 set ter svg size 640, 480\nunset log y\n | Line 7434 set ter svg size 640, 480\nunset log y\n |
| i=i+ncovmodel; | i=i+ncovmodel; |
| } /* end k */ | } /* end k */ |
| } /* end k2 */ | } /* end k2 */ |
| fprintf(ficgp,"\n set out\n"); | fprintf(ficgp,"\n set out; unset label;\n"); |
| } /* end jk */ | } /* end k1 */ |
| } /* end ng */ | } /* end ng */ |
| /* avoid: */ | /* avoid: */ |
| fflush(ficgp); | fflush(ficgp); |
| Line 9737 int hPijx(double *p, int bage, int fage) | Line 9841 int hPijx(double *p, int bage, int fage) |
| fprintf(ficrespijb," V%d=%f ",Tvqresult[nres][j],Tqresult[nres][j]); | fprintf(ficrespijb," V%d=%f ",Tvqresult[nres][j],Tqresult[nres][j]); |
| } | } |
| fprintf(ficrespijb,"******\n"); | fprintf(ficrespijb,"******\n"); |
| if(invalidvarcomb[k]){ | if(invalidvarcomb[k]){ /* Is it necessary here? */ |
| fprintf(ficrespijb,"\n#Combination (%d) ignored because no cases \n",k); | fprintf(ficrespijb,"\n#Combination (%d) ignored because no cases \n",k); |
| continue; | continue; |
| } | } |