--- imach/src/imach.c 2018/05/01 17:57:25 1.287 +++ imach/src/imach.c 2018/05/02 20:58:27 1.288 @@ -1,6 +1,9 @@ -/* $Id: imach.c,v 1.287 2018/05/01 17:57:25 brouard Exp $ +/* $Id: imach.c,v 1.288 2018/05/02 20:58:27 brouard Exp $ $State: Exp $ $Log: imach.c,v $ + Revision 1.288 2018/05/02 20:58:27 brouard + Summary: Some bugs fixed + Revision 1.287 2018/05/01 17:57:25 brouard Summary: Bug fixed by providing frequencies only for non missing covariates @@ -1050,7 +1053,8 @@ typedef struct { #define MAXN 20000 #define YEARM 12. /**< Number of months per year */ /* #define AGESUP 130 */ -#define AGESUP 150 +/* #define AGESUP 150 */ +#define AGESUP 200 #define AGEINF 0 #define AGEMARGE 25 /* Marge for agemin and agemax for(iage=agemin-AGEMARGE; iage <= agemax+3+AGEMARGE; iage++) */ #define AGEBASE 40 @@ -1066,12 +1070,12 @@ typedef struct { #define ODIRSEPARATOR '\\' #endif -/* $Id: imach.c,v 1.287 2018/05/01 17:57:25 brouard Exp $ */ +/* $Id: imach.c,v 1.288 2018/05/02 20:58:27 brouard Exp $ */ /* $State: Exp $ */ #include "version.h" char version[]=__IMACH_VERSION__; char copyright[]="April 2018,INED-EUROREVES-Institut de longevite-Japan Society for the Promotion of Science (Grant-in-Aid for Scientific Research 25293121), Intel Software 2015-2018"; -char fullversion[]="$Revision: 1.287 $ $Date: 2018/05/01 17:57:25 $"; +char fullversion[]="$Revision: 1.288 $ $Date: 2018/05/02 20:58:27 $"; char strstart[80]; char optionfilext[10], optionfilefiname[FILENAMELENGTH]; int erreur=0, nberr=0, nbwarn=0; /* Error number, number of errors number of warnings */ @@ -2577,6 +2581,7 @@ void powell(double p[], double **xi, int double **newm; double agefin, delaymax=200. ; /* 100 Max number of years to converge */ int ncvloop=0; + int first=0; min=vector(1,nlstate); max=vector(1,nlstate); @@ -2673,10 +2678,14 @@ void powell(double p[], double **xi, int free_vector(meandiff,1,nlstate); return prlim; } - } /* age loop */ + } /* agefin loop */ /* After some age loop it doesn't converge */ - printf("Warning: the stable prevalence at age %d did not converge with the required precision (%g > ftolpl=%g) within %.0f years. Try to lower 'ftolpl'. \n\ -Earliest age to start was %d-%d=%d, ncvloop=%d, ncvyear=%d\n", (int)age, maxmax, ftolpl, delaymax, (int)age, (int)delaymax, (int)agefin, ncvloop, *ncvyear); + if(!first){ + first=1; + printf("Warning: the stable prevalence at age %d did not converge with the required precision (%g > ftolpl=%g) within %.d years and %d loops. Try to lower 'ftolpl'. Youngest age to start was %d=(%d-%d). Others in log file only...\n", (int)age, maxmax, ftolpl, *ncvyear, ncvloop, (int)(agefin+stepm/YEARM), (int)(age-stepm/YEARM), (int)delaymax); + } + fprintf(ficlog, "Warning: the stable prevalence at age %d did not converge with the required precision (%g > ftolpl=%g) within %.d years and %d loops. Try to lower 'ftolpl'. Youngest age to start was %d=(%d-%d).\n", (int)age, maxmax, ftolpl, *ncvyear, ncvloop, (int)(agefin+stepm/YEARM), (int)(age-stepm/YEARM), (int)delaymax); + /* Try to lower 'ftol', for example from 1.e-8 to 6.e-9.\n", ftolpl, (int)age, (int)delaymax, (int)agefin, ncvloop, (int)age-(int)agefin); */ free_vector(min,1,nlstate); free_vector(max,1,nlstate); @@ -2742,7 +2751,8 @@ Earliest age to start was %d-%d=%d, ncvl /* Even if hstepm = 1, at least one multiplication by the unit matrix */ /* Start at agefin= age, computes the matrix of passage and loops decreasing agefin until convergence is reached */ /* for(agefin=age+stepm/YEARM; agefin<=age+delaymax; agefin=agefin+stepm/YEARM){ /\* A changer en age *\/ */ - for(agefin=age; agefin ftolpl=%g) within %.0f years. Try to lower 'ftolpl'. Others in log file only...\n\ Oldest age to start was %d-%d=%d, ncvloop=%d, ncvyear=%d\n", (int)age, maxmax, ftolpl, delaymax, (int)age, (int)delaymax, (int)agefin, ncvloop, *ncvyear); @@ -5055,7 +5065,7 @@ void prevalence(double ***probs, double /*j=cptcoveff;*/ if (cptcovn<1) {j=1;ncodemax[1]=1;} - first=1; + first=0; for(j1=1; j1<= (int) pow(2,cptcoveff);j1++){ /* For each combination of covariate */ for (i=1; i<=nlstate; i++) for(iage=iagemin-AGEMARGE; iage <= iagemax+4+AGEMARGE; iage++) @@ -5113,12 +5123,11 @@ void prevalence(double ***probs, double if(posprop>=1.e-5){ probs[i][jk][j1]= prop[jk][i]/posprop; } else{ - if(first==1){ - first=0; + if(!first){ + first=1; printf("Warning Observed prevalence doesn't sum to 1 for state %d: probs[%d][%d][%d]=%lf because of lack of cases\nSee others in log file...\n",jk,i,jk, j1,probs[i][jk][j1]); - fprintf(ficlog,"Warning Observed prevalence doesn't sum to 1 for state %d: probs[%d][%d][%d]=%lf because of lack of cases\nSee others in log file...\n",jk,i,jk, j1,probs[i][jk][j1]); }else{ - fprintf(ficlog,"Warning Observed prevalence doesn't sum to 1 for state %d: probs[%d][%d][%d]=%lf because of lack of cases\nSee others in log file...\n",jk,i,jk, j1,probs[i][jk][j1]); + fprintf(ficlog,"Warning Observed prevalence doesn't sum to 1 for state %d: probs[%d][%d][%d]=%lf because of lack of cases.\n",jk,i,jk, j1,probs[i][jk][j1]); } } } @@ -5847,6 +5856,7 @@ void concatwav(int wav[], int **dh, int double **dnewm,**doldm; double **dnewmp,**doldmp; int i, j, nhstepm, hstepm, h, nstepm ; + int first=0; int k; double *xp; double **gp, **gm; /**< for var eij */ @@ -5971,7 +5981,7 @@ void concatwav(int wav[], int **dh, int } /**< Computes the prevalence limit with parameter theta shifted of delta up to ftolpl precision and * returns into prlim . - */ + */ prevalim(prlim,nlstate,xp,age,oldm,savm,ftolpl,ncvyearp,ij, nres); /* If popbased = 1 we use crossection prevalences. Previous step is useless but prlim is created */ @@ -6009,7 +6019,7 @@ void concatwav(int wav[], int **dh, int for(i=1; i<=npar; i++) /* Computes gradient x - delta */ xp[i] = x[i] - (i==theta ?delti[theta]:0); - + prevalim(prlim,nlstate,xp,age,oldm,savm,ftolpl,ncvyearp, ij, nres); if (popbased==1) { @@ -6195,7 +6205,7 @@ void concatwav(int wav[], int **dh, int int theta; pstamp(ficresvpl); - fprintf(ficresvpl,"# Standard deviation of period (stable) prevalences \n"); + fprintf(ficresvpl,"# Standard deviation of period (forward stable) prevalences \n"); fprintf(ficresvpl,"# Age "); if(nresult >=1) fprintf(ficresvpl," Result# "); @@ -6224,20 +6234,20 @@ void concatwav(int wav[], int **dh, int for(i=1; i<=npar; i++){ /* Computes gradient */ xp[i] = x[i] + (i==theta ?delti[theta]:0); } - if((int)age==79 ||(int)age== 80 ||(int)age== 81 ) - prevalim(prlim,nlstate,xp,age,oldm,savm,ftolpl,ncvyearp,ij,nres); - else - prevalim(prlim,nlstate,xp,age,oldm,savm,ftolpl,ncvyearp,ij,nres); + /* if((int)age==79 ||(int)age== 80 ||(int)age== 81 ) */ + /* prevalim(prlim,nlstate,xp,age,oldm,savm,ftolpl,ncvyearp,ij,nres); */ + /* else */ + prevalim(prlim,nlstate,xp,age,oldm,savm,ftolpl,ncvyearp,ij,nres); for(i=1;i<=nlstate;i++){ gp[i] = prlim[i][i]; mgp[theta][i] = prlim[i][i]; } for(i=1; i<=npar; i++) /* Computes gradient */ xp[i] = x[i] - (i==theta ?delti[theta]:0); - if((int)age==79 ||(int)age== 80 ||(int)age== 81 ) - prevalim(prlim,nlstate,xp,age,oldm,savm,ftolpl,ncvyearp,ij,nres); - else - prevalim(prlim,nlstate,xp,age,oldm,savm,ftolpl,ncvyearp,ij,nres); + /* if((int)age==79 ||(int)age== 80 ||(int)age== 81 ) */ + /* prevalim(prlim,nlstate,xp,age,oldm,savm,ftolpl,ncvyearp,ij,nres); */ + /* else */ + prevalim(prlim,nlstate,xp,age,oldm,savm,ftolpl,ncvyearp,ij,nres); for(i=1;i<=nlstate;i++){ gm[i] = prlim[i][i]; mgm[theta][i] = prlim[i][i]; @@ -6286,8 +6296,11 @@ void concatwav(int wav[], int **dh, int fprintf(ficresvpl,"%.0f ",age ); if(nresult >=1) fprintf(ficresvpl,"%d ",nres ); - for(i=1; i<=nlstate;i++) + for(i=1; i<=nlstate;i++){ fprintf(ficresvpl," %.5f (%.5f)",prlim[i][i],sqrt(varpl[i][(int)age])); + /* for(j=1;j<=nlstate;j++) */ + /* fprintf(ficresvpl," %d %.5f ",j,prlim[j][i]); */ + } fprintf(ficresvpl,"\n"); free_vector(gp,1,nlstate); free_vector(gm,1,nlstate); @@ -6504,7 +6517,7 @@ void varprob(char optionfilefiname[], do fprintf(fichtm,"\n
  • Computing and drawing one step probabilities with their confidence intervals

  • \n"); fprintf(fichtm,"\n"); - fprintf(fichtm,"\n
  • Matrix of variance-covariance of one-step probabilities (drawings)

    this page is important in order to visualize confidence intervals and especially correlation between disability and recovery, or more generally, way in and way back. %s
  • \n",optionfilehtmcov,optionfilehtmcov); + fprintf(fichtm,"\n
  • Matrix of variance-covariance of one-step probabilities (drawings)

    this page is important in order to visualize confidence intervals and especially correlation between disability and recovery, or more generally, way in and way back. File %s
  • \n",optionfilehtmcov,optionfilehtmcov); fprintf(fichtmcov,"Current page is file %s
    \n\n

    Matrix of variance-covariance of pairs of step probabilities

    \n",optionfilehtmcov, optionfilehtmcov); fprintf(fichtmcov,"\nEllipsoids of confidence centered on point (pij, pkl) are estimated \ and drawn. It helps understanding how is the covariance between two incidences.\ @@ -6797,10 +6810,10 @@ void printinghtml(char fileresu[], char - Estimated back transition probabilities over %d (stepm) months: %s
    \n ", stepm,subdirf2(fileresu,"PIJB_"),subdirf2(fileresu,"PIJB_")); fprintf(fichtm,"\ - - Period (stable) prevalence in each health state: %s
    \n", + - Period (forward) prevalence in each health state: %s
    \n", subdirf2(fileresu,"PL_"),subdirf2(fileresu,"PL_")); fprintf(fichtm,"\ - - Period (stable) back prevalence in each health state: %s
    \n", + - Backward prevalence in each health state: %s
    \n", subdirf2(fileresu,"PLB_"),subdirf2(fileresu,"PLB_")); fprintf(fichtm,"\ - (a) Life expectancies by health status at initial age, ei. (b) health expectancies by health status at initial age, eij . If one or more covariates are included, specific tables for each value of the covariate are output in sequences within the same file (estepm=%2d months): \ @@ -6915,22 +6928,22 @@ divided by h: hPij Or probability to survive in various states (1 to %d) being in state %d at different ages. \ %s_%d-%d-%d.svg
    ", cpt, nlstate, cpt, subdirf2(optionfilefiname,"LIJT_"),cpt,k1,nres,subdirf2(optionfilefiname,"LIJT_"),cpt,k1,nres,subdirf2(optionfilefiname,"LIJT_"),cpt,k1,nres); } - /* Period (stable) prevalence in each health state */ + /* Period (forward stable) prevalence in each health state */ for(cpt=1; cpt<=nlstate;cpt++){ fprintf(fichtm,"
    \n- Convergence to period (stable) prevalence in state %d. Or probability for a person being in state (1 to %d) at different ages, to be in state %d some years after. %s_%d-%d-%d.svg
    \ ", cpt, nlstate, cpt, subdirf2(optionfilefiname,"P_"),cpt,k1,nres,subdirf2(optionfilefiname,"P_"),cpt,k1,nres,subdirf2(optionfilefiname,"P_"),cpt,k1,nres); } if(backcast==1){ - /* Period (stable) back prevalence in each health state */ + /* Backward prevalence in each health state */ for(cpt=1; cpt<=nlstate;cpt++){ fprintf(fichtm,"
    \n- Convergence to mixed (stable) back prevalence in state %d. Or probability for a person to be in state %d at a younger age, knowing that she/he was in state (1 to %d) at different older ages. %s_%d-%d-%d.svg
    \ ", cpt, cpt, nlstate, subdirf2(optionfilefiname,"PB_"),cpt,k1,nres,subdirf2(optionfilefiname,"PB_"),cpt,k1,nres,subdirf2(optionfilefiname,"PB_"),cpt,k1,nres); } } if(prevfcast==1){ - /* Projection of prevalence up to period (stable) prevalence in each health state */ + /* Projection of prevalence up to period (forward stable) prevalence in each health state */ for(cpt=1; cpt<=nlstate;cpt++){ - fprintf(fichtm,"
    \n- Projection of cross-sectional prevalence (estimated with cases observed from %.1f to %.1f and mobil_average=%d), from year %.1f up to year %.1f tending to period (stable) prevalence in state %d. Or probability to be in state %d being in an observed weighted state (from 1 to %d). %s_%d-%d-%d.svg
    \ + fprintf(fichtm,"
    \n- Projection of cross-sectional prevalence (estimated with cases observed from %.1f to %.1f and mobil_average=%d), from year %.1f up to year %.1f tending to period (stable) forward prevalence in state %d. Or probability to be in state %d being in an observed weighted state (from 1 to %d). %s_%d-%d-%d.svg
    \ ", dateprev1, dateprev2, mobilavproj, dateproj1, dateproj2, cpt, cpt, nlstate, subdirf2(optionfilefiname,"PROJ_"),cpt,k1,nres,subdirf2(optionfilefiname,"PROJ_"),cpt,k1,nres,subdirf2(optionfilefiname,"PROJ_"),cpt,k1,nres); } } @@ -6983,13 +6996,13 @@ See page 'Matrix of variance-covariance %s
    \n", estepm,subdirf2(fileresu,"STDE_"),subdirf2(fileresu,"STDE_")); fprintf(fichtm,"\ - - Variances and covariances of health expectancies by age. Status (i) based health expectancies (in state j), eij are weighted by the period prevalences in each state i (if popbased=1, an additional computation is done using the cross-sectional prevalences, i.e population based) (estepm=%d months): %s
    \n", + - Variances and covariances of health expectancies by age. Status (i) based health expectancies (in state j), eij are weighted by the forward (period) prevalences in each state i (if popbased=1, an additional computation is done using the cross-sectional prevalences, i.e population based) (estepm=%d months): %s
    \n", estepm, subdirf2(fileresu,"V_"),subdirf2(fileresu,"V_")); fprintf(fichtm,"\ - Total life expectancy and total health expectancies to be spent in each health state e.j with their standard errors (if popbased=1, an additional computation is done using the cross-sectional prevalences, i.e population based) (estepm=%d months): %s
    \n", estepm, subdirf2(fileresu,"T_"),subdirf2(fileresu,"T_")); fprintf(fichtm,"\ - - Standard deviation of period (stable) prevalences: %s
    \n",\ + - Standard deviation of forward (period) prevalences: %s
    \n",\ subdirf2(fileresu,"VPL_"),subdirf2(fileresu,"VPL_")); /* if(popforecast==1) fprintf(fichtm,"\n */ @@ -7125,7 +7138,7 @@ void printinggnuplot(char fileresu[], ch continue; /* We are interested in selected combination by the resultline */ /* printf("\n# 1st: Period (stable) prevalence with CI: 'VPL_' files and live state =%d ", cpt); */ - fprintf(ficgp,"\n# 1st: Period (stable) prevalence with CI: 'VPL_' files and live state =%d ", cpt); + fprintf(ficgp,"\n# 1st: Forward (stable period) prevalence with CI: 'VPL_' files and live state =%d ", cpt); strcpy(gplotlabel,"("); for (k=1; k<=cptcoveff; k++){ /* For each covariate k get corresponding value lv for combination k1 */ lv= decodtabm(k1,k,cptcoveff); /* Should be the value of the covariate corresponding to k1 combination */ @@ -7163,7 +7176,7 @@ void printinggnuplot(char fileresu[], ch if (i==cpt) fprintf(ficgp," %%lf (%%lf)"); else fprintf(ficgp," %%*lf (%%*lf)"); } - fprintf(ficgp,"\" t\"Period (stable) prevalence\" w l lt 0,\"%s\" every :::%d::%d u 1:($2==%d ? $3+1.96*$4 : 1/0) \"%%lf %%lf",subdirf2(fileresu,"VPL_"),nres-1,nres-1,nres); + fprintf(ficgp,"\" t\"Forward prevalence\" w l lt 0,\"%s\" every :::%d::%d u 1:($2==%d ? $3+1.96*$4 : 1/0) \"%%lf %%lf",subdirf2(fileresu,"VPL_"),nres-1,nres-1,nres); for (i=1; i<= nlstate ; i ++) { if (i==cpt) fprintf(ficgp," %%lf (%%lf)"); else fprintf(ficgp," %%*lf (%%*lf)"); @@ -7492,7 +7505,7 @@ set ter svg size 640, 480\nunset log y\n continue; for (cpt=1; cpt<=nlstate ; cpt ++) { /* For each life state of arrival */ strcpy(gplotlabel,"("); - fprintf(ficgp,"\n#\n#\n#CV preval stable (period): 'pij' files, covariatecombination#=%d state=%d",k1, cpt); + fprintf(ficgp,"\n#\n#\n#CV preval stable (forward): 'pij' files, covariatecombination#=%d state=%d",k1, cpt); for (k=1; k<=cptcoveff; k++){ /* For each covariate and each value */ lv= decodtabm(k1,k,cptcoveff); /* Should be the covariate number corresponding to k1 combination */ /* decodtabm(1,1,4) = 1 because h=1 k= (1) 1 1 1 */ @@ -7536,14 +7549,14 @@ set ter svg size 640, 480\nunset log y\n /* 7eme */ if(backcast == 1){ - /* CV back preval stable (period) for each covariate */ + /* CV backward prevalence for each covariate */ for (k1=1; k1<= m ; k1 ++) /* For each covariate combination if any */ for(nres=1; nres <= nresult; nres++){ /* For each resultline */ if(m != 1 && TKresult[nres]!= k1) continue; for (cpt=1; cpt<=nlstate ; cpt ++) { /* For each life origin state */ strcpy(gplotlabel,"("); - fprintf(ficgp,"\n#\n#\n#CV Back preval stable (period): 'pijb' files, covariatecombination#=%d state=%d",k1, cpt); + fprintf(ficgp,"\n#\n#\n#CV Backward stable prevalence: 'pijb' files, covariatecombination#=%d state=%d",k1, cpt); for (k=1; k<=cptcoveff; k++){ /* For each covariate and each value */ lv= decodtabm(k1,k,cptcoveff); /* Should be the covariate number corresponding to k1 combination */ /* decodtabm(1,1,4) = 1 because h=1 k= (1) 1 1 1 */ @@ -7591,7 +7604,7 @@ set ter svg size 640, 480\nunset log y\n /* 8eme */ if(prevfcast==1){ - /* Projection from cross-sectional to stable (period) for each covariate */ + /* Projection from cross-sectional to forward stable (period) prevalence for each covariate */ for (k1=1; k1<= m ; k1 ++) /* For each covariate combination if any */ for(nres=1; nres <= nresult; nres++){ /* For each resultline */ @@ -7599,7 +7612,7 @@ set ter svg size 640, 480\nunset log y\n continue; for (cpt=1; cpt<=nlstate ; cpt ++) { /* For each life state */ strcpy(gplotlabel,"("); - fprintf(ficgp,"\n#\n#\n#Projection of prevalence to stable (period): 'PROJ_' files, covariatecombination#=%d state=%d",k1, cpt); + fprintf(ficgp,"\n#\n#\n#Projection of prevalence to forward stable prevalence (period): 'PROJ_' files, covariatecombination#=%d state=%d",k1, cpt); for (k=1; k<=cptcoveff; k++){ /* For each correspondig covariate value */ lv= decodtabm(k1,k,cptcoveff); /* Should be the covariate value corresponding to k1 combination and kth covariate */ /* decodtabm(1,1,4) = 1 because h=1 k= (1) 1 1 1 */ @@ -8033,6 +8046,7 @@ set ter svg size 640, 480\nunset log y\n int modcovmax =1; int mobilavrange, mob; int iage=0; + int firstA1=0, firstA2=0; double sum=0., sumr=0.; double age; @@ -8130,6 +8144,7 @@ set ter svg size 640, 480\nunset log y\n } /* age */ /* Thus we have agemingood and agemaxgood as well as goodr for raw (preobs) */ /* but they will change */ + firstA1=0;firstA2=0; for (age=fage-(mob-1)/2; age>=bage; age--){/* From oldest to youngest, filling up to the youngest */ sumnewm[cptcod]=0.; sumnewmr[cptcod]=0.; @@ -8162,11 +8177,19 @@ set ter svg size 640, 480\nunset log y\n sumr+=probs[(int)age][i][cptcod]; } if(fabs(sum - 1.) > 1.e-3) { /* bad */ - printf("Moving average A1: For this combination of covariate cptcod=%d, we can't get a smoothed prevalence which sums to one (%f) at any descending age! age=%d, could you increase bage=%d\n",cptcod,sumr, (int)age, (int)bage); + if(!firstA1){ + firstA1=1; + printf("Moving average A1: For this combination of covariate cptcod=%d, we can't get a smoothed prevalence which sums to one (%f) at any descending age! age=%d, could you increase bage=%d. Others in log file...\n",cptcod,sumr, (int)age, (int)bage); + } + fprintf(ficlog,"Moving average A1: For this combination of covariate cptcod=%d, we can't get a smoothed prevalence which sums to one (%f) at any descending age! age=%d, could you increase bage=%d\n",cptcod,sumr, (int)age, (int)bage); } /* end bad */ /* else{ /\* We found some ages summing to one, we will smooth the oldest *\/ */ if(fabs(sumr - 1.) > 1.e-3) { /* bad */ - printf("Moving average A2: For this combination of covariate cptcod=%d, the raw prevalence doesn't sums to one (%f) even with smoothed values at young ages! age=%d, could you increase bage=%d\n",cptcod,sumr, (int)age, (int)bage); + if(!firstA2){ + firstA2=1; + printf("Moving average A2: For this combination of covariate cptcod=%d, the raw prevalence doesn't sums to one (%f) even with smoothed values at young ages! age=%d, could you increase bage=%d. Others in log file...\n",cptcod,sumr, (int)age, (int)bage); + } + fprintf(ficlog,"Moving average A2: For this combination of covariate cptcod=%d, the raw prevalence doesn't sums to one (%f) even with smoothed values at young ages! age=%d, could you increase bage=%d\n",cptcod,sumr, (int)age, (int)bage); } /* end bad */ }/* age */ @@ -8541,7 +8564,7 @@ set ter svg size 640, 480\nunset log y\n /* Variance of prevalence limit: varprlim */ void varprlim(char fileresu[], int nresult, double ***prevacurrent, int mobilavproj, double bage, double fage, double **prlim, int *ncvyearp, double ftolpl, double p[], double **matcov, double *delti, int stepm, int cptcoveff){ - /*------- Variance of period (stable) prevalence------*/ + /*------- Variance of forward period (stable) prevalence------*/ char fileresvpl[FILENAMELENGTH]; FILE *ficresvpl; @@ -8552,11 +8575,11 @@ set ter svg size 640, 480\nunset log y\n strcpy(fileresvpl,"VPL_"); strcat(fileresvpl,fileresu); if((ficresvpl=fopen(fileresvpl,"w"))==NULL) { - printf("Problem with variance of period (stable) prevalence resultfile: %s\n", fileresvpl); + printf("Problem with variance of forward period (stable) prevalence resultfile: %s\n", fileresvpl); exit(0); } - printf("Computing Variance-covariance of period (stable) prevalence: file '%s' ...", fileresvpl);fflush(stdout); - fprintf(ficlog, "Computing Variance-covariance of period (stable) prevalence: file '%s' ...", fileresvpl);fflush(ficlog); + printf("Computing Variance-covariance of forward period (stable) prevalence: file '%s' ...", fileresvpl);fflush(stdout); + fprintf(ficlog, "Computing Variance-covariance of forward period (stable) prevalence: file '%s' ...", fileresvpl);fflush(ficlog); /*for(cptcov=1,k=0;cptcov<=i1;cptcov++){ for(cptcod=1;cptcod<=ncodemax[cptcov];cptcod++){*/ @@ -8593,8 +8616,8 @@ set ter svg size 640, 480\nunset log y\n } fclose(ficresvpl); - printf("done variance-covariance of period prevalence\n");fflush(stdout); - fprintf(ficlog,"done variance-covariance of period prevalence\n");fflush(ficlog); + printf("done variance-covariance of forward period prevalence\n");fflush(stdout); + fprintf(ficlog,"done variance-covariance of forward period prevalence\n");fflush(ficlog); } /* Variance of back prevalence: varbprlim */ @@ -10324,7 +10347,7 @@ void syscompilerinfo(int logged) } int prevalence_limit(double *p, double **prlim, double ageminpar, double agemaxpar, double ftolpl, int *ncvyearp){ - /*--------------- Prevalence limit (period or stable prevalence) --------------*/ + /*--------------- Prevalence limit (forward period or forward stable prevalence) --------------*/ int i, j, k, i1, k4=0, nres=0 ; /* double ftolpl = 1.e-10; */ double age, agebase, agelim; @@ -10333,13 +10356,13 @@ int prevalence_limit(double *p, double * strcpy(filerespl,"PL_"); strcat(filerespl,fileresu); if((ficrespl=fopen(filerespl,"w"))==NULL) { - printf("Problem with period (stable) prevalence resultfile: %s\n", filerespl);return 1; - fprintf(ficlog,"Problem with period (stable) prevalence resultfile: %s\n", filerespl);return 1; + printf("Problem with forward period (stable) prevalence resultfile: %s\n", filerespl);return 1; + fprintf(ficlog,"Problem with forward period (stable) prevalence resultfile: %s\n", filerespl);return 1; } - printf("\nComputing period (stable) prevalence: result on file '%s' \n", filerespl); - fprintf(ficlog,"\nComputing period (stable) prevalence: result on file '%s' \n", filerespl); + printf("\nComputing forward period (stable) prevalence: result on file '%s' \n", filerespl); + fprintf(ficlog,"\nComputing forward period (stable) prevalence: result on file '%s' \n", filerespl); pstamp(ficrespl); - fprintf(ficrespl,"# Period (stable) prevalence. Precision given by ftolpl=%g \n", ftolpl); + fprintf(ficrespl,"# Forward period (stable) prevalence. Precision given by ftolpl=%g \n", ftolpl); fprintf(ficrespl,"#Age "); for(i=1; i<=nlstate;i++) fprintf(ficrespl,"%d-%d ",i,i); fprintf(ficrespl,"\n"); @@ -10414,7 +10437,7 @@ int prevalence_limit(double *p, double * } int back_prevalence_limit(double *p, double **bprlim, double ageminpar, double agemaxpar, double ftolpl, int *ncvyearp, double dateprev1,double dateprev2, int firstpass, int lastpass, int mobilavproj){ - /*--------------- Back Prevalence limit (period or stable prevalence) --------------*/ + /*--------------- Back Prevalence limit (backward stable prevalence) --------------*/ /* Computes the back prevalence limit for any combination of covariate values * at any age between ageminpar and agemaxpar @@ -10429,13 +10452,13 @@ int back_prevalence_limit(double *p, dou strcpy(fileresplb,"PLB_"); strcat(fileresplb,fileresu); if((ficresplb=fopen(fileresplb,"w"))==NULL) { - printf("Problem with period (stable) back prevalence resultfile: %s\n", fileresplb);return 1; - fprintf(ficlog,"Problem with period (stable) back prevalence resultfile: %s\n", fileresplb);return 1; + printf("Problem with backward prevalence resultfile: %s\n", fileresplb);return 1; + fprintf(ficlog,"Problem with backward prevalence resultfile: %s\n", fileresplb);return 1; } - printf("Computing period (stable) back prevalence: result on file '%s' \n", fileresplb); - fprintf(ficlog,"Computing period (stable) back prevalence: result on file '%s' \n", fileresplb); + printf("Computing backward prevalence: result on file '%s' \n", fileresplb); + fprintf(ficlog,"Computing backward prevalence: result on file '%s' \n", fileresplb); pstamp(ficresplb); - fprintf(ficresplb,"# Period (stable) back prevalence. Precision given by ftolpl=%g \n", ftolpl); + fprintf(ficresplb,"# Backward prevalence. Precision given by ftolpl=%g \n", ftolpl); fprintf(ficresplb,"#Age "); for(i=1; i<=nlstate;i++) fprintf(ficresplb,"%d-%d ",i,i); fprintf(ficresplb,"\n"); @@ -12570,13 +12593,13 @@ Please run with mle=-1 to get a correct if(vpopbased==1) fprintf(ficrest,"the age specific prevalence observed (cross-sectionally) in the population i.e cross-sectionally\n in each health state (popbased=1) (mobilav=%d)\n",mobilav); else - fprintf(ficrest,"the age specific period (stable) prevalences in each health state \n"); + fprintf(ficrest,"the age specific forward period (stable) prevalences in each health state \n"); fprintf(ficrest,"# Age popbased mobilav e.. (std) "); for (i=1;i<=nlstate;i++) fprintf(ficrest,"e.%d (std) ",i); fprintf(ficrest,"\n"); /* printf("Which p?\n"); for(i=1;i<=npar;i++)printf("p[i=%d]=%lf,",i,p[i]);printf("\n"); */ - printf("Computing age specific period (stable) prevalences in each health state \n"); - fprintf(ficlog,"Computing age specific period (stable) prevalences in each health state \n"); + printf("Computing age specific forward period (stable) prevalences in each health state \n"); + fprintf(ficlog,"Computing age specific forward period (stable) prevalences in each health state \n"); for(age=bage; age <=fage ;age++){ prevalim(prlim, nlstate, p, age, oldm, savm, ftolpl, &ncvyear, k, nres); /*ZZ Is it the correct prevalim */ if (vpopbased==1) { @@ -12623,7 +12646,7 @@ Please run with mle=-1 to get a correct printf("done State-specific expectancies\n");fflush(stdout); fprintf(ficlog,"done State-specific expectancies\n");fflush(ficlog); - /* variance-covariance of period prevalence*/ + /* variance-covariance of forward period prevalence*/ varprlim(fileresu, nresult, mobaverage, mobilavproj, bage, fage, prlim, &ncvyear, ftolpl, p, matcov, delti, stepm, cptcoveff);