|
|
| version 1.256, 2017/03/27 05:50:23 | version 1.259, 2017/04/04 13:01:16 |
|---|---|
| Line 1 | Line 1 |
| /* $Id$ | /* $Id$ |
| $State$ | $State$ |
| $Log$ | $Log$ |
| Revision 1.259 2017/04/04 13:01:16 brouard | |
| Summary: Some errors to warnings only if date of death is unknown but status is death we could set to pi3 | |
| Revision 1.258 2017/04/03 10:17:47 brouard | |
| Summary: Version 0.99r12 | |
| Some cleanings, conformed with updated documentation. | |
| Revision 1.257 2017/03/29 16:53:30 brouard | |
| Summary: Temp | |
| Revision 1.256 2017/03/27 05:50:23 brouard | Revision 1.256 2017/03/27 05:50:23 brouard |
| Summary: Temporary | Summary: Temporary |
| Line 1174 int *TvarsQind; | Line 1185 int *TvarsQind; |
| #define MAXRESULTLINES 10 | #define MAXRESULTLINES 10 |
| int nresult=0; | int nresult=0; |
| int parameterline=0; /* # of the parameter (type) line */ | |
| int TKresult[MAXRESULTLINES]; | int TKresult[MAXRESULTLINES]; |
| int Tresult[MAXRESULTLINES][NCOVMAX];/* For dummy variable , value (output) */ | int Tresult[MAXRESULTLINES][NCOVMAX];/* For dummy variable , value (output) */ |
| int Tinvresult[MAXRESULTLINES][NCOVMAX];/* For dummy variable , value (output) */ | int Tinvresult[MAXRESULTLINES][NCOVMAX];/* For dummy variable , value (output) */ |
| Line 4959 void concatwav(int wav[], int **dh, int | Line 4971 void concatwav(int wav[], int **dh, int |
| /* if(mi==0) never been interviewed correctly before death */ | /* if(mi==0) never been interviewed correctly before death */ |
| /* Only death is a correct wave */ | /* Only death is a correct wave */ |
| mw[mi][i]=m; | mw[mi][i]=m; |
| } | } /* else not in a death state */ |
| #ifndef DISPATCHINGKNOWNDEATHAFTERLASTWAVE | #ifndef DISPATCHINGKNOWNDEATHAFTERLASTWAVE |
| else if ((int) andc[i] != 9999) { /* Status is negative. A death occured after lastpass, we can't take it into account because of potential bias */ | else if ((int) andc[i] != 9999) { /* Date of death is known */ |
| /* m++; */ | |
| /* mi++; */ | |
| /* s[m][i]=nlstate+1; /\* We are setting the status to the last of non live state *\/ */ | |
| /* mw[mi][i]=m; */ | |
| if ((int)anint[m][i]!= 9999) { /* date of last interview is known */ | if ((int)anint[m][i]!= 9999) { /* date of last interview is known */ |
| if((andc[i]+moisdc[i]/12.) <=(anint[m][i]+mint[m][i]/12.)){ /* death occured before last wave and status should have been death instead of -1 */ | if((andc[i]+moisdc[i]/12.) <=(anint[m][i]+mint[m][i]/12.)){ /* death occured before last wave and status should have been death instead of -1 */ |
| nbwarn++; | nbwarn++; |
| Line 4978 void concatwav(int wav[], int **dh, int | Line 4986 void concatwav(int wav[], int **dh, int |
| }else{ /* Death occured afer last wave potential bias */ | }else{ /* Death occured afer last wave potential bias */ |
| nberr++; | nberr++; |
| if(firstwo==0){ | if(firstwo==0){ |
| printf("Error! Death for individual %ld line=%d occurred at %d/%d after last wave %d interviewed at %d/%d. Potential bias if other individuals are still alive at this date but ignored. This case (%d)/wave (%d) is skipped, no contribution to likelihood.\nOthers in log file only\n",num[i],i,(int) moisdc[i], (int) andc[i], lastpass,(int)mint[m][i],(int)anint[m][i], i,m ); | printf("Error! Death for individual %ld line=%d occurred at %d/%d after last wave %d interviewed at %d/%d. Potential bias if other individuals are still alive at this date but ignored. This case (%d)/wave (%d) is skipped, no contribution to likelihood. Please add a new fictive wave at the date of last vital status scan, with a dead status or alive but unknown state status (-1). See documentation\nOthers in log file only\n",num[i],i,(int) moisdc[i], (int) andc[i], lastpass,(int)mint[m][i],(int)anint[m][i], i,m ); |
| firstwo=1; | firstwo=1; |
| } | } |
| fprintf(ficlog,"Error! Death for individual %ld line=%d occurred at %d/%d after last wave %d interviewed at %d/%d. Potential bias if other individuals are still alive at this date but ignored. This case (%d)/wave (%d) is skipped, no contribution to likelihood.\n",num[i],i,(int) moisdc[i], (int) andc[i], lastpass,(int)mint[m][i],(int)anint[m][i], i,m ); | fprintf(ficlog,"Error! Death for individual %ld line=%d occurred at %d/%d after last wave %d interviewed at %d/%d. Potential bias if other individuals are still alive at this date but ignored. This case (%d)/wave (%d) is skipped, no contribution to likelihood. Please add a new fictive wave at the date of last vital status scan, with a dead status or alive but unknown state status (-1). See documentation\n\n",num[i],i,(int) moisdc[i], (int) andc[i], lastpass,(int)mint[m][i],(int)anint[m][i], i,m ); |
| } | } |
| }else{ /* end date of interview is known */ | }else{ /* if date of interview is unknown */ |
| /* death is known but not confirmed by death status at any wave */ | /* death is known but not confirmed by death status at any wave */ |
| if(firstfour==0){ | if(firstfour==0){ |
| printf("Error! Death for individual %ld line=%d occurred %d/%d but not confirmed by any death status for any wave, including last wave %d at unknown date %d/%d. Potential bias if other individuals are still alive at this date but ignored. This case (%d)/wave (%d) is skipped, no contribution to likelihood.\nOthers in log file only\n",num[i],i,(int) moisdc[i], (int) andc[i], lastpass,(int)mint[m][i],(int)anint[m][i], i,m ); | printf("Error! Death for individual %ld line=%d occurred %d/%d but not confirmed by any death status for any wave, including last wave %d at unknown date %d/%d. Potential bias if other individuals are still alive at this date but ignored. This case (%d)/wave (%d) is skipped, no contribution to likelihood.\nOthers in log file only\n",num[i],i,(int) moisdc[i], (int) andc[i], lastpass,(int)mint[m][i],(int)anint[m][i], i,m ); |
| Line 6376 To be simple, these graphs help to under | Line 6384 To be simple, these graphs help to under |
| void printinghtml(char fileresu[], char title[], char datafile[], int firstpass, \ | void printinghtml(char fileresu[], char title[], char datafile[], int firstpass, \ |
| int lastpass, int stepm, int weightopt, char model[],\ | int lastpass, int stepm, int weightopt, char model[],\ |
| int imx,int jmin, int jmax, double jmeanint,char rfileres[],\ | int imx,int jmin, int jmax, double jmeanint,char rfileres[],\ |
| int popforecast, int prevfcast, int backcast, int estepm , \ | int popforecast, int mobilav, int prevfcast, int mobilavproj, int backcast, int estepm , \ |
| double jprev1, double mprev1,double anprev1, double dateprev1, \ | double jprev1, double mprev1,double anprev1, double dateprev1, \ |
| double jprev2, double mprev2,double anprev2, double dateprev2){ | double jprev2, double mprev2,double anprev2, double dateprev2){ |
| int jj1, k1, i1, cpt, k4, nres; | int jj1, k1, i1, cpt, k4, nres; |
| Line 6450 void printinghtml(char fileresu[], char | Line 6458 void printinghtml(char fileresu[], char |
| } | } |
| } | } |
| /* aij, bij */ | /* aij, bij */ |
| fprintf(fichtm,"<br>- Logit model (yours is: 1+age+%s), for example: logit(pij)=log(pij/pii)= aij+ bij age + V1 age + etc. as a function of age: <a href=\"%s_%d-1-%d.svg\">%s_%d-1-%d.svg</a><br> \ | fprintf(fichtm,"<br>- Logit model (yours is: logit(pij)=log(pij/pii)= aij+ bij age+%s) as a function of age: <a href=\"%s_%d-1-%d.svg\">%s_%d-1-%d.svg</a><br> \ |
| <img src=\"%s_%d-1-%d.svg\">",model,subdirf2(optionfilefiname,"PE_"),k1,nres,subdirf2(optionfilefiname,"PE_"),k1,nres,subdirf2(optionfilefiname,"PE_"),k1,nres); | <img src=\"%s_%d-1-%d.svg\">",model,subdirf2(optionfilefiname,"PE_"),k1,nres,subdirf2(optionfilefiname,"PE_"),k1,nres,subdirf2(optionfilefiname,"PE_"),k1,nres); |
| /* Pij */ | /* Pij */ |
| fprintf(fichtm,"<br>\n- P<sub>ij</sub> or conditional probabilities to be observed in state j being in state i, %d (stepm) months before: <a href=\"%s_%d-2-%d.svg\">%s_%d-2-%d.svg</a><br> \ | fprintf(fichtm,"<br>\n- P<sub>ij</sub> or conditional probabilities to be observed in state j being in state i, %d (stepm) months before: <a href=\"%s_%d-2-%d.svg\">%s_%d-2-%d.svg</a><br> \ |
| Line 6487 divided by h: <sub>h</sub>P<sub>ij</sub> | Line 6495 divided by h: <sub>h</sub>P<sub>ij</sub> |
| if(prevfcast==1){ | if(prevfcast==1){ |
| /* Projection of prevalence up to period (stable) prevalence in each health state */ | /* Projection of prevalence up to period (stable) prevalence in each health state */ |
| for(cpt=1; cpt<=nlstate;cpt++){ | for(cpt=1; cpt<=nlstate;cpt++){ |
| fprintf(fichtm,"<br>\n- Projection of cross-sectional prevalence (estimated with cases observed from %.1f to %.1f) 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-%d.svg\">%s_%d-%d-%d.svg</a><br> \ | fprintf(fichtm,"<br>\n- Projection of cross-sectional prevalence (estimated with cases observed from %.1f to %.1f and mobil_average=%d) 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-%d.svg\">%s_%d-%d-%d.svg</a><br> \ |
| <img src=\"%s_%d-%d-%d.svg\">", dateprev1, dateprev2, cpt, cpt, nlstate, subdirf2(optionfilefiname,"PROJ_"),cpt,k1,nres,subdirf2(optionfilefiname,"PROJ_"),cpt,k1,nres,subdirf2(optionfilefiname,"PROJ_"),cpt,k1,nres); | <img src=\"%s_%d-%d-%d.svg\">", dateprev1, dateprev2, mobilavproj, cpt, cpt, nlstate, subdirf2(optionfilefiname,"PROJ_"),cpt,k1,nres,subdirf2(optionfilefiname,"PROJ_"),cpt,k1,nres,subdirf2(optionfilefiname,"PROJ_"),cpt,k1,nres); |
| } | } |
| } | } |
| Line 6576 See page 'Matrix of variance-covariance | Line 6584 See page 'Matrix of variance-covariance |
| } | } |
| } | } |
| for(cpt=1; cpt<=nlstate;cpt++) { | for(cpt=1; cpt<=nlstate;cpt++) { |
| fprintf(fichtm,"\n<br>- Observed (cross-sectional) and period (incidence based) \ | fprintf(fichtm,"\n<br>- Observed (cross-sectional with mov_average=%d) and period (incidence based) \ |
| prevalence (with 95%% confidence interval) in state (%d): <a href=\"%s_%d-%d-%d.svg\"> %s_%d-%d-%d.svg</a>\n <br>\ | prevalence (with 95%% confidence interval) in state (%d): <a href=\"%s_%d-%d-%d.svg\"> %s_%d-%d-%d.svg</a>\n <br>\ |
| <img src=\"%s_%d-%d-%d.svg\">",cpt,subdirf2(optionfilefiname,"V_"),cpt,k1,nres,subdirf2(optionfilefiname,"V_"),cpt,k1,nres,subdirf2(optionfilefiname,"V_"),cpt,k1,nres); | <img src=\"%s_%d-%d-%d.svg\">",mobilav,cpt,subdirf2(optionfilefiname,"V_"),cpt,k1,nres,subdirf2(optionfilefiname,"V_"),cpt,k1,nres,subdirf2(optionfilefiname,"V_"),cpt,k1,nres); |
| } | } |
| 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). If popbased=1 the smooth (due to the model) \ | health expectancies in states (1) and (2). If popbased=1 the smooth (due to the model) \ |
| Line 9100 int calandcheckages(int imx, int maxwav, | Line 9108 int calandcheckages(int imx, int maxwav, |
| s[m][i]=-1; | s[m][i]=-1; |
| } | } |
| if((int)moisdc[i]==99 && (int)andc[i]==9999 && s[m][i]>nlstate){ | if((int)moisdc[i]==99 && (int)andc[i]==9999 && s[m][i]>nlstate){ |
| *nberr = *nberr + 1; | *nbwarn = *nbwarn + 1; |
| if(firstone == 0){ | if(firstone == 0){ |
| firstone=1; | firstone=1; |
| printf("Error! Date of death (month %2d and year %4d) of individual %ld on line %d was unknown, you must set an arbitrary year of death or he/she is skipped and results can be biased (%d) because status is a death state %d at wave %d. Wave dropped.\nOther similar cases in log file\n",(int)moisdc[i],(int)andc[i],num[i],i, *nberr,s[m][i],m); | printf("Warning (#%d)! Date of death (month %2d and year %4d) of individual %ld on line %d was unknown but status is a death state %d at wave %d. If you don't know the vital status, please enter -2. If he/she is still alive but don't know the state, please code with '-1 or '.'. Here, we believe in a death.\nOther similar cases in log file\n", *nbwarn,(int)moisdc[i],(int)andc[i],num[i],i,s[m][i],m); |
| } | } |
| fprintf(ficlog,"Error! Date of death (month %2d and year %4d) of individual %ld on line %d was unknown, you must set an arbitrary year of death or he/she is skipped and results can be biased (%d) because status is a death state %d at wave %d. Wave dropped.\n",(int)moisdc[i],(int)andc[i],num[i],i, *nberr,s[m][i],m); | fprintf(ficlog,"Warning (#%d)! Date of death (month %2d and year %4d) of individual %ld on line %d was unknown but status is a death state %d at wave %d. If you don't know the vital status, please enter -2. If he/she is still alive but don't know the state, please code with '-1 or '.'. Here, we believe in a death.\nOther similar cases in log file\n", *nbwarn,(int)moisdc[i],(int)andc[i],num[i],i,s[m][i],m); |
| s[m][i]=-1; | /* s[m][i]=-1; */ /* Keeping the death status */ |
| } | } |
| if((int)moisdc[i]==99 && (int)andc[i]!=9999 && s[m][i]>nlstate){ | if((int)moisdc[i]==99 && (int)andc[i]!=9999 && s[m][i]>nlstate){ |
| (*nberr)++; | (*nberr)++; |
| printf("Error! Month of death of individual %ld on line %d was unknown %2d, you should set it otherwise the information on the death is skipped and results are biased.\n",num[i],i,(int)moisdc[i]); | printf("Error (#%d)! Month of death of individual %ld on line %d was unknown (%2d) (year of death is %4d) and status is a death state %d at wave %d. Please impute an arbitrary (or not) month and rerun. Currently this transition to death will be skipped (status is set to -2).\nOther similar cases in log file\n", *nberr, num[i],i,(int)moisdc[i],(int)andc[i],s[m][i],m); |
| fprintf(ficlog,"Error! Month of death of individual %ld on line %d was unknown %f, you should set it otherwise the information on the death is skipped and results are biased.\n",num[i],i,moisdc[i]); | fprintf(ficlog,"Error (#%d)! Month of death of individual %ld on line %d was unknown (%2d) (year of death is %4d) and status is a death state %d at wave %d. Please impute an arbitrary (or not) month and rerun. Currently this transition to death will be skipped (status is set to -2).\nOther similar cases in log file\n", *nberr, num[i],i,(int)moisdc[i],(int)andc[i],s[m][i],m); |
| s[m][i]=-1; /* We prefer to skip it (and to skip it in version 0.8a1 too */ | s[m][i]=-2; /* We prefer to skip it (and to skip it in version 0.8a1 too */ |
| } | } |
| } | } |
| } | } |
| Line 9778 int main(int argc, char *argv[]) | Line 9786 int main(int argc, char *argv[]) |
| int NDIM=2; | int NDIM=2; |
| int vpopbased=0; | int vpopbased=0; |
| int nres=0; | int nres=0; |
| int endishere=0; | |
| char ca[32], cb[32]; | char ca[32], cb[32]; |
| /* FILE *fichtm; *//* Html File */ | /* FILE *fichtm; *//* Html File */ |
| Line 11152 Please run with mle=-1 to get a correct | Line 11161 Please run with mle=-1 to get a correct |
| fprintf(ficlog,"Error: Not 7 (data)parameters in line but %d, for example:begin-prev-date=1/1/1990 end-prev-date=1/6/2004 mov_average=0\n, your line=%s . Probably you are running an older format.\n",num_filled,line); | fprintf(ficlog,"Error: Not 7 (data)parameters in line but %d, for example:begin-prev-date=1/1/1990 end-prev-date=1/6/2004 mov_average=0\n, your line=%s . Probably you are running an older format.\n",num_filled,line); |
| goto end; | goto end; |
| } | } |
| /* fscanf(ficpar,"begin-prev-date=%lf/%lf/%lf end-prev-date=%lf/%lf/%lf mov_average=%d\n",&jprev1, &mprev1,&anprev1,&jprev2, &mprev2,&anprev2,&mobilav); */ | |
| printf("begin-prev-date=%.lf/%.lf/%.lf end-prev-date=%.lf/%.lf/%.lf mov_average=%d\n",jprev1, mprev1,anprev1,jprev2, mprev2,anprev2,mobilav); | printf("begin-prev-date=%.lf/%.lf/%.lf end-prev-date=%.lf/%.lf/%.lf mov_average=%d\n",jprev1, mprev1,anprev1,jprev2, mprev2,anprev2,mobilav); |
| fprintf(ficparo,"begin-prev-date=%.lf/%.lf/%.lf end-prev-date=%.lf/%.lf/%.lf mov_average=%d\n",jprev1, mprev1,anprev1,jprev2, mprev2,anprev2,mobilav); | fprintf(ficparo,"begin-prev-date=%.lf/%.lf/%.lf end-prev-date=%.lf/%.lf/%.lf mov_average=%d\n",jprev1, mprev1,anprev1,jprev2, mprev2,anprev2,mobilav); |
| fprintf(ficres,"begin-prev-date=%.lf/%.lf/%.lf end-prev-date=%.lf/%.lf/%.lf mov_average=%d\n",jprev1, mprev1,anprev1,jprev2, mprev2,anprev2,mobilav); | fprintf(ficres,"begin-prev-date=%.lf/%.lf/%.lf end-prev-date=%.lf/%.lf/%.lf mov_average=%d\n",jprev1, mprev1,anprev1,jprev2, mprev2,anprev2,mobilav); |
| printf("begin-prev-date=%.lf/%.lf/%.lf end-prev-date=%.lf/%.lf/%.lf mov_average=%d\n",jprev1, mprev1,anprev1,jprev2, mprev2,anprev2,mobilav); | |
| fprintf(ficlog,"begin-prev-date=%.lf/%.lf/%.lf end-prev-date=%.lf/%.lf/%.lf mov_average=%d\n",jprev1, mprev1,anprev1,jprev2, mprev2,anprev2,mobilav); | fprintf(ficlog,"begin-prev-date=%.lf/%.lf/%.lf end-prev-date=%.lf/%.lf/%.lf mov_average=%d\n",jprev1, mprev1,anprev1,jprev2, mprev2,anprev2,mobilav); |
| } | } |
| Line 11188 Please run with mle=-1 to get a correct | Line 11195 Please run with mle=-1 to get a correct |
| fprintf(ficres,"pop_based=%d\n",popbased); | fprintf(ficres,"pop_based=%d\n",popbased); |
| } | } |
| while(fgets(line, MAXLINE, ficpar)) { | |
| /* If line starts with a # it is a comment */ | |
| if (line[0] == '#') { | |
| numlinepar++; | |
| fputs(line,stdout); | |
| fputs(line,ficparo); | |
| fputs(line,ficlog); | |
| continue; | |
| }else | |
| break; | |
| } | |
| /* while((c=getc(ficpar))=='#' && c!= EOF){ */ | |
| /* ungetc(c,ficpar); */ | |
| /* fgets(line, MAXLINE, ficpar); */ | |
| /* fputs(line,stdout); */ | |
| /* fputs(line,ficres); */ | |
| /* fputs(line,ficparo); */ | |
| /* } */ | |
| /* ungetc(c,ficpar); */ | |
| /* fscanf(ficpar,"prevforecast=%d starting-proj-date=%lf/%lf/%lf final-proj-date=%lf/%lf/%lf mobil_average=%d\n",&prevfcast,&jproj1,&mproj1,&anproj1,&jproj2,&mproj2,&anproj2,&mobilavproj); */ | |
| if((num_filled=sscanf(line,"prevforecast=%d starting-proj-date=%lf/%lf/%lf final-proj-date=%lf/%lf/%lf mobil_average=%d\n",&prevfcast,&jproj1,&mproj1,&anproj1,&jproj2,&mproj2,&anproj2,&mobilavproj)) !=EOF){ | |
| if (num_filled != 8) { | |
| printf("Error: Not 8 (data)parameters in line but %d, for example:prevforecast=1 starting-proj-date=1/1/1990 final-proj-date=1/1/2000 mobil_average=0\n, your line=%s . Probably you are running an older format.\n",num_filled,line); | |
| fprintf(ficlog,"Error: Not 8 (data)parameters in line but %d, for example:prevforecast=1 starting-proj-date=1/1/1990 final-proj-date=1/1/2000 mov_average=0\n, your line=%s . Probably you are running an older format.\n",num_filled,line); | |
| goto end; | |
| } | |
| fprintf(ficparo,"prevforecast=%d starting-proj-date=%.lf/%.lf/%.lf final-proj-date=%.lf/%.lf/%.lf mobil_average=%d\n",prevfcast,jproj1,mproj1,anproj1,jproj2,mproj2,anproj2,mobilavproj); | |
| printf("prevforecast=%d starting-proj-date=%.lf/%.lf/%.lf final-proj-date=%.lf/%.lf/%.lf mobil_average=%d\n",prevfcast,jproj1,mproj1,anproj1,jproj2,mproj2,anproj2,mobilavproj); | |
| fprintf(ficlog,"prevforecast=%d starting-proj-date=%.lf/%.lf/%.lf final-proj-date=%.lf/%.lf/%.lf mobil_average=%d\n",prevfcast,jproj1,mproj1,anproj1,jproj2,mproj2,anproj2,mobilavproj); | |
| fprintf(ficres,"prevforecast=%d starting-proj-date=%.lf/%.lf/%.lf final-proj-date=%.lf/%.lf/%.lf mobil_average=%d\n",prevfcast,jproj1,mproj1,anproj1,jproj2,mproj2,anproj2,mobilavproj); | |
| /* day and month of proj2 are not used but only year anproj2.*/ | |
| } | |
| while(fgets(line, MAXLINE, ficpar)) { | |
| /* If line starts with a # it is a comment */ | |
| if (line[0] == '#') { | |
| numlinepar++; | |
| fputs(line,stdout); | |
| fputs(line,ficparo); | |
| fputs(line,ficlog); | |
| continue; | |
| }else | |
| break; | |
| } | |
| /* while((c=getc(ficpar))=='#' && c!= EOF){ */ | |
| /* ungetc(c,ficpar); */ | |
| /* fgets(line, MAXLINE, ficpar); */ | |
| /* fputs(line,stdout); */ | |
| /* fputs(line,ficparo); */ | |
| /* fputs(line,ficres); */ | |
| /* } */ | |
| /* ungetc(c,ficpar); */ | |
| fscanf(ficpar,"backcast=%d starting-back-date=%lf/%lf/%lf final-back-date=%lf/%lf/%lf mobil_average=%d\n",&backcast,&jback1,&mback1,&anback1,&jback2,&mback2,&anback2,&mobilavproj); | |
| if((num_filled=sscanf(line,"backcast=%d starting-back-date=%lf/%lf/%lf final-back-date=%lf/%lf/%lf mobil_average=%d\n",&backcast,&jback1,&mback1,&anback1,&jback2,&mback2,&anback2,&mobilavproj)) !=EOF){ | |
| if (num_filled != 8) { | |
| printf("Error: Not 8 (data)parameters in line but %d, for example:backcast=1 starting-back-date=1/1/1990 finloal-back-date=1/1/1970 mobil_average=1\n, your line=%s . Probably you are running an older format.\n",num_filled,line); | |
| fprintf(ficlog,"Error: Not 8 (data)parameters in line but %d, for example:backcast=1 starting-back-date=1/1/1990 finloal-back-date=1/1/1970 mobil_average=1\n, your line=%s . Probably you are running an older format.\n",num_filled,line); | |
| goto end; | |
| } | |
| printf("backcast=%d starting-back-date=%.lf/%.lf/%.lf final-back-date=%.lf/%.lf/%.lf mobil_average=%d\n",backcast,jback1,mback1,anback1,jback2,mback2,anback2,mobilavproj); | |
| fprintf(ficparo,"backcast=%d starting-back-date=%.lf/%.lf/%.lf final-back-date=%.lf/%.lf/%.lf mobil_average=%d\n",backcast,jback1,mback1,anback1,jback2,mback2,anback2,mobilavproj); | |
| fprintf(ficlog,"backcast=%d starting-back-date=%.lf/%.lf/%.lf final-back-date=%.lf/%.lf/%.lf mobil_average=%d\n",backcast,jback1,mback1,anback1,jback2,mback2,anback2,mobilavproj); | |
| fprintf(ficres,"backcast=%d starting-back-date=%.lf/%.lf/%.lf final-back-date=%.lf/%.lf/%.lf mobil_average=%d\n",backcast,jback1,mback1,anback1,jback2,mback2,anback2,mobilavproj); | |
| /* day and month of proj2 are not used but only year anproj2.*/ | |
| } | |
| /* Results */ | /* Results */ |
| nresult=0; | nresult=0; |
| while(fgets(line, MAXLINE, ficpar)) { | do{ |
| /* If line starts with a # it is a comment */ | if(!fgets(line, MAXLINE, ficpar)){ |
| if (line[0] == '#') { | endishere=1; |
| parameterline=14; | |
| }else if (line[0] == '#') { | |
| /* If line starts with a # it is a comment */ | |
| numlinepar++; | numlinepar++; |
| fputs(line,stdout); | fputs(line,stdout); |
| fputs(line,ficparo); | fputs(line,ficparo); |
| fputs(line,ficlog); | fputs(line,ficlog); |
| fputs(line,ficres); | |
| continue; | continue; |
| }else | }else if(sscanf(line,"prevforecast=%[^\n]\n",modeltemp)) |
| break; | parameterline=11; |
| } | else if(sscanf(line,"backcast=%[^\n]\n",modeltemp)) |
| if (!feof(ficpar)) | parameterline=12; |
| while((num_filled=sscanf(line,"result:%[^\n]\n",resultline)) !=EOF){ | else if(sscanf(line,"result:%[^\n]\n",modeltemp)) |
| if (num_filled == 0){ | parameterline=13; |
| resultline[0]='\0'; | else{ |
| printf("Warning %d: no result line should be at minimum 'result: V2=0 V1=1 or result:.\n%s\n", num_filled, line); | parameterline=14; |
| break; | |
| } else if (num_filled != 1){ | |
| printf("ERROR %d: result line should be at minimum 'result: V2=0 V1=1 or result:.' %s\n",num_filled, line); | |
| } | |
| nresult++; /* Sum of resultlines */ | |
| printf("Result %d: result=%s\n",nresult, resultline); | |
| if(nresult > MAXRESULTLINES){ | |
| printf("ERROR: Current version of IMaCh limits the number of resultlines to %d, you used %d\n",MAXRESULTLINES,nresult); | |
| fprintf(ficlog,"ERROR: Current version of IMaCh limits the number of resultlines to %d, you used %d\n",MAXRESULTLINES,nresult); | |
| goto end; | |
| } | |
| decoderesult(resultline, nresult); /* Fills TKresult[nresult] combination and Tresult[nresult][k4+1] combination values */ | |
| fprintf(ficparo,"result: %s\n",resultline); | |
| fprintf(ficres,"result: %s\n",resultline); | |
| fprintf(ficlog,"result: %s\n",resultline); | |
| while(fgets(line, MAXLINE, ficpar)) { | |
| /* If line starts with a # it is a comment */ | |
| if (line[0] == '#') { | |
| numlinepar++; | |
| fputs(line,stdout); | |
| fputs(line,ficparo); | |
| fputs(line,ficres); | |
| fputs(line,ficlog); | |
| continue; | |
| }else | |
| break; | |
| } | } |
| if (feof(ficpar)) | switch (parameterline){ |
| case 11: | |
| if((num_filled=sscanf(line,"prevforecast=%d starting-proj-date=%lf/%lf/%lf final-proj-date=%lf/%lf/%lf mobil_average=%d\n",&prevfcast,&jproj1,&mproj1,&anproj1,&jproj2,&mproj2,&anproj2,&mobilavproj)) !=EOF){ | |
| if (num_filled != 8) { | |
| printf("Error: Not 8 (data)parameters in line but %d, for example:prevforecast=1 starting-proj-date=1/1/1990 final-proj-date=1/1/2000 mobil_average=0\n, your line=%s . Probably you are running an older format.\n",num_filled,line); | |
| fprintf(ficlog,"Error: Not 8 (data)parameters in line but %d, for example:prevforecast=1 starting-proj-date=1/1/1990 final-proj-date=1/1/2000 mov_average=0\n, your line=%s . Probably you are running an older format.\n",num_filled,line); | |
| goto end; | |
| } | |
| fprintf(ficparo,"prevforecast=%d starting-proj-date=%.lf/%.lf/%.lf final-proj-date=%.lf/%.lf/%.lf mobil_average=%d\n",prevfcast,jproj1,mproj1,anproj1,jproj2,mproj2,anproj2,mobilavproj); | |
| printf("prevforecast=%d starting-proj-date=%.lf/%.lf/%.lf final-proj-date=%.lf/%.lf/%.lf mobil_average=%d\n",prevfcast,jproj1,mproj1,anproj1,jproj2,mproj2,anproj2,mobilavproj); | |
| fprintf(ficlog,"prevforecast=%d starting-proj-date=%.lf/%.lf/%.lf final-proj-date=%.lf/%.lf/%.lf mobil_average=%d\n",prevfcast,jproj1,mproj1,anproj1,jproj2,mproj2,anproj2,mobilavproj); | |
| fprintf(ficres,"prevforecast=%d starting-proj-date=%.lf/%.lf/%.lf final-proj-date=%.lf/%.lf/%.lf mobil_average=%d\n",prevfcast,jproj1,mproj1,anproj1,jproj2,mproj2,anproj2,mobilavproj); | |
| /* day and month of proj2 are not used but only year anproj2.*/ | |
| } | |
| break; | break; |
| else{ /* Processess output results for this combination of covariate values */ | case 12: |
| } | /*fscanf(ficpar,"backcast=%d starting-back-date=%lf/%lf/%lf final-back-date=%lf/%lf/%lf mobil_average=%d\n",&backcast,&jback1,&mback1,&anback1,&jback2,&mback2,&anback2,&mobilavproj);*/ |
| } /* end while */ | if((num_filled=sscanf(line,"backcast=%d starting-back-date=%lf/%lf/%lf final-back-date=%lf/%lf/%lf mobil_average=%d\n",&backcast,&jback1,&mback1,&anback1,&jback2,&mback2,&anback2,&mobilavproj)) !=EOF){ |
| if (num_filled != 8) { | |
| printf("Error: Not 8 (data)parameters in line but %d, for example:backcast=1 starting-back-date=1/1/1990 finloal-back-date=1/1/1970 mobil_average=1\n, your line=%s . Probably you are running an older format.\n",num_filled,line); | |
| fprintf(ficlog,"Error: Not 8 (data)parameters in line but %d, for example:backcast=1 starting-back-date=1/1/1990 finloal-back-date=1/1/1970 mobil_average=1\n, your line=%s . Probably you are running an older format.\n",num_filled,line); | |
| goto end; | |
| } | |
| printf("backcast=%d starting-back-date=%.lf/%.lf/%.lf final-back-date=%.lf/%.lf/%.lf mobil_average=%d\n",backcast,jback1,mback1,anback1,jback2,mback2,anback2,mobilavproj); | |
| fprintf(ficparo,"backcast=%d starting-back-date=%.lf/%.lf/%.lf final-back-date=%.lf/%.lf/%.lf mobil_average=%d\n",backcast,jback1,mback1,anback1,jback2,mback2,anback2,mobilavproj); | |
| fprintf(ficlog,"backcast=%d starting-back-date=%.lf/%.lf/%.lf final-back-date=%.lf/%.lf/%.lf mobil_average=%d\n",backcast,jback1,mback1,anback1,jback2,mback2,anback2,mobilavproj); | |
| fprintf(ficres,"backcast=%d starting-back-date=%.lf/%.lf/%.lf final-back-date=%.lf/%.lf/%.lf mobil_average=%d\n",backcast,jback1,mback1,anback1,jback2,mback2,anback2,mobilavproj); | |
| /* day and month of proj2 are not used but only year anproj2.*/ | |
| } | |
| break; | |
| case 13: | |
| if((num_filled=sscanf(line,"result:%[^\n]\n",resultline)) !=EOF){ | |
| if (num_filled == 0){ | |
| resultline[0]='\0'; | |
| printf("Warning %d: no result line! It should be at minimum 'result: V2=0 V1=1 or result:.\n%s\n", num_filled, line); | |
| fprintf(ficlog,"Warning %d: no result line! It should be at minimum 'result: V2=0 V1=1 or result:.\n%s\n", num_filled, line); | |
| break; | |
| } else if (num_filled != 1){ | |
| printf("ERROR %d: result line! It should be at minimum 'result: V2=0 V1=1 or result:.' %s\n",num_filled, line); | |
| fprintf(ficlog,"ERROR %d: result line! It should be at minimum 'result: V2=0 V1=1 or result:.' %s\n",num_filled, line); | |
| } | |
| nresult++; /* Sum of resultlines */ | |
| printf("Result %d: result=%s\n",nresult, resultline); | |
| if(nresult > MAXRESULTLINES){ | |
| printf("ERROR: Current version of IMaCh limits the number of resultlines to %d, you used %d\n",MAXRESULTLINES,nresult); | |
| fprintf(ficlog,"ERROR: Current version of IMaCh limits the number of resultlines to %d, you used %d\n",MAXRESULTLINES,nresult); | |
| goto end; | |
| } | |
| decoderesult(resultline, nresult); /* Fills TKresult[nresult] combination and Tresult[nresult][k4+1] combination values */ | |
| fprintf(ficparo,"result: %s\n",resultline); | |
| fprintf(ficres,"result: %s\n",resultline); | |
| fprintf(ficlog,"result: %s\n",resultline); | |
| break; | |
| case 14: | |
| if(ncovmodel >2 && nresult==0 ){ | |
| printf("ERROR: no result lines! It should be at minimum 'result: V2=0 V1=1 or result:.' %s\n",line); | |
| goto end; | |
| } | |
| break; | |
| default: | |
| nresult=1; | |
| decoderesult(".",nresult ); /* No covariate */ | |
| } | |
| } /* End switch parameterline */ | |
| }while(endishere==0); /* End do */ | |
| /* freqsummary(fileres, agemin, agemax, s, agev, nlstate, imx,Tvaraff,nbcode, ncodemax,mint,anint); */ | /* freqsummary(fileres, agemin, agemax, s, agev, nlstate, imx,Tvaraff,nbcode, ncodemax,mint,anint); */ |
| /* ,dateprev1,dateprev2,jprev1, mprev1,anprev1,jprev2, mprev2,anprev2); */ | /* ,dateprev1,dateprev2,jprev1, mprev1,anprev1,jprev2, mprev2,anprev2); */ |
| Line 11323 Please run with mle=-1 to get a correct | Line 11298 Please run with mle=-1 to get a correct |
| printinggnuplot(fileresu, optionfilefiname,ageminpar,agemaxpar,fage, prevfcast, backcast, pathc,p); | printinggnuplot(fileresu, optionfilefiname,ageminpar,agemaxpar,fage, prevfcast, backcast, pathc,p); |
| } | } |
| printinghtml(fileresu,title,datafile, firstpass, lastpass, stepm, weightopt, \ | printinghtml(fileresu,title,datafile, firstpass, lastpass, stepm, weightopt, \ |
| model,imx,jmin,jmax,jmean,rfileres,popforecast,prevfcast,backcast, estepm, \ | model,imx,jmin,jmax,jmean,rfileres,popforecast,mobilav,prevfcast,mobilavproj,backcast, estepm, \ |
| jprev1,mprev1,anprev1,dateprev1,jprev2,mprev2,anprev2,dateprev2); | jprev1,mprev1,anprev1,dateprev1,jprev2,mprev2,anprev2,dateprev2); |
| /*------------ free_vector -------------*/ | /*------------ free_vector -------------*/ |
| Line 11376 Please run with mle=-1 to get a correct | Line 11351 Please run with mle=-1 to get a correct |
| mobaverage=mobaverages; | mobaverage=mobaverages; |
| if (mobilav!=0) { | if (mobilav!=0) { |
| printf("Movingaveraging observed prevalence\n"); | printf("Movingaveraging observed prevalence\n"); |
| fprintf(ficlog,"Movingaveraging observed prevalence\n"); | |
| if (movingaverage(probs, ageminpar, agemaxpar, mobaverage, mobilav)!=0){ | if (movingaverage(probs, ageminpar, agemaxpar, mobaverage, mobilav)!=0){ |
| fprintf(ficlog," Error in movingaverage mobilav=%d\n",mobilav); | fprintf(ficlog," Error in movingaverage mobilav=%d\n",mobilav); |
| printf(" Error in movingaverage mobilav=%d\n",mobilav); | printf(" Error in movingaverage mobilav=%d\n",mobilav); |
| Line 11385 Please run with mle=-1 to get a correct | Line 11361 Please run with mle=-1 to get a correct |
| /* prevalence(probs, ageminpar, agemaxpar, s, agev, nlstate, imx, Tvar, nbcode, ncodemax, mint, anint, dateprev1, dateprev2, firstpass, lastpass); */ | /* prevalence(probs, ageminpar, agemaxpar, s, agev, nlstate, imx, Tvar, nbcode, ncodemax, mint, anint, dateprev1, dateprev2, firstpass, lastpass); */ |
| else if (mobilavproj !=0) { | else if (mobilavproj !=0) { |
| printf("Movingaveraging projected observed prevalence\n"); | printf("Movingaveraging projected observed prevalence\n"); |
| fprintf(ficlog,"Movingaveraging projected observed prevalence\n"); | |
| if (movingaverage(probs, ageminpar, agemaxpar, mobaverage, mobilavproj)!=0){ | if (movingaverage(probs, ageminpar, agemaxpar, mobaverage, mobilavproj)!=0){ |
| fprintf(ficlog," Error in movingaverage mobilavproj=%d\n",mobilavproj); | fprintf(ficlog," Error in movingaverage mobilavproj=%d\n",mobilavproj); |
| printf(" Error in movingaverage mobilavproj=%d\n",mobilavproj); | printf(" Error in movingaverage mobilavproj=%d\n",mobilavproj); |