version 1.126, 2006/04/28 17:23:28
|
version 1.127, 2006/04/28 18:11:50
|
Line 1
|
Line 1
|
/* $Id$ |
/* $Id$ |
$State$ |
$State$ |
$Log$ |
$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 |
Revision 1.126 2006/04/28 17:23:28 brouard |
(Module): Yes the sum of survivors was wrong since |
(Module): Yes the sum of survivors was wrong since |
imach-114 because nhstepm was no more computed in the age |
imach-114 because nhstepm was no more computed in the age |
Line 2467 void tricode(int *Tvar, int **nbcode, in
|
Line 2479 void tricode(int *Tvar, int **nbcode, in
|
|
|
/*********** Health Expectancies ****************/ |
/*********** Health Expectancies ****************/ |
|
|
void evsij(char fileres[], double ***eij, double x[], int nlstate, int stepm, int bage, int fage, double **oldm, double **savm, int cij, int estepm,char strstart[] ) |
void evsij(double ***eij, double x[], int nlstate, int stepm, int bage, int fage, double **oldm, double **savm, int cij, int estepm,char strstart[] ) |
|
|
{ |
{ |
/* Health expectancies, no variances */ |
/* Health expectancies, no variances */ |
Line 2575 void evsij(char fileres[], double ***eij
|
Line 2587 void evsij(char fileres[], double ***eij
|
|
|
} |
} |
|
|
void cvevsij(char fileres[], double ***eij, double x[], int nlstate, int stepm, int bage, int fage, double **oldm, double **savm, int cij, int estepm,double delti[],double **matcov,char strstart[] ) |
void cvevsij(double ***eij, double x[], int nlstate, int stepm, int bage, int fage, double **oldm, double **savm, int cij, int estepm,double delti[],double **matcov,char strstart[] ) |
|
|
{ |
{ |
/* Covariances of health expectancies eij and of total life expectancies according |
/* Covariances of health expectancies eij and of total life expectancies according |
Line 5739 Interval (in months) between two waves:
|
Line 5751 Interval (in months) between two waves:
|
} |
} |
|
|
|
|
/*---------- Health expectancies and variances ------------*/ |
/* Computes prevalence between agemin (i.e minimal age computed) and no more ageminpar */ |
|
|
strcpy(filerest,"t"); |
prevalence(probs, agemin, agemax, s, agev, nlstate, imx, Tvar, nbcode, ncodemax, mint, anint, dateprev1, dateprev2, firstpass, lastpass); |
strcat(filerest,fileres); |
/* printf("ageminpar=%f, agemax=%f, s[lastpass][imx]=%d, agev[lastpass][imx]=%f, nlstate=%d, imx=%d, mint[lastpass][imx]=%f, anint[lastpass][imx]=%f,dateprev1=%f, dateprev2=%f, firstpass=%d, lastpass=%d\n",\ |
if((ficrest=fopen(filerest,"w"))==NULL) { |
ageminpar, agemax, s[lastpass][imx], agev[lastpass][imx], nlstate, imx, mint[lastpass][imx],anint[lastpass][imx], dateprev1, dateprev2, firstpass, lastpass); |
printf("Problem with total LE resultfile: %s\n", filerest);goto end; |
*/ |
fprintf(ficlog,"Problem with total LE resultfile: %s\n", filerest);goto end; |
|
|
if (mobilav!=0) { |
|
mobaverage= ma3x(1, AGESUP,1,NCOVMAX, 1,NCOVMAX); |
|
if (movingaverage(probs, bage, fage, mobaverage,mobilav)!=0){ |
|
fprintf(ficlog," Error in movingaverage mobilav=%d\n",mobilav); |
|
printf(" Error in movingaverage mobilav=%d\n",mobilav); |
|
} |
} |
} |
printf("Computing Total Life expectancies with their standard errors: file '%s' \n", filerest); |
|
fprintf(ficlog,"Computing Total Life expectancies with their standard errors: file '%s' \n", filerest); |
|
|
|
|
|
|
/*---------- Health expectancies, no variances ------------*/ |
|
|
strcpy(filerese,"e"); |
strcpy(filerese,"e"); |
strcat(filerese,fileres); |
strcat(filerese,fileres); |
if((ficreseij=fopen(filerese,"w"))==NULL) { |
if((ficreseij=fopen(filerese,"w"))==NULL) { |
Line 5759 Interval (in months) between two waves:
|
Line 5777 Interval (in months) between two waves:
|
} |
} |
printf("Computing Health Expectancies: result on file '%s' \n", filerese); |
printf("Computing Health Expectancies: result on file '%s' \n", filerese); |
fprintf(ficlog,"Computing Health Expectancies: result on file '%s' \n", filerese); |
fprintf(ficlog,"Computing Health Expectancies: result on file '%s' \n", filerese); |
|
for(cptcov=1,k=0;cptcov<=i1;cptcov++){ |
|
for(cptcod=1;cptcod<=ncodemax[cptcov];cptcod++){ |
|
k=k+1; |
|
fprintf(ficreseij,"\n#****** "); |
|
for(j=1;j<=cptcoveff;j++) { |
|
fprintf(ficreseij,"V%d=%d ",Tvaraff[j],nbcode[Tvaraff[j]][codtab[k][j]]); |
|
} |
|
fprintf(ficreseij,"******\n"); |
|
|
|
eij=ma3x(1,nlstate,1,nlstate,(int) bage, (int) fage); |
|
oldm=oldms;savm=savms; |
|
evsij(eij, p, nlstate, stepm, (int) bage, (int)fage, oldm, savm, k, estepm, strstart); |
|
|
|
free_ma3x(eij,1,nlstate,1,nlstate,(int) bage, (int)fage); |
|
} |
|
} |
|
fclose(ficreseij); |
|
|
|
|
|
/*---------- Health expectancies and variances ------------*/ |
|
|
|
|
|
strcpy(filerest,"t"); |
|
strcat(filerest,fileres); |
|
if((ficrest=fopen(filerest,"w"))==NULL) { |
|
printf("Problem with total LE resultfile: %s\n", filerest);goto end; |
|
fprintf(ficlog,"Problem with total LE resultfile: %s\n", filerest);goto end; |
|
} |
|
printf("Computing Total Life expectancies with their standard errors: file '%s' \n", filerest); |
|
fprintf(ficlog,"Computing Total Life expectancies with their standard errors: file '%s' \n", filerest); |
|
|
|
|
strcpy(fileresstde,"stde"); |
strcpy(fileresstde,"stde"); |
strcat(fileresstde,fileres); |
strcat(fileresstde,fileres); |
Line 5787 Interval (in months) between two waves:
|
Line 5836 Interval (in months) between two waves:
|
printf("Computing Variance-covariance of DFLEs: file '%s' \n", fileresv); |
printf("Computing Variance-covariance of DFLEs: file '%s' \n", fileresv); |
fprintf(ficlog,"Computing Variance-covariance of DFLEs: file '%s' \n", fileresv); |
fprintf(ficlog,"Computing Variance-covariance of DFLEs: file '%s' \n", fileresv); |
|
|
/* Computes prevalence between agemin (i.e minimal age computed) and no more ageminpar */ |
|
prevalence(probs, agemin, agemax, s, agev, nlstate, imx, Tvar, nbcode, ncodemax, mint, anint, dateprev1, dateprev2, firstpass, lastpass); |
|
/* printf("ageminpar=%f, agemax=%f, s[lastpass][imx]=%d, agev[lastpass][imx]=%f, nlstate=%d, imx=%d, mint[lastpass][imx]=%f, anint[lastpass][imx]=%f,dateprev1=%f, dateprev2=%f, firstpass=%d, lastpass=%d\n",\ |
|
ageminpar, agemax, s[lastpass][imx], agev[lastpass][imx], nlstate, imx, mint[lastpass][imx],anint[lastpass][imx], dateprev1, dateprev2, firstpass, lastpass); |
|
*/ |
|
|
|
if (mobilav!=0) { |
|
mobaverage= ma3x(1, AGESUP,1,NCOVMAX, 1,NCOVMAX); |
|
if (movingaverage(probs, bage, fage, mobaverage,mobilav)!=0){ |
|
fprintf(ficlog," Error in movingaverage mobilav=%d\n",mobilav); |
|
printf(" Error in movingaverage mobilav=%d\n",mobilav); |
|
} |
|
} |
|
|
|
for(cptcov=1,k=0;cptcov<=i1;cptcov++){ |
for(cptcov=1,k=0;cptcov<=i1;cptcov++){ |
for(cptcod=1;cptcod<=ncodemax[cptcov];cptcod++){ |
for(cptcod=1;cptcod<=ncodemax[cptcov];cptcod++){ |
k=k+1; |
k=k+1; |
Line 5809 Interval (in months) between two waves:
|
Line 5844 Interval (in months) between two waves:
|
fprintf(ficrest,"V%d=%d ",Tvaraff[j],nbcode[Tvaraff[j]][codtab[k][j]]); |
fprintf(ficrest,"V%d=%d ",Tvaraff[j],nbcode[Tvaraff[j]][codtab[k][j]]); |
fprintf(ficrest,"******\n"); |
fprintf(ficrest,"******\n"); |
|
|
fprintf(ficreseij,"\n#****** "); |
|
fprintf(ficresstdeij,"\n#****** "); |
fprintf(ficresstdeij,"\n#****** "); |
fprintf(ficrescveij,"\n#****** "); |
fprintf(ficrescveij,"\n#****** "); |
for(j=1;j<=cptcoveff;j++) { |
for(j=1;j<=cptcoveff;j++) { |
fprintf(ficreseij,"V%d=%d ",Tvaraff[j],nbcode[Tvaraff[j]][codtab[k][j]]); |
|
fprintf(ficresstdeij,"V%d=%d ",Tvaraff[j],nbcode[Tvaraff[j]][codtab[k][j]]); |
fprintf(ficresstdeij,"V%d=%d ",Tvaraff[j],nbcode[Tvaraff[j]][codtab[k][j]]); |
fprintf(ficrescveij,"V%d=%d ",Tvaraff[j],nbcode[Tvaraff[j]][codtab[k][j]]); |
fprintf(ficrescveij,"V%d=%d ",Tvaraff[j],nbcode[Tvaraff[j]][codtab[k][j]]); |
} |
} |
fprintf(ficreseij,"******\n"); |
|
fprintf(ficresstdeij,"******\n"); |
fprintf(ficresstdeij,"******\n"); |
fprintf(ficrescveij,"******\n"); |
fprintf(ficrescveij,"******\n"); |
|
|
Line 5828 Interval (in months) between two waves:
|
Line 5860 Interval (in months) between two waves:
|
|
|
eij=ma3x(1,nlstate,1,nlstate,(int) bage, (int) fage); |
eij=ma3x(1,nlstate,1,nlstate,(int) bage, (int) fage); |
oldm=oldms;savm=savms; |
oldm=oldms;savm=savms; |
evsij(fileres, eij, p, nlstate, stepm, (int) bage, (int)fage, oldm, savm, k, estepm, strstart); |
cvevsij(eij, p, nlstate, stepm, (int) bage, (int)fage, oldm, savm, k, estepm, delti, matcov, strstart); |
cvevsij(fileres, eij, p, nlstate, stepm, (int) bage, (int)fage, oldm, savm, k, estepm, delti, matcov, strstart); |
|
|
|
vareij=ma3x(1,nlstate,1,nlstate,(int) bage, (int) fage); |
vareij=ma3x(1,nlstate,1,nlstate,(int) bage, (int) fage); |
oldm=oldms;savm=savms; |
oldm=oldms;savm=savms; |
Line 5886 Interval (in months) between two waves:
|
Line 5917 Interval (in months) between two waves:
|
free_matrix(mint,1,maxwav,1,n); |
free_matrix(mint,1,maxwav,1,n); |
free_ivector(cod,1,n); |
free_ivector(cod,1,n); |
free_ivector(tab,1,NCOVMAX); |
free_ivector(tab,1,NCOVMAX); |
fclose(ficreseij); |
|
fclose(ficresstdeij); |
fclose(ficresstdeij); |
fclose(ficrescveij); |
fclose(ficrescveij); |
fclose(ficresvij); |
fclose(ficresvij); |