--- imach/src/imach.c 2006/03/16 15:10:38 1.120 +++ imach/src/imach.c 2006/03/20 10:52:43 1.123 @@ -1,6 +1,32 @@ -/* $Id: imach.c,v 1.120 2006/03/16 15:10:38 lievre Exp $ +/* $Id: imach.c,v 1.123 2006/03/20 10:52:43 brouard Exp $ $State: Exp $ $Log: imach.c,v $ + Revision 1.123 2006/03/20 10:52:43 brouard + * imach.c (Module): changed, corresponds to .htm file + name. <head> headers where missing. + + * imach.c (Module): Weights can have a decimal point as for + English (a comma might work with a correct LC_NUMERIC environment, + otherwise the weight is truncated). + Modification of warning when the covariates values are not 0 or + 1. + Version 0.98g + + Revision 1.122 2006/03/20 09:45:41 brouard + (Module): Weights can have a decimal point as for + English (a comma might work with a correct LC_NUMERIC environment, + otherwise the weight is truncated). + Modification of warning when the covariates values are not 0 or + 1. + Version 0.98g + + Revision 1.121 2006/03/16 17:45:01 lievre + * imach.c (Module): Comments concerning covariates added + + * imach.c (Module): refinements in the computation of lli if + status=-2 in order to have more reliable computation if stepm is + not 1 month. Version 0.98f + Revision 1.120 2006/03/16 15:10:38 lievre (Module): refinements in the computation of lli if status=-2 in order to have more reliable computation if stepm is @@ -331,11 +357,11 @@ extern int errno; #define ODIRSEPARATOR '/' #endif -/* $Id: imach.c,v 1.120 2006/03/16 15:10:38 lievre Exp $ */ +/* $Id: imach.c,v 1.123 2006/03/20 10:52:43 brouard Exp $ */ /* $State: Exp $ */ -char version[]="Imach version 0.98f, March 2006, INED-EUROREVES-Institut de longevite "; -char fullversion[]="$Revision: 1.120 $ $Date: 2006/03/16 15:10:38 $"; +char version[]="Imach version 0.98g, March 2006, INED-EUROREVES-Institut de longevite "; +char fullversion[]="$Revision: 1.123 $ $Date: 2006/03/20 10:52:43 $"; char strstart[80]; char optionfilext[10], optionfilefiname[FILENAMELENGTH]; int erreur, nberr=0, nbwarn=0; /* Error number, number of errors number of warnings */ @@ -409,6 +435,7 @@ char strcurr[80], strfor[80]; char *endptr; long lval; +double dval; #define NR_END 1 #define FREE_ARG char* @@ -3453,7 +3480,7 @@ void printinghtml(char fileres[], char t - Period (stable) prevalence in each health state: <a href=\"%s\">%s</a> <br>\n", subdirf2(fileres,"pl"),subdirf2(fileres,"pl")); fprintf(fichtm,"\ - - (a) Life expectancies by health status at initial age, (b) health expectancies by health status at initial age: ei., eij (estepm=%2d months): \ + - (a) Life expectancies by health status at initial age, (b) health expectancies by health status at initial age: ei., eij . If one or more covariate are included, specific tables for each value of the covariate are output in sequences within the same file (estepm=%2d months): \ <a href=\"%s\">%s</a> <br>\n</li>", estepm,subdirf2(fileres,"e"),subdirf2(fileres,"e")); @@ -4552,6 +4579,7 @@ int main(int argc, char *argv[]) free_ma3x(delti3,1,nlstate,1, nlstate+ndeath-1,1,ncovmodel); fclose (ficparo); fclose (ficlog); + goto end; exit(0); } else if(mle==-3) { @@ -4582,7 +4610,9 @@ int main(int argc, char *argv[]) j++; fscanf(ficpar,"%1d%1d",&i1,&j1); if ((i1 != i) && (j1 != j)){ - printf("Error in line parameters number %d, %1d%1d instead of %1d%1d \n",numlinepar, i,j, i1, j1); + printf("Error in line parameters number %d, %1d%1d instead of %1d%1d \n \ +It might be a problem of design; if ncovcol and the model are correct\n \ +run imach with mle=-1 to get a correct template of the parameter file.\n",numlinepar, i,j, i1, j1); exit(1); } fprintf(ficparo,"%1d%1d",i1,j1); @@ -4806,12 +4836,12 @@ int main(int argc, char *argv[]) cutv(stra, strb,line,' '); errno=0; - lval=strtol(strb,&endptr,10); + dval=strtod(strb,&endptr); if( strb[0]=='\0' || (*endptr != '\0')){ - printf("Error reading data around '%d' at line number %ld %s for individual %d\nShould be a weight. Exiting.\n",lval, i,line,linei); + printf("Error reading data around '%f' at line number %ld, \"%s\" for individual %d\nShould be a weight. Exiting.\n",dval, i,line,linei); exit(1); } - weight[i]=(double)(lval); + weight[i]=dval; strcpy(line,stra); for (j=ncovcol;j>=1;j--){ @@ -4823,7 +4853,15 @@ int main(int argc, char *argv[]) exit(1); } if(lval <-1 || lval >1){ - printf("Error reading data around '%d' at line number %ld %s for individual %d, '%s'\nShould be a value of the %d covar (meaning 0 for the reference or 1. IMaCh does not build design variables, do it your self). Exiting.\n",lval,linei, i,line,j); + printf("Error reading data around '%d' at line number %ld for individual %d, '%s'\n \ + Should be a value of %d(nth) covariate (0 should be the value for the reference and 1\n \ + for the alternative. IMaCh does not build design variables automatically, do it yourself.\n \ + For example, for multinomial values like 1, 2 and 3,\n \ + build V1=0 V2=0 for the reference value (1),\n \ + V1=1 V2=0 for (2) \n \ + and V1=0 V2=1 for (3). V1=1 V2=1 should not exist and the corresponding\n \ + output of IMaCh is often meaningless.\n \ + Exiting.\n",lval,linei, i,line,j); exit(1); } covar[j][i]=(double)(lval); @@ -5119,13 +5157,13 @@ int main(int argc, char *argv[]) printf("Problem with %s \n",optionfilehtmcov), exit(0); } else{ - fprintf(fichtmcov,"<body>\n<title>IMaCh Cov %s\n %s
%s
\ + fprintf(fichtmcov,"\nIMaCh Cov %s\n %s
%s
\
\n\ Title=%s
Datafile=%s Firstpass=%d Lastpass=%d Stepm=%d Weight=%d Model=%s
\n",\ - fileres,version,fullversion,title,datafile,firstpass,lastpass,stepm, weightopt, model); + optionfilehtmcov,version,fullversion,title,datafile,firstpass,lastpass,stepm, weightopt, model); } - fprintf(fichtm,"\nIMaCh %s\n %s
%s
\ + fprintf(fichtm,"\nIMaCh %s\n %s
%s
\
\n\ Title=%s
Datafile=%s Firstpass=%d Lastpass=%d Stepm=%d Weight=%d Model=%s
\n\ \n\ @@ -5136,7 +5174,7 @@ Title=%s
Datafile=%s Firstpass=%d La - Log file of the run: %s
\n\ - Gnuplot file name: %s
\n\ - Date and time at start: %s\n",\ - fileres,version,fullversion,title,datafile,firstpass,lastpass,stepm, weightopt, model,\ + optionfilehtm,version,fullversion,title,datafile,firstpass,lastpass,stepm, weightopt, model,\ optionfilefiname,optionfilext,optionfilefiname,optionfilext,\ fileres,fileres,\ filelog,filelog,optionfilegnuplot,optionfilegnuplot,strstart); @@ -5901,8 +5939,9 @@ Interval (in months) between two waves: fprintf(ficlog,"Total time was %d Sec.\n", end_time.tv_sec -start_time.tv_sec); /* printf("Total time was %d uSec.\n", total_usecs);*/ /* if(fileappend(fichtm,optionfilehtm)){ */ - fprintf(fichtm,"
Local time at start %s
Local time at end %s
",strstart, strtend); + fprintf(fichtm,"
Local time at start %s
Local time at end %s
\n",strstart, strtend); fclose(fichtm); + fprintf(fichtmcov,"
Local time at start %s
Local time at end %s
\n",strstart, strtend); fclose(fichtmcov); fclose(ficgp); fclose(ficlog);