|
|
| version 1.19, 2002/02/20 17:19:10 | version 1.24, 2002/02/22 18:10:15 |
|---|---|
| Line 1 | Line 1 |
| /* $Id$ | |
| /*********************** Imach ************************************** | Interpolated Markov Chain |
| This program computes Healthy Life Expectancies from cross-longitudinal | |
| data. Cross-longitudinal consist in a first survey ("cross") where | Short summary of the programme: |
| individuals from different ages are interviewed on their health status | |
| or degree of disability. At least a second wave of interviews | This program computes Healthy Life Expectancies from |
| ("longitudinal") should measure each new individual health status. | cross-longitudinal data. Cross-longitudinal data consist in: -1- a |
| Health expectancies are computed from the transistions observed between | first survey ("cross") where individuals from different ages are |
| waves and are computed for each degree of severity of disability (number | interviewed on their health status or degree of disability (in the |
| of life states). More degrees you consider, more time is necessary to | case of a health survey which is our main interest) -2- at least a |
| reach the Maximum Likelihood of the parameters involved in the model. | second wave of interviews ("longitudinal") which measure each change |
| The simplest model is the multinomial logistic model where pij is | (if any) in individual health status. Health expectancies are |
| the probabibility to be observed in state j at the second wave conditional | computed from the time spent in each health state according to a |
| to be observed in state i at the first wave. Therefore the model is: | model. More health states you consider, more time is necessary to reach the |
| log(pij/pii)= aij + bij*age+ cij*sex + etc , where 'age' is age and 'sex' | Maximum Likelihood of the parameters involved in the model. The |
| is a covariate. If you want to have a more complex model than "constant and | simplest model is the multinomial logistic model where pij is the |
| age", you should modify the program where the markup | probabibility to be observed in state j at the second wave |
| *Covariates have to be included here again* invites you to do it. | conditional to be observed in state i at the first wave. Therefore |
| More covariates you add, less is the speed of the convergence. | the model is: log(pij/pii)= aij + bij*age+ cij*sex + etc , where |
| 'age' is age and 'sex' is a covariate. If you want to have a more | |
| The advantage that this computer programme claims, comes from that if the | complex model than "constant and age", you should modify the program |
| delay between waves is not identical for each individual, or if some | where the markup *Covariates have to be included here again* invites |
| individual missed an interview, the information is not rounded or lost, but | you to do it. More covariates you add, slower the |
| taken into account using an interpolation or extrapolation. | convergence. |
| hPijx is the probability to be | |
| observed in state i at age x+h conditional to the observed state i at age | The advantage of this computer programme, compared to a simple |
| x. The delay 'h' can be split into an exact number (nh*stepm) of | multinomial logistic model, is clear when the delay between waves is not |
| unobserved intermediate states. This elementary transition (by month or | identical for each individual. Also, if a individual missed an |
| quarter trimester, semester or year) is model as a multinomial logistic. | intermediate interview, the information is lost, but taken into |
| The hPx matrix is simply the matrix product of nh*stepm elementary matrices | account using an interpolation or extrapolation. |
| and the contribution of each individual to the likelihood is simply hPijx. | |
| hPijx is the probability to be observed in state i at age x+h | |
| conditional to the observed state i at age x. The delay 'h' can be | |
| split into an exact number (nh*stepm) of unobserved intermediate | |
| states. This elementary transition (by month or quarter trimester, | |
| semester or year) is model as a multinomial logistic. The hPx | |
| matrix is simply the matrix product of nh*stepm elementary matrices | |
| and the contribution of each individual to the likelihood is simply | |
| hPijx. | |
| Also this programme outputs the covariance matrix of the parameters but also | Also this programme outputs the covariance matrix of the parameters but also |
| of the life expectancies. It also computes the prevalence limits. | of the life expectancies. It also computes the prevalence limits. |
| Line 48 | Line 56 |
| #include <unistd.h> | #include <unistd.h> |
| #define MAXLINE 256 | #define MAXLINE 256 |
| #define GNUPLOTPROGRAM "..\\gp37mgw\\wgnuplot" | |
| #define FILENAMELENGTH 80 | #define FILENAMELENGTH 80 |
| /*#define DEBUG*/ | /*#define DEBUG*/ |
| #define windows | #define windows |
| Line 67 | Line 76 |
| #define AGEBASE 40 | #define AGEBASE 40 |
| int erreur; /* Error number */ | |
| int nvar; | int nvar; |
| int cptcovn, cptcovage=0, cptcoveff=0,cptcov; | int cptcovn, cptcovage=0, cptcoveff=0,cptcov; |
| int npar=NPARMAX; | int npar=NPARMAX; |
| Line 140 double ftol=FTOL; /* Tolerance for compu | Line 150 double ftol=FTOL; /* Tolerance for compu |
| double ftolhess; /* Tolerance for computing hessian */ | double ftolhess; /* Tolerance for computing hessian */ |
| /**************** split *************************/ | /**************** split *************************/ |
| static int split( char *path, char *dirc, char *name ) | static int split( char *path, char *dirc, char *name, char *ext, char *finame ) |
| { | { |
| char *s; /* pointer */ | char *s; /* pointer */ |
| int l1, l2; /* length counters */ | int l1, l2; /* length counters */ |
| l1 = strlen( path ); /* length of path */ | l1 = strlen( path ); /* length of path */ |
| if ( l1 == 0 ) return( GLOCK_ERROR_NOPATH ); | if ( l1 == 0 ) return( GLOCK_ERROR_NOPATH ); |
| #ifdef windows | |
| s = strrchr( path, '\\' ); /* find last / */ | s = strrchr( path, '\\' ); /* find last / */ |
| #else | |
| s = strrchr( path, '/' ); /* find last / */ | |
| #endif | |
| if ( s == NULL ) { /* no directory, so use current */ | if ( s == NULL ) { /* no directory, so use current */ |
| #if defined(__bsd__) /* get current working directory */ | #if defined(__bsd__) /* get current working directory */ |
| extern char *getwd( ); | extern char *getwd( ); |
| Line 170 static int split( char *path, char *dirc | Line 184 static int split( char *path, char *dirc |
| dirc[l1-l2] = 0; /* add zero */ | dirc[l1-l2] = 0; /* add zero */ |
| } | } |
| l1 = strlen( dirc ); /* length of directory */ | l1 = strlen( dirc ); /* length of directory */ |
| #ifdef windows | |
| if ( dirc[l1-1] != '\\' ) { dirc[l1] = '\\'; dirc[l1+1] = 0; } | if ( dirc[l1-1] != '\\' ) { dirc[l1] = '\\'; dirc[l1+1] = 0; } |
| #else | |
| if ( dirc[l1-1] != '/' ) { dirc[l1] = '/'; dirc[l1+1] = 0; } | |
| #endif | |
| s = strrchr( name, '.' ); /* find last / */ | |
| s++; | |
| strcpy(ext,s); /* save extension */ | |
| l1= strlen( name); | |
| l2= strlen( s)+1; | |
| strncpy( finame, name, l1-l2); | |
| finame[l1-l2]= 0; | |
| return( 0 ); /* we're done */ | return( 0 ); /* we're done */ |
| } | } |
| Line 718 double **pmij(double **ps, double *cov, | Line 743 double **pmij(double **ps, double *cov, |
| s2 += x[(i-1)*nlstate*ncovmodel+(j-2)*ncovmodel+nc+(i-1)*(ndeath-1)*ncovmodel]*cov[nc]; | s2 += x[(i-1)*nlstate*ncovmodel+(j-2)*ncovmodel+nc+(i-1)*(ndeath-1)*ncovmodel]*cov[nc]; |
| /*printf("Int j>i s1=%.17e, s2=%.17e %lx %lx\n",s1,s2,s1,s2);*/ | /*printf("Int j>i s1=%.17e, s2=%.17e %lx %lx\n",s1,s2,s1,s2);*/ |
| } | } |
| ps[i][j]=(s2); | ps[i][j]=s2; |
| } | } |
| } | } |
| /*ps[3][2]=1;*/ | /*ps[3][2]=1;*/ |
| Line 901 void mlikeli(FILE *ficres,double p[], in | Line 926 void mlikeli(FILE *ficres,double p[], in |
| powell(p,xi,npar,ftol,&iter,&fret,func); | powell(p,xi,npar,ftol,&iter,&fret,func); |
| printf("\n#Number of iterations = %d, -2 Log likelihood = %.12f\n",iter,func(p)); | printf("\n#Number of iterations = %d, -2 Log likelihood = %.12f\n",iter,func(p)); |
| fprintf(ficres,"#Number of iterations = %d, -2 Log likelihood = %.12f ",iter,func(p)); | fprintf(ficres,"#Number of iterations = %d, -2 Log likelihood = %.12f \n",iter,func(p)); |
| } | } |
| Line 1318 void prevalence(int agemin, int agemax, | Line 1343 void prevalence(int agemin, int 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; |
| freq[s[m][i]][s[m+1][i]][(int)(agev[m][i]+1-1/12.)] += weight[i]; | 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)(agemax+3+1)] += weight[i]; | freq[s[m][i]][s[m+1][i]][(int)(agemax+3+1)] += weight[i]; |
| } | } |
| } | } |
| Line 1858 fclose(ficresprob); | Line 1883 fclose(ficresprob); |
| /**************** Main Program *****************/ | /**************** Main Program *****************/ |
| /***********************************************/ | /***********************************************/ |
| /*int main(int argc, char *argv[])*/ | int main(int argc, char *argv[]) |
| int main() | |
| { | { |
| int i,j, k, n=MAXN,iter,m,size,cptcode, cptcod; | int i,j, k, n=MAXN,iter,m,size,cptcode, cptcod; |
| Line 1875 int main() | Line 1899 int main() |
| char line[MAXLINE], linepar[MAXLINE]; | char line[MAXLINE], linepar[MAXLINE]; |
| char title[MAXLINE]; | char title[MAXLINE]; |
| char optionfile[FILENAMELENGTH], datafile[FILENAMELENGTH], filerespl[FILENAMELENGTH], optionfilehtm[FILENAMELENGTH]; | char optionfile[FILENAMELENGTH], datafile[FILENAMELENGTH], filerespl[FILENAMELENGTH], optionfilehtm[FILENAMELENGTH]; |
| char optionfilext[10], optionfilefiname[FILENAMELENGTH], optionfilegnuplot[FILENAMELENGTH], plotcmd[FILENAMELENGTH]; | |
| char fileres[FILENAMELENGTH], filerespij[FILENAMELENGTH], filereso[FILENAMELENGTH], fileresf[FILENAMELENGTH]; | char fileres[FILENAMELENGTH], filerespij[FILENAMELENGTH], filereso[FILENAMELENGTH], fileresf[FILENAMELENGTH]; |
| char filerest[FILENAMELENGTH]; | char filerest[FILENAMELENGTH]; |
| char fileregp[FILENAMELENGTH]; | char fileregp[FILENAMELENGTH]; |
| char popfile[FILENAMELENGTH]; | char popfile[FILENAMELENGTH]; |
| Line 1908 int main() | Line 1935 int main() |
| double dateprev1, dateprev2,jproj1,mproj1,anproj1,jproj2,mproj2,anproj2,jprojmean,mprojmean,anprojmean, calagedate; | double dateprev1, dateprev2,jproj1,mproj1,anproj1,jproj2,mproj2,anproj2,jprojmean,mprojmean,anprojmean, calagedate; |
| double yp,yp1,yp2; | double yp,yp1,yp2; |
| char version[80]="Imach version 64b, May 2001, INED-EUROREVES "; | char version[80]="Imach version 0.7, February 2002, INED-EUROREVES "; |
| char *alph[]={"a","a","b","c","d","e"}, str[4]; | char *alph[]={"a","a","b","c","d","e"}, str[4]; |
| Line 1923 int main() | Line 1950 int main() |
| gettimeofday(&start_time, (struct timezone*)0); */ /* at first time */ | gettimeofday(&start_time, (struct timezone*)0); */ /* at first time */ |
| printf("\nIMACH, Version 0.7"); | printf("\n%s",version); |
| printf("\nEnter the parameter file name: "); | if(argc <=1){ |
| printf("\nEnter the parameter file name: "); | |
| #ifdef windows | scanf("%s",pathtot); |
| scanf("%s",pathtot); | } |
| getcwd(pathcd, size); | else{ |
| strcpy(pathtot,argv[1]); | |
| } | |
| /*if(getcwd(pathcd, 80)!= NULL)printf ("Error pathcd\n");*/ | |
| /*cygwin_split_path(pathtot,path,optionfile); | /*cygwin_split_path(pathtot,path,optionfile); |
| printf("pathtot=%s, path=%s, optionfile=%s\n",pathtot,path,optionfile);*/ | printf("pathtot=%s, path=%s, optionfile=%s\n",pathtot,path,optionfile);*/ |
| /* cutv(path,optionfile,pathtot,'\\');*/ | /* cutv(path,optionfile,pathtot,'\\');*/ |
| split(pathtot, path,optionfile); | split(pathtot,path,optionfile,optionfilext,optionfilefiname); |
| printf("pathtot=%s, path=%s, optionfile=%s optionfilext=%s optionfilefiname=%s\n",pathtot,path,optionfile,optionfilext,optionfilefiname); | |
| chdir(path); | chdir(path); |
| replace(pathc,path); | replace(pathc,path); |
| #endif | |
| #ifdef unix | |
| scanf("%s",optionfile); | |
| #endif | |
| /*-------- arguments in the command line --------*/ | /*-------- arguments in the command line --------*/ |
| strcpy(fileres,"r"); | strcpy(fileres,"r"); |
| strcat(fileres, optionfile); | strcat(fileres, optionfilefiname); |
| strcat(fileres,".txt"); /* Other files have txt extension */ | |
| /*---------arguments file --------*/ | /*---------arguments file --------*/ |
| Line 2323 printf("Total number of individuals= %d, | Line 2351 printf("Total number of individuals= %d, |
| } | } |
| } | } |
| } | } |
| /*for(i=1; i <=m ;i++){ | |
| for(k=1; k <=cptcovn; k++){ | |
| printf("i=%d k=%d %d %d",i,k,codtab[i][k], cptcoveff); | |
| } | |
| printf("\n"); | |
| } | |
| scanf("%d",i);*/ | |
| /* Calculates basic frequencies. Computes observed prevalence at single age | /* Calculates basic frequencies. Computes observed prevalence at single age |
| and prints on file fileres'p'. */ | and prints on file fileres'p'. */ |
| Line 2422 printf("Total number of individuals= %d, | Line 2459 printf("Total number of individuals= %d, |
| bage = agemin; | bage = agemin; |
| fage = agemax; | fage = agemax; |
| } | } |
| fprintf(ficres,"# agemin agemax for life expectancy.\n"); | fprintf(ficres,"# agemin agemax for life expectancy, bage fage (if mle==0 ie no data nor Max likelihood).\n"); |
| fprintf(ficres,"agemin=%.0f agemax=%.0f bage=%.0f fage=%.0f\n",agemin,agemax,bage,fage); | fprintf(ficres,"agemin=%.0f agemax=%.0f bage=%.0f fage=%.0f\n",agemin,agemax,bage,fage); |
| fprintf(ficparo,"agemin=%.0f agemax=%.0f bage=%.0f fage=%.0f\n",agemin,agemax,bage,fage); | fprintf(ficparo,"agemin=%.0f agemax=%.0f bage=%.0f fage=%.0f\n",agemin,agemax,bage,fage); |
| Line 2469 fprintf(ficres,"popforecast=%d popfile=% | Line 2505 fprintf(ficres,"popforecast=%d popfile=% |
| freqsummary(fileres, agemin, agemax, s, agev, nlstate, imx,Tvar,nbcode, ncodemax,mint,anint,dateprev1,dateprev2); | freqsummary(fileres, agemin, agemax, s, agev, nlstate, imx,Tvar,nbcode, ncodemax,mint,anint,dateprev1,dateprev2); |
| /*------------ gnuplot -------------*/ | |
| chdir(pathcd); | /*------------ gnuplot -------------*/ |
| if((ficgp=fopen("graph.plt","w"))==NULL) { | /*chdir(pathcd);*/ |
| printf("Problem with file graph.gp");goto end; | strcpy(optionfilegnuplot,optionfilefiname); |
| } | strcat(optionfilegnuplot,".plt"); |
| if((ficgp=fopen(optionfilegnuplot,"w"))==NULL) { | |
| printf("Problem with file %s",optionfilegnuplot);goto end; | |
| } | |
| #ifdef windows | #ifdef windows |
| fprintf(ficgp,"cd \"%s\" \n",pathc); | fprintf(ficgp,"cd \"%s\" \n",pathc); |
| #endif | #endif |
| m=pow(2,cptcoveff); | m=pow(2,cptcoveff); |
| Line 2632 ij=1; | Line 2671 ij=1; |
| } | } |
| fclose(ficgp); | fclose(ficgp); |
| /* end gnuplot */ | |
| chdir(path); | chdir(path); |
| Line 2824 fclose(fichtm); | Line 2864 fclose(fichtm); |
| fclose(ficrespij); | fclose(ficrespij); |
| if(stepm == 1) { | |
| /*---------- Forecasting ------------------*/ | /*---------- Forecasting ------------------*/ |
| calagedate=(anproj1+mproj1/12.+jproj1/365.-dateintmean)*YEARM; | calagedate=(anproj1+mproj1/12.+jproj1/365.-dateintmean)*YEARM; |
| /*printf("calage= %f", calagedate);*/ | |
| prevalence(agemin, agemax, s, agev, nlstate, imx,Tvar,nbcode, ncodemax,mint,anint,dateprev1,dateprev2, calagedate); | prevalence(agemin, agemax, s, agev, nlstate, imx,Tvar,nbcode, ncodemax,mint,anint,dateprev1,dateprev2, calagedate); |
| Line 2876 fclose(fichtm); | Line 2919 fclose(fichtm); |
| mprojmean=yp; | mprojmean=yp; |
| yp1=modf((yp2*30.5),&yp); | yp1=modf((yp2*30.5),&yp); |
| jprojmean=yp; | jprojmean=yp; |
| fprintf(ficresf,"Estimated date of observed prevalence: %.lf/%.lf/%.lf ",jprojmean,mprojmean,anprojmean); | if(jprojmean==0) jprojmean=1; |
| if(mprojmean==0) jprojmean=1; | |
| fprintf(ficresf,"# Estimated date of observed prevalence: %.lf/%.lf/%.lf ",jprojmean,mprojmean,anprojmean); | |
| if (popforecast==1) { | if (popforecast==1) { |
| if((ficpop=fopen(popfile,"r"))==NULL) { | if((ficpop=fopen(popfile,"r"))==NULL) { |
| Line 2907 fclose(fichtm); | Line 2953 fclose(fichtm); |
| fprintf(ficresf,"# StartingAge FinalAge"); | fprintf(ficresf,"# StartingAge FinalAge"); |
| for(j=1; j<=nlstate+ndeath;j++) fprintf(ficresf," P.%d",j); | for(j=1; j<=nlstate+ndeath;j++) fprintf(ficresf," P.%d",j); |
| if (popforecast==1) fprintf(ficresf," [Population]"); | if (popforecast==1) fprintf(ficresf," [Population]"); |
| for (cpt=0; cpt<=1;cpt++) { | for (cpt=0; cpt<4;cpt++) { |
| fprintf(ficresf,"\n"); | fprintf(ficresf,"\n"); |
| fprintf(ficresf,"\nForecasting at date %.lf/%.lf/%.lf ",jproj1,mproj1,anproj1+cpt); | fprintf(ficresf,"\n# Forecasting at date %.lf/%.lf/%.lf ",jproj1,mproj1,anproj1+cpt); |
| for (agedeb=(fage-(1/12.)); agedeb>=(bage-(1/12.)); agedeb--){ /* If stepm=6 months */ | |
| for (agedeb=(fage-((int)calagedate %12/12.)); agedeb>=(bage-((int)calagedate %12)/12.); agedeb--){ /* If stepm=6 months */ | |
| nhstepm=(int) rint((agelim-agedeb)*YEARM/stepm); | nhstepm=(int) rint((agelim-agedeb)*YEARM/stepm); |
| nhstepm = nhstepm/hstepm; | nhstepm = nhstepm/hstepm; |
| /*printf("agedeb=%.lf stepm=%d hstepm=%d nhstepm=%d \n",agedeb,stepm,hstepm,nhstepm);*/ | /*printf("agedeb=%.lf stepm=%d hstepm=%d nhstepm=%d \n",agedeb,stepm,hstepm,nhstepm);*/ |
| Line 2919 fclose(fichtm); | Line 2966 fclose(fichtm); |
| p3mat=ma3x(1,nlstate+ndeath,1, nlstate+ndeath, 0,nhstepm); | p3mat=ma3x(1,nlstate+ndeath,1, nlstate+ndeath, 0,nhstepm); |
| oldm=oldms;savm=savms; | oldm=oldms;savm=savms; |
| hpxij(p3mat,nhstepm,agedeb,hstepm,p,nlstate,stepm,oldm,savm, k); | hpxij(p3mat,nhstepm,agedeb,hstepm,p,nlstate,stepm,oldm,savm, k); |
| for (h=0; h<=nhstepm; h++){ | for (h=0; h<=nhstepm; h++){ |
| if (h==(int) (calagedate+12*cpt)) { | if (h==(int) (calagedate+YEARM*cpt)) { |
| fprintf(ficresf,"h=%d ", h); | fprintf(ficresf,"\n %.f ",agedeb+h*hstepm/YEARM*stepm); |
| fprintf(ficresf,"\n %f %f ",agedeb,agedeb+h*hstepm/YEARM*stepm); | } |
| } | |
| for(j=1; j<=nlstate+ndeath;j++) { | for(j=1; j<=nlstate+ndeath;j++) { |
| kk1=0.;kk2=0; | kk1=0.;kk2=0; |
| for(i=1; i<=nlstate;i++) { | for(i=1; i<=nlstate;i++) { |
| if (mobilav==1) | if (mobilav==1) |
| kk1=kk1+p3mat[i][j][h]*mobaverage[(int)agedeb][i][cptcod]; | kk1=kk1+p3mat[i][j][h]*mobaverage[(int)agedeb+1][i][cptcod]; |
| else { | else { |
| kk1=kk1+p3mat[i][j][h]*probs[(int)(agedeb+1)][i][cptcod]; | kk1=kk1+p3mat[i][j][h]*probs[(int)(agedeb+1)][i][cptcod]; |
| /* fprintf(ficresf," p3=%.3f p=%.3f ", p3mat[i][j][h],probs[(int)(agedeb)+1][i][cptcod]);*/ | /* fprintf(ficresf," p3=%.3f p=%.3f ", p3mat[i][j][h], probs[(int)(agedeb)+1][i][cptcod]);*/ |
| } | } |
| if (popforecast==1) kk2=kk1*popeffectif[(int)agedeb]; | if (popforecast==1) kk2=kk1*popeffectif[(int)agedeb]; |
| Line 2945 fclose(fichtm); | Line 2991 fclose(fichtm); |
| } | } |
| } | } |
| } | } |
| free_ma3x(p3mat,1,nlstate+ndeath,1, nlstate+ndeath, 0,nhstepm); | /* free_ma3x(p3mat,1,nlstate+ndeath,1, nlstate+ndeath, 0,nhstepm);*/ |
| } | } |
| } | } |
| } | } |
| } | } |
| if (mobilav==1) free_ma3x(mobaverage,1, AGESUP,1,NCOVMAX, 1,NCOVMAX); | /* if (mobilav==1) free_ma3x(mobaverage,1, AGESUP,1,NCOVMAX, 1,NCOVMAX); |
| if (popforecast==1) { | if (popforecast==1) { |
| free_ivector(popage,0,AGESUP); | free_ivector(popage,0,AGESUP); |
| free_vector(popeffectif,0,AGESUP); | free_vector(popeffectif,0,AGESUP); |
| free_vector(popcount,0,AGESUP); | free_vector(popcount,0,AGESUP); |
| } | } |
| free_imatrix(s,1,maxwav+1,1,n); | free_imatrix(s,1,maxwav+1,1,n); |
| free_vector(weight,1,n); | free_vector(weight,1,n);*/ |
| fclose(ficresf); | fclose(ficresf); |
| }/* End forecasting */ | |
| else{ | |
| erreur=108; | |
| printf("Error %d!! You can only forecast the prevalences if the optimization\n has been performed with stepm = 1 (month) instead of %d\n", erreur, stepm); | |
| } | |
| /*---------- Health expectancies and variances ------------*/ | /*---------- Health expectancies and variances ------------*/ |
| strcpy(filerest,"t"); | strcpy(filerest,"t"); |
| Line 3096 strcpy(fileresvpl,"vpl"); | Line 3148 strcpy(fileresvpl,"vpl"); |
| free_ma3x(param,1,nlstate,1, nlstate+ndeath-1,1,ncovmodel); | free_ma3x(param,1,nlstate,1, nlstate+ndeath-1,1,ncovmodel); |
| printf("End of Imach\n"); | if(erreur >0) |
| printf("End of Imach with error %d\n",erreur); | |
| else printf("End of Imach\n"); | |
| /* gettimeofday(&end_time, (struct timezone*)0);*/ /* after time */ | /* gettimeofday(&end_time, (struct timezone*)0);*/ /* after time */ |
| /* printf("Total time was %d Sec. %d uSec.\n", end_time.tv_sec -start_time.tv_sec, end_time.tv_usec -start_time.tv_usec);*/ | /* printf("Total time was %d Sec. %d uSec.\n", end_time.tv_sec -start_time.tv_sec, end_time.tv_usec -start_time.tv_usec);*/ |
| Line 3106 strcpy(fileresvpl,"vpl"); | Line 3160 strcpy(fileresvpl,"vpl"); |
| end: | end: |
| #ifdef windows | #ifdef windows |
| chdir(pathcd); | /* chdir(pathcd);*/ |
| #endif | #endif |
| /*system("wgnuplot graph.plt");*/ | |
| system("..\\gp37mgw\\wgnuplot graph.plt"); | /*system("../gp37mgw/wgnuplot graph.plt");*/ |
| /*system("cd ../gp37mgw");*/ | |
| /* system("..\\gp37mgw\\wgnuplot graph.plt");*/ | |
| strcpy(plotcmd,GNUPLOTPROGRAM); | |
| strcat(plotcmd," "); | |
| strcat(plotcmd,optionfilegnuplot); | |
| system(plotcmd); | |
| #ifdef windows | #ifdef windows |
| while (z[0] != 'q') { | while (z[0] != 'q') { |
| chdir(pathcd); | chdir(path); |
| printf("\nType e to edit output files, c to start again, and q for exiting: "); | printf("\nType e to edit output files, c to start again, and q for exiting: "); |
| scanf("%s",z); | scanf("%s",z); |
| if (z[0] == 'c') system("./imach"); | if (z[0] == 'c') system("./imach"); |