/* $Id$
$State$
$Log$
+ Revision 1.212 2015/11/21 12:47:24 brouard
+ Summary: minor typo
+
Revision 1.211 2015/11/21 12:41:11 brouard
Summary: 0.98r3 with some graph of projected cross-sectional
double **oldm, **newm, **savm; /* Working pointers to matrices */
double **oldms, **newms, **savms; /* Fixed working pointers to matrices */
/*FILE *fic ; */ /* Used in readdata only */
-FILE *ficpar, *ficparo,*ficres, *ficresp, *ficrespl, *ficrespij, *ficrest,*ficresf,*ficrespop;
+FILE *ficpar, *ficparo,*ficres, *ficresp, *ficresphtm, *ficrespl, *ficrespij, *ficrest,*ficresf,*ficrespop;
FILE *ficlog, *ficrespow;
int globpr=0; /* Global variable for printing or not */
double fretone; /* Only one call to likelihood */
strcat(tmpout,fileres);
return tmpout;
}
+
+/*************** function subdirfext ***********/
+char *subdirfext(char fileres[], char *preop, char *postop)
+{
+
+ strcpy(tmpout,preop);
+ strcat(tmpout,fileres);
+ strcat(tmpout,postop);
+ return tmpout;
+}
+/*************** function subdirfext3 ***********/
+char *subdirfext3(char fileres[], char *preop, char *postop)
+{
+
+ /* Caution optionfilefiname is hidden */
+ strcpy(tmpout,optionfilefiname);
+ strcat(tmpout,"/");
+ strcat(tmpout,preop);
+ strcat(tmpout,fileres);
+ strcat(tmpout,postop);
+ return tmpout;
+}
+
char *asc_diff_time(long time_sec, char ascdiff[])
{
long sec_left, days, hours, minutes;
double ***freq; /* Frequencies */
double *pp, **prop;
double pos,posprop, k2, dateintsum=0,k2cpt=0;
- char fileresp[FILENAMELENGTH];
+ char fileresp[FILENAMELENGTH], fileresphtm[FILENAMELENGTH];
pp=vector(1,nlstate);
prop=matrix(1,nlstate,iagemin,iagemax+3);
strcpy(fileresp,"P_");
strcat(fileresp,fileresu);
+ /*strcat(fileresphtm,fileresu);*/
if((ficresp=fopen(fileresp,"w"))==NULL) {
printf("Problem with prevalence resultfile: %s\n", fileresp);
fprintf(ficlog,"Problem with prevalence resultfile: %s\n", fileresp);
exit(0);
}
+ printf("Problem with prevalence resultfile: %s\n", fileresp);
+ strcpy(fileresphtm,subdirfext(optionfilefiname,"PHTM_",".htm"));
+ if((ficresphtm=fopen(fileresphtm,"w"))==NULL) {
+ printf("Problem with prevalence HTM resultfile '%s' with errno='%s'\n",fileresphtm,strerror(errno));
+ fprintf(ficlog,"Problem with prevalence HTM resultfile '%s' with errno='%s'\n",fileresphtm,strerror(errno));
+ fflush(ficlog);
+ exit(70);
+ }
freq= ma3x(-5,nlstate+ndeath,-5,nlstate+ndeath,iagemin,iagemax+3);
j1=0;
/*if ((k2>=dateprev1) && (k2<=dateprev2)) {*/
if(agev[m][i]==0) agev[m][i]=iagemax+1;
if(agev[m][i]==1) agev[m][i]=iagemax+2;
- if (s[m][i]>0 && s[m][i]<=nlstate) prop[s[m][i]][(int)agev[m][i]] += weight[i];
+ if (s[m][i]>0 && s[m][i]<=nlstate)
+ prop[s[m][i]][(int)agev[m][i]] += weight[i];
if (m<lastpass) {
freq[s[m][i]][s[m+1][i]][(int)agev[m][i]] += weight[i];
freq[s[m][i]][s[m+1][i]][iagemax+3] += weight[i];
pstamp(ficresp);
if (cptcovn>0) {
fprintf(ficresp, "\n#********** Variable ");
- for (z1=1; z1<=cptcoveff; z1++) fprintf(ficresp, "V%d=%d ",Tvaraff[z1],nbcode[Tvaraff[z1]][codtabm(j1,z1)]);
- fprintf(ficresp, "**********\n#");
+ fprintf(ficresphtm, "\n<h3>********** Variable ");
+ for (z1=1; z1<=cptcoveff; z1++){
+ fprintf(ficresp, "V%d=%d ",Tvaraff[z1],nbcode[Tvaraff[z1]][codtabm(j1,z1)]);
+ fprintf(ficresphtm, "V%d=%d ",Tvaraff[z1],nbcode[Tvaraff[z1]][codtabm(j1,z1)]);
+ }
+ fprintf(ficresp, "**********\n#");
+ fprintf(ficresphtm, "**********</h3>\n#");
fprintf(ficlog, "\n#********** Variable ");
for (z1=1; z1<=cptcoveff; z1++) fprintf(ficlog, "V%d=%d ",Tvaraff[z1],nbcode[Tvaraff[z1]][codtabm(j1,z1)]);
fprintf(ficlog, "**********\n#");
}
- for(i=1; i<=nlstate;i++)
+ fprintf(ficresphtm,"<table style=\"text-align:center; border: 1px solid\"><th></th>");
+ for(i=1; i<=nlstate;i++) {
fprintf(ficresp, " Age Prev(%d) N(%d) N",i,i);
+ fprintf(ficresphtm, "<th>Age</th><th>Prev(%d)</th><th>N(%d)</th><th>N</th>",i,i);
+ }
fprintf(ficresp, "\n");
+ fprintf(ficresphtm, "\n");
for(i=iagemin; i <= iagemax+3; i++){
+ fprintf(ficresphtm,"<tr>");
if(i==iagemax+3){
fprintf(ficlog,"Total");
}else{
if( i <= iagemax){
if(pos>=1.e-5){
fprintf(ficresp," %d %.5f %.0f %.0f",i,prop[jk][i]/posprop, prop[jk][i],posprop);
+ fprintf(ficresphtm,"<th>%d</th><td>%.5f</td><td>%.0f</td><td>%.0f</td>",i,prop[jk][i]/posprop, prop[jk][i],posprop);
/*probs[i][jk][j1]= pp[jk]/pos;*/
/*printf("\ni=%d jk=%d j1=%d %.5f %.0f %.0f %f",i,jk,j1,pp[jk]/pos, pp[jk],pos,probs[i][jk][j1]);*/
}
- else
+ else{
fprintf(ficresp," %d NaNq %.0f %.0f",i,prop[jk][i],posprop);
+ fprintf(ficresphtm,"<th>%d</th><td>NaNq</td><td>%.0f</td><td>%.0f</td>",i, prop[jk][i],posprop);
+ }
}
}
printf(" %d%d=%.0f",jk,m,freq[jk][m][i]);
fprintf(ficlog," %d%d=%.0f",jk,m,freq[jk][m][i]);
}
- if(i <= iagemax)
+ if(i <= iagemax){
fprintf(ficresp,"\n");
+ fprintf(ficresphtm,"</tr>\n");
+ }
if(first==1)
printf("Others in log...\n");
fprintf(ficlog,"\n");
} /* end loop i */
+ fprintf(ficresphtm,"</table>\n");
/*}*/
} /* end j1 */
dateintmean=dateintsum/k2cpt;
fclose(ficresp);
+ fclose(ficresphtm);
free_ma3x(freq,-5,nlstate+ndeath,-5,nlstate+ndeath, iagemin, iagemax+3);
free_vector(pp,1,nlstate);
free_matrix(prop,1,nlstate,iagemin, iagemax+3);
int lastpass, int stepm, int weightopt, char model[],\
int imx,int jmin, int jmax, double jmeanint,char rfileres[],\
int popforecast, int prevfcast, int estepm , \
- double jprev1, double mprev1,double anprev1, \
- double jprev2, double mprev2,double anprev2){
+ double jprev1, double mprev1,double anprev1, double dateprev1, \
+ double jprev2, double mprev2,double anprev2, double dateprev2){
int jj1, k1, i1, cpt;
fprintf(fichtm,"<ul><li><a href='#firstorder'>Result files (first order: no variance)</a>\n \
<li><a href='#secondorder'>Result files (second order (variance)</a>\n \
</ul>");
fprintf(fichtm,"<ul><li><h4><a name='firstorder'>Result files (first order: no variance)</a></h4>\n \
- - Observed prevalence in each state (during the period defined between %.lf/%.lf/%.lf and %.lf/%.lf/%.lf): <a href=\"%s\">%s</a> <br>\n ",
- jprev1, mprev1,anprev1,jprev2, mprev2,anprev2,subdirf2(fileresu,"P_"),subdirf2(fileresu,"P_"));
+ - Observed prevalence in each state (during the period defined between %.lf/%.lf/%.lf and %.lf/%.lf/%.lf): <a href=\"%s\">%s</a> (html file) ",
+ jprev1, mprev1,anprev1,jprev2, mprev2,anprev2,subdirfext3(optionfilefiname,"PHTM_",".htm"),subdirfext3(optionfilefiname,"PHTM_",".htm"));
+ fprintf(fichtm,", <a href=\"%s\">%s</a> (text file) <br>\n",subdirf2(fileresu,"P_"),subdirf2(fileresu,"P_"));
fprintf(fichtm,"\
- Estimated transition probabilities over %d (stepm) months: <a href=\"%s\">%s</a><br>\n ",
stepm,subdirf2(fileresu,"PIJ_"),subdirf2(fileresu,"PIJ_"));
if(prevfcast==1){
/* Projection of prevalence up to period (stable) prevalence in each health state */
for(cpt=1; cpt<=nlstate;cpt++){
- fprintf(fichtm,"<br>\n- Projection of prevalece up to period (stable) prevalence in state %d. Or probability to be in state %d being in state (1 to %d) at different ages. <a href=\"%s%d_%d.svg\">%s%d_%d.svg</a><br> \
-<img src=\"%s_%d-%d.svg\">", cpt, cpt, nlstate, subdirf2(optionfilefiname,"PROJ_"),cpt,jj1,subdirf2(optionfilefiname,"PROJ_"),cpt,jj1,subdirf2(optionfilefiname,"PROJ_"),cpt,jj1);
+ fprintf(fichtm,"<br>\n- Projection of cross-sectional prevalence (estimated with cases observed from %f to %f) up to period (stable) prevalence in state %d. Or probability to be in state %d being in state (1 to %d) at different ages. <a href=\"%s%d_%d.svg\">%s%d_%d.svg</a><br> \
+<img src=\"%s_%d-%d.svg\">", dateprev1, dateprev2, cpt, cpt, nlstate, subdirf2(optionfilefiname,"PROJ_"),cpt,jj1,subdirf2(optionfilefiname,"PROJ_"),cpt,jj1,subdirf2(optionfilefiname,"PROJ_"),cpt,jj1);
}
}
optionfilehtmcov,version,fullversion,title,datafile,firstpass,lastpass,stepm, weightopt, model);
}
- fprintf(fichtm,"<html><head>\n<head>\n<meta charset=\"utf-8\"/><meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\n<title>IMaCh %s</title></head>\n <body><font size=\"7\"><a href=http:/euroreves.ined.fr/imach>IMaCh for Interpolated Markov Chain</a> </font><br>\n<font size=\"3\">Sponsored by Copyright (C) 2002-2015 <a href=http://www.ined.fr>INED</a>-EUROREVES-Institut de longévité-Japan Society for the Promotion of Sciences 日本学術振興会 (<a href=https://www.jsps.go.jp/english/e-grants/>Grant-in-Aid for Scientific Research 25293121</a>) - <a href=https://software.intel.com/en-us>Intel Software 2015</a></font><br> \
+ fprintf(fichtm,"<html><head>\n<head>\n<meta charset=\"utf-8\"/><meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\n<title>IMaCh %s</title></head>\n <body><font size=\"7\"><a href=http:/euroreves.ined.fr/imach>IMaCh for Interpolated Markov Chain</a> </font><br>\n<font size=\"3\">Sponsored by Copyright (C) 2002-2015 <a href=http://www.ined.fr>INED</a>-EUROREVES-Institut de longévité-2013-2016-Japan Society for the Promotion of Sciences 日本学術振興会 (<a href=https://www.jsps.go.jp/english/e-grants/>Grant-in-Aid for Scientific Research 25293121</a>) - <a href=https://software.intel.com/en-us>Intel Software 2015-2018</a></font><br> \
<hr size=\"2\" color=\"#EC5E5E\"> \n\
<font size=\"2\">IMaCh-%s <br> %s</font> \
<hr size=\"2\" color=\"#EC5E5E\"> \n\
printinghtml(fileresu,title,datafile, firstpass, lastpass, stepm, weightopt,\
model,imx,jmin,jmax,jmean,rfileres,popforecast,prevfcast,estepm, \
- jprev1,mprev1,anprev1,jprev2,mprev2,anprev2);
+ jprev1,mprev1,anprev1,dateprev1,jprev2,mprev2,anprev2,dateprev2);
/*------------ free_vector -------------*/
/* chdir(path); */