version 1.41, 2002/05/07 15:53:01
|
version 1.42, 2002/05/21 18:44:41
|
Line 56
|
Line 56
|
#include <unistd.h>
|
#include <unistd.h>
|
|
|
#define MAXLINE 256
|
#define MAXLINE 256
|
#define GNUPLOTPROGRAM "wgnuplot"
|
#define GNUPLOTPROGRAM "gnuplot"
|
/*#define GNUPLOTPROGRAM "..\\gp37mgw\\wgnuplot"*/
|
/*#define GNUPLOTPROGRAM "..\\gp37mgw\\wgnuplot"*/
|
#define FILENAMELENGTH 80
|
#define FILENAMELENGTH 80
|
/*#define DEBUG*/
|
/*#define DEBUG*/
|
Line 1330 void prevalence(int agemin, float agemax
|
Line 1330 void prevalence(int agemin, float agemax
|
j=cptcoveff;
|
j=cptcoveff;
|
if (cptcovn<1) {j=1;ncodemax[1]=1;}
|
if (cptcovn<1) {j=1;ncodemax[1]=1;}
|
|
|
for(k1=1; k1<=j;k1++){
|
for(k1=1; k1<=j;k1++){
|
for(i1=1; i1<=ncodemax[k1];i1++){
|
for(i1=1; i1<=ncodemax[k1];i1++){
|
j1++;
|
j1++;
|
|
|
for (i=-1; i<=nlstate+ndeath; i++)
|
for (i=-1; i<=nlstate+ndeath; i++)
|
for (jk=-1; jk<=nlstate+ndeath; jk++)
|
for (jk=-1; jk<=nlstate+ndeath; jk++)
|
for(m=agemin; m <= agemax+3; m++)
|
for(m=agemin; m <= agemax+3; m++)
|
Line 1352 void prevalence(int agemin, float agemax
|
Line 1352 void prevalence(int agemin, float agemax
|
if ((k2>=dateprev1) && (k2<=dateprev2)) {
|
if ((k2>=dateprev1) && (k2<=dateprev2)) {
|
if(agev[m][i]==0) agev[m][i]=agemax+1;
|
if(agev[m][i]==0) agev[m][i]=agemax+1;
|
if(agev[m][i]==1) agev[m][i]=agemax+2;
|
if(agev[m][i]==1) agev[m][i]=agemax+2;
|
if (m<lastpass)
|
if (m<lastpass) {
|
if (calagedate>0) freq[s[m][i]][s[m+1][i]][(int)(agev[m][i]+1-((int)calagedate %12)/12.)] += weight[i];
|
if (calagedate>0)
|
else
|
freq[s[m][i]][s[m+1][i]][(int)(agev[m][i]+1-((int)calagedate %12)/12.)] += weight[i];
|
freq[s[m][i]][s[m+1][i]][(int)agev[m][i]] += weight[i];
|
else
|
freq[s[m][i]][s[m+1][i]][(int)(agemax+3)] += weight[i];
|
freq[s[m][i]][s[m+1][i]][(int)agev[m][i]] += weight[i];
|
|
freq[s[m][i]][s[m+1][i]][(int)(agemax+3)] += weight[i];
|
|
}
|
}
|
}
|
}
|
}
|
}
|
}
|
}
|
}
|
for(i=(int)agemin; i <= (int)agemax+3; i++){
|
for(i=(int)agemin; i <= (int)agemax+3; i++){
|
for(jk=1; jk <=nlstate ; jk++){
|
for(jk=1; jk <=nlstate ; jk++){
|
for(m=-1, pp[jk]=0; m <=nlstate+ndeath ; m++)
|
for(m=-1, pp[jk]=0; m <=nlstate+ndeath ; m++)
|
pp[jk] += freq[jk][m][i];
|
pp[jk] += freq[jk][m][i];
|
}
|
}
|
for(jk=1; jk <=nlstate ; jk++){
|
for(jk=1; jk <=nlstate ; jk++){
|
for(m=-1, pos=0; m <=0 ; m++)
|
for(m=-1, pos=0; m <=0 ; m++)
|
pos += freq[jk][m][i];
|
pos += freq[jk][m][i];
|
}
|
}
|
|
|
for(jk=1; jk <=nlstate ; jk++){
|
for(jk=1; jk <=nlstate ; jk++){
|
for(m=0, pp[jk]=0; m <=nlstate+ndeath; m++)
|
for(m=0, pp[jk]=0; m <=nlstate+ndeath; m++)
|
pp[jk] += freq[jk][m][i];
|
pp[jk] += freq[jk][m][i];
|
}
|
}
|
|
|
for(jk=1,pos=0; jk <=nlstate ; jk++) pos += pp[jk];
|
for(jk=1,pos=0; jk <=nlstate ; jk++) pos += pp[jk];
|
|
|
for(jk=1; jk <=nlstate ; jk++){
|
for(jk=1; jk <=nlstate ; jk++){
|
if( i <= (int) agemax){
|
if( i <= (int) agemax){
|
if(pos>=1.e-5){
|
if(pos>=1.e-5){
|
probs[i][jk][j1]= pp[jk]/pos;
|
probs[i][jk][j1]= pp[jk]/pos;
|
}
|
}
|
}
|
}
|
}
|
|
|
|
}
|
}
|
|
|
|
}
|
}
|
}
|
}
|
}
|
|
|
Line 1663 void evsij(char fileres[], double ***eij
|
Line 1665 void evsij(char fileres[], double ***eij
|
for(j=1;j<=nlstate*2;j++)
|
for(j=1;j<=nlstate*2;j++)
|
varhe[i][j][(int)age] =0.;
|
varhe[i][j][(int)age] =0.;
|
|
|
|
printf("%d||",(int)age);fflush(stdout);
|
for(h=0;h<=nhstepm-1;h++){
|
for(h=0;h<=nhstepm-1;h++){
|
for(k=0;k<=nhstepm-1;k++){
|
for(k=0;k<=nhstepm-1;k++){
|
matprod2(dnewm,trgradg[h],1,nlstate*2,1,npar,1,npar,matcov);
|
matprod2(dnewm,trgradg[h],1,nlstate*2,1,npar,1,npar,matcov);
|
Line 2114 fprintf(fichtm," <li>Graphs</li><p>");
|
Line 2117 fprintf(fichtm," <li>Graphs</li><p>");
|
fprintf(fichtm," V%d=%d ",Tvaraff[cpt],nbcode[Tvaraff[cpt]][codtab[jj1][cpt]]);
|
fprintf(fichtm," V%d=%d ",Tvaraff[cpt],nbcode[Tvaraff[cpt]][codtab[jj1][cpt]]);
|
fprintf(fichtm," ************\n<hr size=\"2\" color=\"#EC5E5E\">");
|
fprintf(fichtm," ************\n<hr size=\"2\" color=\"#EC5E5E\">");
|
}
|
}
|
fprintf(fichtm,"<br>- Probabilities: pe%s%d.gif<br>
|
fprintf(fichtm,"<br>- Probabilities: pe%s%d.png<br>
|
<img src=\"pe%s%d.gif\">",strtok(optionfile, "."),jj1,strtok(optionfile, "."),jj1);
|
<img src=\"pe%s%d.png\">",strtok(optionfile, "."),jj1,strtok(optionfile, "."),jj1);
|
for(cpt=1; cpt<nlstate;cpt++){
|
for(cpt=1; cpt<nlstate;cpt++){
|
fprintf(fichtm,"<br>- Prevalence of disability : p%s%d%d.gif<br>
|
fprintf(fichtm,"<br>- Prevalence of disability : p%s%d%d.png<br>
|
<img src=\"p%s%d%d.gif\">",strtok(optionfile, "."),cpt,jj1,strtok(optionfile, "."),cpt,jj1);
|
<img src=\"p%s%d%d.png\">",strtok(optionfile, "."),cpt,jj1,strtok(optionfile, "."),cpt,jj1);
|
}
|
}
|
for(cpt=1; cpt<=nlstate;cpt++) {
|
for(cpt=1; cpt<=nlstate;cpt++) {
|
fprintf(fichtm,"<br>- Observed and stationary prevalence (with confident
|
fprintf(fichtm,"<br>- Observed and stationary prevalence (with confident
|
interval) in state (%d): v%s%d%d.gif <br>
|
interval) in state (%d): v%s%d%d.png <br>
|
<img src=\"v%s%d%d.gif\">",cpt,strtok(optionfile, "."),cpt,jj1,strtok(optionfile, "."),cpt,jj1);
|
<img src=\"v%s%d%d.png\">",cpt,strtok(optionfile, "."),cpt,jj1,strtok(optionfile, "."),cpt,jj1);
|
}
|
}
|
for(cpt=1; cpt<=nlstate;cpt++) {
|
for(cpt=1; cpt<=nlstate;cpt++) {
|
fprintf(fichtm,"\n<br>- Health life expectancies by age and initial health state (%d): exp%s%d%d.gif <br>
|
fprintf(fichtm,"\n<br>- Health life expectancies by age and initial health state (%d): exp%s%d%d.png <br>
|
<img src=\"exp%s%d%d.gif\">",cpt,strtok(optionfile, "."),cpt,jj1,strtok(optionfile, "."),cpt,jj1);
|
<img src=\"exp%s%d%d.png\">",cpt,strtok(optionfile, "."),cpt,jj1,strtok(optionfile, "."),cpt,jj1);
|
}
|
}
|
fprintf(fichtm,"\n<br>- Total life expectancy by age and
|
fprintf(fichtm,"\n<br>- Total life expectancy by age and
|
health expectancies in states (1) and (2): e%s%d.gif<br>
|
health expectancies in states (1) and (2): e%s%d.png<br>
|
<img src=\"e%s%d.gif\">",strtok(optionfile, "."),jj1,strtok(optionfile, "."),jj1);
|
<img src=\"e%s%d.png\">",strtok(optionfile, "."),jj1,strtok(optionfile, "."),jj1);
|
fprintf(fichtm,"\n</body>");
|
fprintf(fichtm,"\n</body>");
|
}
|
}
|
}
|
}
|
Line 2159 m=pow(2,cptcoveff);
|
Line 2162 m=pow(2,cptcoveff);
|
for (k1=1; k1<= m ; k1 ++) {
|
for (k1=1; k1<= m ; k1 ++) {
|
|
|
#ifdef windows
|
#ifdef windows
|
fprintf(ficgp,"set xlabel \"Age\" \nset ylabel \"Probability\" \nset ter gif small size 400,300\nplot [%.f:%.f] \"vpl%s\" every :::%d::%d u 1:2 \"\%%lf",ageminpar,fage,fileres,k1-1,k1-1);
|
fprintf(ficgp,"\nset out \"v%s%d%d.png\" \n\n",strtok(optionfile, "."),cpt,k1);
|
|
fprintf(ficgp,"set xlabel \"Age\" \nset ylabel \"Probability\" \nset ter png small\nset size 0.65,0.65\nplot [%.f:%.f] \"vpl%s\" every :::%d::%d u 1:2 \"\%%lf",ageminpar,fage,fileres,k1-1,k1-1);
|
#endif
|
#endif
|
#ifdef unix
|
#ifdef unix
|
|
fprintf(ficgp,"\nset out \"v%s%d%d.png\" \n\n",strtok(optionfile, "."),cpt,k1);
|
fprintf(ficgp,"set xlabel \"Age\" \nset ylabel \"Probability\" \nplot [%.f:%.f] \"vpl%s\" u 1:2 \"\%%lf",ageminpar,fage,fileres);
|
fprintf(ficgp,"set xlabel \"Age\" \nset ylabel \"Probability\" \nplot [%.f:%.f] \"vpl%s\" u 1:2 \"\%%lf",ageminpar,fage,fileres);
|
#endif
|
#endif
|
|
|
Line 2181 for (i=1; i<= nlstate ; i ++) {
|
Line 2186 for (i=1; i<= nlstate ; i ++) {
|
}
|
}
|
fprintf(ficgp,"\" t\"\" w l 1,\"p%s\" every :::%d::%d u 1:($%d) t\"Observed prevalence \" w l 2",fileres,k1-1,k1-1,2+4*(cpt-1));
|
fprintf(ficgp,"\" t\"\" w l 1,\"p%s\" every :::%d::%d u 1:($%d) t\"Observed prevalence \" w l 2",fileres,k1-1,k1-1,2+4*(cpt-1));
|
#ifdef unix
|
#ifdef unix
|
fprintf(ficgp,"\nset ter gif small size 400,300");
|
fprintf(ficgp,"\nset ter png small\nset size 0.65,0.65\n");
|
#endif
|
#endif
|
fprintf(ficgp,"\nset out \"v%s%d%d.gif\" \nreplot\n\n",strtok(optionfile, "."),cpt,k1);
|
|
}
|
}
|
}
|
}
|
/*2 eme*/
|
/*2 eme*/
|
|
|
for (k1=1; k1<= m ; k1 ++) {
|
for (k1=1; k1<= m ; k1 ++) {
|
fprintf(ficgp,"set ylabel \"Years\" \nset ter gif small size 400,300\nplot [%.f:%.f] ",ageminpar,fage);
|
fprintf(ficgp,"\nset out \"e%s%d.png\" \n\n",strtok(optionfile, "."),k1);
|
|
fprintf(ficgp,"set ylabel \"Years\" \nset ter png small\nset size 0.65,0.65\nplot [%.f:%.f] ",ageminpar,fage);
|
|
|
for (i=1; i<= nlstate+1 ; i ++) {
|
for (i=1; i<= nlstate+1 ; i ++) {
|
k=2*i;
|
k=2*i;
|
Line 2214 fprintf(ficgp,"\nset out \"v%s%d%d.gif\"
|
Line 2219 fprintf(ficgp,"\nset out \"v%s%d%d.gif\"
|
if (i== (nlstate+1)) fprintf(ficgp,"\" t\"\" w l 0");
|
if (i== (nlstate+1)) fprintf(ficgp,"\" t\"\" w l 0");
|
else fprintf(ficgp,"\" t\"\" w l 0,");
|
else fprintf(ficgp,"\" t\"\" w l 0,");
|
}
|
}
|
fprintf(ficgp,"\nset out \"e%s%d.gif\" \nreplot\n\n",strtok(optionfile, "."),k1);
|
|
}
|
}
|
|
|
/*3eme*/
|
/*3eme*/
|
Line 2222 fprintf(ficgp,"\nset out \"v%s%d%d.gif\"
|
Line 2226 fprintf(ficgp,"\nset out \"v%s%d%d.gif\"
|
for (k1=1; k1<= m ; k1 ++) {
|
for (k1=1; k1<= m ; k1 ++) {
|
for (cpt=1; cpt<= nlstate ; cpt ++) {
|
for (cpt=1; cpt<= nlstate ; cpt ++) {
|
k=2+nlstate*(2*cpt-2);
|
k=2+nlstate*(2*cpt-2);
|
fprintf(ficgp,"set ter gif small size 400,300\nplot [%.f:%.f] \"e%s\" every :::%d::%d u 1:%d t \"e%d1\" w l",ageminpar,fage,fileres,k1-1,k1-1,k,cpt);
|
fprintf(ficgp,"\nset out \"exp%s%d%d.png\" \n\n",strtok(optionfile, "."),cpt,k1);
|
|
fprintf(ficgp,"set ter png small\nset size 0.65,0.65\nplot [%.f:%.f] \"e%s\" every :::%d::%d u 1:%d t \"e%d1\" w l",ageminpar,fage,fileres,k1-1,k1-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);
|
for (i=1; i<= nlstate*2 ; i ++) fprintf(ficgp,"\%%lf (\%%lf) ");
|
for (i=1; i<= nlstate*2 ; i ++) fprintf(ficgp,"\%%lf (\%%lf) ");
|
fprintf(ficgp,"\" t \"e%d1\" w l",cpt);
|
fprintf(ficgp,"\" t \"e%d1\" w l",cpt);
|
Line 2235 fprintf(ficgp,"\" t \"e%d1\" w l",cpt);
|
Line 2240 fprintf(ficgp,"\" t \"e%d1\" w l",cpt);
|
fprintf(ficgp," ,\"e%s\" every :::%d::%d u 1:%d t \"e%d%d\" w l",fileres,k1-1,k1-1,k+2*i,cpt,i+1);
|
fprintf(ficgp," ,\"e%s\" every :::%d::%d u 1:%d t \"e%d%d\" w l",fileres,k1-1,k1-1,k+2*i,cpt,i+1);
|
|
|
}
|
}
|
fprintf(ficgp,"\nset out \"exp%s%d%d.gif\" \nreplot\n\n",strtok(optionfile, "."),cpt,k1);
|
|
}
|
|
}
|
}
|
|
}
|
|
|
/* CV preval stat */
|
/* CV preval stat */
|
for (k1=1; k1<= m ; k1 ++) {
|
for (k1=1; k1<= m ; k1 ++) {
|
for (cpt=1; cpt<nlstate ; cpt ++) {
|
for (cpt=1; cpt<nlstate ; cpt ++) {
|
k=3;
|
k=3;
|
fprintf(ficgp,"set xlabel \"Age\" \nset ylabel \"Probability\" \nset ter gif small size 400,300\nplot [%.f:%.f] \"pij%s\" u ($1==%d ? ($3):1/0):($%d/($%d",ageminpar,agemaxpar,fileres,k1,k+cpt+1,k+1);
|
fprintf(ficgp,"set out \"p%s%d%d.png\" \n\n",strtok(optionfile, "."),cpt,k1);
|
|
fprintf(ficgp,"set xlabel \"Age\" \nset ylabel \"Probability\" \nset ter png small\nset size 0.65,0.65\nplot [%.f:%.f] \"pij%s\" u ($1==%d ? ($3):1/0):($%d/($%d",ageminpar,agemaxpar,fileres,k1,k+cpt+1,k+1);
|
|
|
for (i=1; i< nlstate ; i ++)
|
for (i=1; i< nlstate ; i ++)
|
fprintf(ficgp,"+$%d",k+i+1);
|
fprintf(ficgp,"+$%d",k+i+1);
|
Line 2256 fprintf(ficgp,"\" t \"e%d1\" w l",cpt);
|
Line 2261 fprintf(ficgp,"\" t \"e%d1\" w l",cpt);
|
fprintf(ficgp,"+$%d",l+i+1);
|
fprintf(ficgp,"+$%d",l+i+1);
|
}
|
}
|
fprintf(ficgp,")) t\"prev(%d,%d)\" w l\n",cpt+1,cpt+1);
|
fprintf(ficgp,")) t\"prev(%d,%d)\" w l\n",cpt+1,cpt+1);
|
fprintf(ficgp,"set out \"p%s%d%d.gif\" \nreplot\n\n",strtok(optionfile, "."),cpt,k1);
|
|
}
|
}
|
}
|
}
|
|
|
Line 2272 fprintf(ficgp,"\" t \"e%d1\" w l",cpt);
|
Line 2276 fprintf(ficgp,"\" t \"e%d1\" w l",cpt);
|
}
|
}
|
}
|
}
|
}
|
}
|
}
|
}
|
|
|
for(jk=1; jk <=m; jk++) {
|
for(jk=1; jk <=m; jk++) {
|
fprintf(ficgp,"\nset ter gif small size 400,300\nset log y\nplot [%.f:%.f] ",ageminpar,agemaxpar);
|
fprintf(ficgp,"\nset out \"pe%s%d.png\" \n\n",strtok(optionfile, "."),jk);
|
i=1;
|
fprintf(ficgp,"\nset ter png small\nset size 0.65,0.65\nset log y\nplot [%.f:%.f] ",ageminpar,agemaxpar);
|
for(k2=1; k2<=nlstate; k2++) {
|
i=1;
|
k3=i;
|
for(k2=1; k2<=nlstate; k2++) {
|
for(k=1; k<=(nlstate+ndeath); k++) {
|
k3=i;
|
if (k != k2){
|
for(k=1; k<=(nlstate+ndeath); k++) {
|
fprintf(ficgp," exp(p%d+p%d*x",i,i+1);
|
if (k != k2){
|
ij=1;
|
fprintf(ficgp," exp(p%d+p%d*x",i,i+1);
|
for(j=3; j <=ncovmodel; j++) {
|
ij=1;
|
if(((j-2)==Tage[ij]) &&(ij <=cptcovage)) {
|
for(j=3; j <=ncovmodel; j++) {
|
fprintf(ficgp,"+p%d*%d*x",i+j-1,nbcode[Tvar[j-2]][codtab[jk][Tvar[j-2]]]);
|
if(((j-2)==Tage[ij]) &&(ij <=cptcovage)) {
|
ij++;
|
fprintf(ficgp,"+p%d*%d*x",i+j-1,nbcode[Tvar[j-2]][codtab[jk][Tvar[j-2]]]);
|
}
|
ij++;
|
else
|
}
|
fprintf(ficgp,"+p%d*%d",i+j-1,nbcode[Tvar[j-2]][codtab[jk][j-2]]);
|
else
|
}
|
fprintf(ficgp,"+p%d*%d",i+j-1,nbcode[Tvar[j-2]][codtab[jk][j-2]]);
|
fprintf(ficgp,")/(1");
|
}
|
|
fprintf(ficgp,")/(1");
|
for(k1=1; k1 <=nlstate; k1++){
|
|
fprintf(ficgp,"+exp(p%d+p%d*x",k3+(k1-1)*ncovmodel,k3+(k1-1)*ncovmodel+1);
|
for(k1=1; k1 <=nlstate; k1++){
|
ij=1;
|
fprintf(ficgp,"+exp(p%d+p%d*x",k3+(k1-1)*ncovmodel,k3+(k1-1)*ncovmodel+1);
|
for(j=3; j <=ncovmodel; j++){
|
ij=1;
|
if(((j-2)==Tage[ij]) &&(ij <=cptcovage)) {
|
for(j=3; j <=ncovmodel; j++){
|
fprintf(ficgp,"+p%d*%d*x",k3+(k1-1)*ncovmodel+1+j-2,nbcode[Tvar[j-2]][codtab[jk][Tvar[j-2]]]);
|
if(((j-2)==Tage[ij]) &&(ij <=cptcovage)) {
|
ij++;
|
fprintf(ficgp,"+p%d*%d*x",k3+(k1-1)*ncovmodel+1+j-2,nbcode[Tvar[j-2]][codtab[jk][Tvar[j-2]]]);
|
}
|
ij++;
|
else
|
}
|
fprintf(ficgp,"+p%d*%d",k3+(k1-1)*ncovmodel+1+j-2,nbcode[Tvar[j-2]][codtab[jk][j-2]]);
|
else
|
}
|
fprintf(ficgp,"+p%d*%d",k3+(k1-1)*ncovmodel+1+j-2,nbcode[Tvar[j-2]][codtab[jk][j-2]]);
|
fprintf(ficgp,")");
|
}
|
}
|
fprintf(ficgp,")");
|
fprintf(ficgp,") t \"p%d%d\" ", k2,k);
|
}
|
if ((k+k2)!= (nlstate*2+ndeath)) fprintf(ficgp,",");
|
fprintf(ficgp,") t \"p%d%d\" ", k2,k);
|
i=i+ncovmodel;
|
if ((k+k2)!= (nlstate*2+ndeath)) fprintf(ficgp,",");
|
|
i=i+ncovmodel;
|
|
}
|
}
|
}
|
}
|
}
|
}
|
}
|
fprintf(ficgp,"\nset out \"pe%s%d.gif\" \nreplot\n\n",strtok(optionfile, "."),jk);
|
|
}
|
|
|
|
fclose(ficgp);
|
fclose(ficgp);
|
} /* end gnuplot */
|
} /* end gnuplot */
|
|
|
|
|
Line 2651 int main(int argc, char *argv[])
|
Line 2655 int main(int argc, char *argv[])
|
double dateprev1, dateprev2,jproj1,mproj1,anproj1,jproj2,mproj2,anproj2;
|
double dateprev1, dateprev2,jproj1,mproj1,anproj1,jproj2,mproj2,anproj2;
|
|
|
|
|
char version[80]="Imach version 0.8a, May 2002, INED-EUROREVES ";
|
char version[80]="Imach version 0.8d, May 2002, INED-EUROREVES ";
|
char *alph[]={"a","a","b","c","d","e"}, str[4];
|
char *alph[]={"a","a","b","c","d","e"}, str[4];
|
|
|
|
|