\r
for(i=1; i<=nlstate;i++)\r
for(j=1; j<=nlstate;j++)\r
- for (h=0, eij[i][j][(int)age]=0; h<=nhstepm; h++){\r
- eij[i][j][(int)age] +=p3mat[i][j][h];\r
+ for (h=0, eij[i][j][(int)age]=0; h<=nhstepm-1; h++){\r
+ eij[i][j][(int)age] +=(p3mat[i][j][h]+p3mat[i][j][h+1])/2.0;\r
}\r
\r
hf=1;\r
if (stepm >= YEARM) hf=stepm/YEARM;\r
- fprintf(ficreseij,"%.0f",age );\r
+\r
for(i=1; i<=nlstate;i++)\r
for(j=1; j<=nlstate;j++){\r
- fprintf(ficreseij," %.4f", hf*eij[i][j][(int)age]);\r
+ if (j==i) eij[i][j][(int)age]= (eij[i][j][(int)age]-0.5*stepm/12./hf);\r
+ }\r
+\r
+ fprintf(ficreseij,"%3.0f",age );\r
+ for(i=1; i<=nlstate;i++)\r
+ for(j=1; j<=nlstate;j++){\r
+ fprintf(ficreseij," %9.4f", hf*eij[i][j][(int)age]);\r
}\r
fprintf(ficreseij,"\n");\r
free_ma3x(p3mat,1,nlstate+ndeath,1, nlstate+ndeath, 0,nhstepm);\r
}\r
\r
/******************* Printing html file ***********/\r
-void printinghtml(char fileres[], char title[], char datafile[], int firstpass, int lastpass, int stepm, int weightopt, char model[],int imx,int jmin, int jmax, double jmeanint,char optionfile[],char optionfilehtm[] ){\r
+void printinghtml(char fileres[], char title[], char datafile[], int firstpass, int lastpass, int stepm, int weightopt, char model[],int imx,int jmin, int jmax, double jmeanint,char optionfile[],char optionfilehtm[],char rfileres[] ){\r
int jj1, k1, i1, cpt;\r
FILE *fichtm;\r
/*char optionfilehtm[FILENAMELENGTH];*/\r
printf("Problem with %s \n",optionfilehtm), exit(0);\r
}\r
\r
- fprintf(fichtm,"<body><ul> <font size=\"6\">Imach, Version 0.7 </font> <hr size=\"2\" color=\"#EC5E5E\"> \r
+ fprintf(fichtm,"<body><ul> <font size=\"6\">Imach, Version 0.71 </font> <hr size=\"2\" color=\"#EC5E5E\"> \r
Title=%s <br>Datafile=%s Firstpass=%d Lastpass=%d Stepm=%d Weight=%d Model=%s<br>\r
\r
Total number of observations=%d <br>\r
- Standard deviation of stationary prevalences: <a href=\"vpl%s\">vpl%s</a> <br>\r
- Prevalences forecasting: <a href=\"f%s\">f%s</a> <br>\r
- Population forecasting (if popforecast=1): <a href=\"pop%s\">pop%s</a> <br>\r
- <br>",title,datafile,firstpass,lastpass,stepm, weightopt,model,imx,jmin,jmax,jmean,fileres,fileres,fileres,fileres,fileres,fileres,fileres,fileres,fileres,fileres,fileres,fileres,fileres,fileres,fileres,fileres,fileres,fileres,fileres,fileres,fileres,fileres);\r
+ <br>",title,datafile,firstpass,lastpass,stepm, weightopt,model,imx,jmin,jmax,jmean,fileres,fileres,rfileres,rfileres,fileres,fileres,fileres,fileres,fileres,fileres,fileres,fileres,fileres,fileres,fileres,fileres,fileres,fileres,fileres,fileres,fileres,fileres);\r
\r
fprintf(fichtm," <li>Graphs</li><p>");\r
\r
char optionfile[FILENAMELENGTH], datafile[FILENAMELENGTH], filerespl[FILENAMELENGTH];\r
char optionfilext[10], optionfilefiname[FILENAMELENGTH], optionfilehtm[FILENAMELENGTH], optionfilegnuplot[FILENAMELENGTH], plotcmd[FILENAMELENGTH];\r
\r
- char fileres[FILENAMELENGTH], filerespij[FILENAMELENGTH], filereso[FILENAMELENGTH];\r
+ char fileres[FILENAMELENGTH], filerespij[FILENAMELENGTH], filereso[FILENAMELENGTH], rfileres[FILENAMELENGTH];\r
\r
char filerest[FILENAMELENGTH];\r
char fileregp[FILENAMELENGTH];\r
double dateprev1, dateprev2,jproj1,mproj1,anproj1,jproj2,mproj2,anproj2;\r
\r
\r
- char version[80]="Imach version 0.7, February 2002, INED-EUROREVES ";\r
+ char version[80]="Imach version 0.71, February 2002, INED-EUROREVES ";\r
char *alph[]={"a","a","b","c","d","e"}, str[4];\r
\r
\r
printf("\n");\r
\r
\r
- /*-------- data file ----------*/\r
- if((ficres =fopen(fileres,"w"))==NULL) {\r
- printf("Problem with resultfile: %s\n", fileres);goto end;\r
+ /*-------- Rewriting paramater file ----------*/\r
+ strcpy(rfileres,"r"); /* "Rparameterfile */\r
+ strcat(rfileres,optionfilefiname); /* Parameter file first name*/\r
+ strcat(rfileres,"."); /* */\r
+ strcat(rfileres,optionfilext); /* Other files have txt extension */\r
+ if((ficres =fopen(rfileres,"w"))==NULL) {\r
+ printf("Problem writing new parameter file: %s\n", fileres);goto end;\r
}\r
fprintf(ficres,"#%s\n",version);\r
\r
+ /*-------- data file ----------*/\r
if((fic=fopen(datafile,"r"))==NULL) {\r
printf("Problem with datafile: %s\n", datafile);goto end;\r
}\r
}\r
\r
/*--------- results files --------------*/\r
- fprintf(ficres,"title=%s datafile=%s lastobs=%d firstpass=%d lastpass=%d\nftol=%e stepm=%d ncov=%d nlstate=%d ndeath=%d maxwav=%d mle=%d weight=%d\nmodel=%s\n", title, datafile, lastobs, firstpass,lastpass,ftol, stepm, ncov, nlstate, ndeath, maxwav, mle,weightopt,model);\r
+ fprintf(ficres,"title=%s datafile=%s lastobs=%d firstpass=%d lastpass=%d\nftol=%e stepm=%d ncov=%d nlstate=%d ndeath=%d maxwav=%d mle= 0 weight=%d\nmodel=%s\n", title, datafile, lastobs, firstpass,lastpass,ftol, stepm, ncov, nlstate, ndeath, maxwav, weightopt,model);\r
\r
\r
jk=1;\r
\r
/*--------- index.htm --------*/\r
\r
- printinghtml(fileres,title,datafile, firstpass, lastpass, stepm, weightopt,model,imx,jmin,jmax,jmean,optionfile,optionfilehtm);\r
+ printinghtml(fileres,title,datafile, firstpass, lastpass, stepm, weightopt,model,imx,jmin,jmax,jmean,optionfile,optionfilehtm,rfileres);\r
\r
\r
/*--------------- Prevalence limit --------------*/\r