From 30f7dfe3a7feacca4773ed2bb3179ea7c554f8de Mon Sep 17 00:00:00 2001 From: "N. Brouard" Date: Fri, 30 Jun 2006 13:02:05 +0000 Subject: [PATCH] (Module): Clarifications on computing e.j --- src/imach.c | 113 ++++++++++++++++++++++++++++++---------------------- 1 file changed, 66 insertions(+), 47 deletions(-) diff --git a/src/imach.c b/src/imach.c index f6cb878..9e7cfe1 100644 --- a/src/imach.c +++ b/src/imach.c @@ -1,6 +1,18 @@ /* $Id$ $State$ $Log$ + Revision 1.127 2006/04/28 18:11:50 brouard + (Module): Yes the sum of survivors was wrong since + imach-114 because nhstepm was no more computed in the age + loop. Now we define nhstepma in the age loop. + (Module): In order to speed up (in case of numerous covariates) we + compute health expectancies (without variances) in a first step + and then all the health expectancies with variances or standard + deviation (needs data from the Hessian matrices) which slows the + computation. + In the future we should be able to stop the program is only health + expectancies and graph are needed without standard deviations. + Revision 1.126 2006/04/28 17:23:28 brouard (Module): Yes the sum of survivors was wrong since imach-114 because nhstepm was no more computed in the age @@ -374,7 +386,7 @@ extern int errno; /* $Id$ */ /* $State$ */ -char version[]="Imach version 0.98h, April 2006, INED-EUROREVES-Institut de longevite "; +char version[]="Imach version 0.98i, June 2006, INED-EUROREVES-Institut de longevite "; char fullversion[]="$Revision$ $Date$"; char strstart[80]; char optionfilext[10], optionfilefiname[FILENAMELENGTH]; @@ -1332,10 +1344,11 @@ double ***hpxij(double ***po, int nhstepm, double age, int hstepm, double *x, in for(i=1; i<=nlstate+ndeath; i++) for(j=1;j<=nlstate+ndeath;j++) { po[i][j][h]=newm[i][j]; - /*printf("i=%d j=%d h=%d po[i][j][h]=%f ",i,j,h,po[i][j][h]); - */ + /*if(h==nhstepm) printf("po[%d][%d][%d]=%f ",i,j,h,po[i][j][h]);*/ } + /*printf("h=%d ",h);*/ } /* end h */ +/* printf("\n H=%d \n",h); */ return po; } @@ -2252,7 +2265,8 @@ void prevalence(double ***probs, double agemin, double agemax, int **s, double * if( i <= iagemax){ if(posprop>=1.e-5){ probs[i][jk][j1]= prop[jk][i]/posprop; - } + } else + printf("Warning Observed prevalence probs[%d][%d][%d]=%lf because of lack of cases\n",jk,i,j1,probs[i][jk][j1]); } }/* end jk */ }/* end i */ @@ -2856,7 +2870,7 @@ void varevsij(char optionfilefiname[], double ***vareij, double **matcov, double pstamp(ficresvij); fprintf(ficresvij,"# Variance and covariance of health expectancies e.j \n# (weighted average of eij where weights are "); if(popbased==1) - fprintf(ficresvij,"the age specific prevalence observed in the population i.e cross-sectionally\n in each health state (popbased=1)"); + fprintf(ficresvij,"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(ficresvij,"the age specific period (stable) prevalences in each health state \n"); fprintf(ficresvij,"# Age"); @@ -2884,8 +2898,7 @@ void varevsij(char optionfilefiname[], double ***vareij, double **matcov, double /* hstepm beeing the number of stepms, if hstepm=1 the length of hstepm is stepm. nhstepm is the number of hstepm from age to agelim nstepm is the number of stepm from age to agelin. - Look at hpijx to understand the reason of that which relies in memory size - and note for a fixed period like k years */ + Look at function hpijx to understand why (it is linked to memory size questions) */ /* We decided (b) to get a life expectancy respecting the most precise curvature of the survival function given by stepm (the optimization length). Unfortunately it means that if the survival funtion is printed every two years of age and if @@ -2951,7 +2964,7 @@ void varevsij(char optionfilefiname[], double ***vareij, double **matcov, double } } - for(j=1; j<= nlstate; j++){ + for(j=1; j<= nlstate; j++){ /* Sum of wi * eij = e.j */ for(h=0; h<=nhstepm; h++){ for(i=1, gm[h][j]=0.;i<=nlstate;i++) gm[h][j] += prlim[i][i]*p3mat[i][j][h]; @@ -3511,7 +3524,7 @@ void printinghtml(char fileres[], char title[], char datafile[], int firstpass, - Period (stable) prevalence in each health state: %s
\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 . 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) 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): \ %s
\n", estepm,subdirf2(fileres,"e"),subdirf2(fileres,"e")); fprintf(fichtm,"\ @@ -3576,11 +3589,11 @@ fprintf(fichtm," \n