version 1.35, 2002/03/26 17:08:39
|
version 1.39, 2002/04/05 15:45:00
|
Line 14
|
Line 14
|
model. More health states you consider, more time is necessary to reach the
|
model. More health states you consider, more time is necessary to reach the
|
Maximum Likelihood of the parameters involved in the model. The
|
Maximum Likelihood of the parameters involved in the model. The
|
simplest model is the multinomial logistic model where pij is the
|
simplest model is the multinomial logistic model where pij is the
|
probabibility to be observed in state j at the second wave
|
probability to be observed in state j at the second wave
|
conditional to be observed in state i at the first wave. Therefore
|
conditional to be observed in state i at the first wave. Therefore
|
the model is: log(pij/pii)= aij + bij*age+ cij*sex + etc , where
|
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
|
'age' is age and 'sex' is a covariate. If you want to have a more
|
Line 136 int imx;
|
Line 136 int imx;
|
int stepm;
|
int stepm;
|
/* Stepm, step in month: minimum step interpolation*/
|
/* Stepm, step in month: minimum step interpolation*/
|
|
|
|
int estepm;
|
|
/* Estepm, step in month to interpolate survival function in order to approximate Life Expectancy*/
|
|
|
int m,nb;
|
int m,nb;
|
int *num, firstpass=0, lastpass=4,*cod, *ncodemax, *Tage;
|
int *num, firstpass=0, lastpass=4,*cod, *ncodemax, *Tage;
|
double **agev,*moisnais, *annais, *moisdc, *andc,**mint, **anint;
|
double **agev,*moisnais, *annais, *moisdc, *andc,**mint, **anint;
|
Line 1500 void tricode(int *Tvar, int **nbcode, in
|
Line 1503 void tricode(int *Tvar, int **nbcode, in
|
for (k=0; k<=19; k++) {
|
for (k=0; k<=19; k++) {
|
if (Ndum[k] != 0) {
|
if (Ndum[k] != 0) {
|
nbcode[Tvar[j]][ij]=k;
|
nbcode[Tvar[j]][ij]=k;
|
/* printf("nbcodeaaaaaaaaaaa=%d Tvar[j]=%d ij=%d j=%d",nbcode[Tvar[j]][ij],Tvar[j],ij,j);*/
|
|
ij++;
|
ij++;
|
}
|
}
|
if (ij > ncodemax[j]) break;
|
if (ij > ncodemax[j]) break;
|
Line 1528 void tricode(int *Tvar, int **nbcode, in
|
Line 1531 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 ij)
|
void evsij(char fileres[], double ***eij, double x[], int nlstate, int stepm, int bage, int fage, double **oldm, double **savm, int ij, int estepm)
|
{
|
{
|
/* Health expectancies */
|
/* Health expectancies */
|
int i, j, nhstepm, hstepm, h, nstepm, k;
|
int i, j, nhstepm, hstepm, h, nstepm;
|
double age, agelim, hf;
|
double age, agelim, hf;
|
double ***p3mat;
|
double ***p3mat;
|
|
|
Line 1542 void evsij(char fileres[], double ***eij
|
Line 1545 void evsij(char fileres[], double ***eij
|
fprintf(ficreseij," %1d-%1d",i,j);
|
fprintf(ficreseij," %1d-%1d",i,j);
|
fprintf(ficreseij,"\n");
|
fprintf(ficreseij,"\n");
|
|
|
k=1; /* For example stepm=6 months */
|
if(estepm < stepm){
|
hstepm=k*YEARM; /* (a) Every k years of age (in months), for example every k=2 years 24 m */
|
printf ("Problem %d lower than %d\n",estepm, stepm);
|
hstepm=stepm; /* or (b) We decided to compute the life expectancy with the smallest unit */
|
}
|
|
else hstepm=estepm;
|
|
/* We compute the life expectancy from trapezoids spaced every estepm months
|
|
* This is mainly to measure the difference between two models: for example
|
|
* if stepm=24 months pijx are given only every 2 years and by summing them
|
|
* we are calculating an estimate of the Life Expectancy assuming a linear
|
|
* progression inbetween and thus overestimating or underestimating according
|
|
* to the curvature of the survival function. If, for the same date, we
|
|
* estimate the model with stepm=1 month, we can keep estepm to 24 months
|
|
* to compare the new estimate of Life expectancy with the same linear
|
|
* hypothesis. A more precise result, taking into account a more precise
|
|
* curvature will be obtained if estepm is as small as stepm. */
|
|
|
|
/* For example we decided to compute the life expectancy with the smallest unit */
|
/* hstepm beeing the number of stepms, if hstepm=1 the length of hstepm is stepm.
|
/* 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
|
nhstepm is the number of hstepm from age to agelim
|
nstepm is the number of stepm from age to agelin.
|
nstepm is the number of stepm from age to agelin.
|
Look at hpijx to understand the reason of that which relies in memory size
|
Look at hpijx to understand the reason of that which relies in memory size
|
and note for a fixed period like k years */
|
and note for a fixed period like estepm months */
|
/* We decided (b) to get a life expectancy respecting the most precise curvature of the
|
/* 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
|
survival function given by stepm (the optimization length). Unfortunately it
|
means that if the survival funtion is printed only each two years of age and if
|
means that if the survival funtion is printed only each two years of age and if
|
you sum them up and add 1 year (area under the trapezoids) you won't get the same
|
you sum them up and add 1 year (area under the trapezoids) you won't get the same
|
results. So we changed our mind and took the option of the best precision.
|
results. So we changed our mind and took the option of the best precision.
|
*/
|
*/
|
hstepm=hstepm/stepm; /* Typically in stepm units, if k= 2 years, = 2/6 months = 4 */
|
hstepm=hstepm/stepm; /* Typically in stepm units, if stepm=6 & estepm=24 , = 24/6 months = 4 */
|
|
|
agelim=AGESUP;
|
agelim=AGESUP;
|
for (age=bage; age<=fage; age ++){ /* If stepm=6 months */
|
for (age=bage; age<=fage; age ++){ /* If stepm=6 months */
|
Line 1569 void evsij(char fileres[], double ***eij
|
Line 1585 void evsij(char fileres[], double ***eij
|
/* Computed by stepm unit matrices, product of hstepm matrices, stored
|
/* Computed by stepm unit matrices, product of hstepm matrices, stored
|
in an array of nhstepm length: nhstepm=10, hstepm=4, stepm=6 months */
|
in an array of nhstepm length: nhstepm=10, hstepm=4, stepm=6 months */
|
hpxij(p3mat,nhstepm,age,hstepm,x,nlstate,stepm,oldm, savm, ij);
|
hpxij(p3mat,nhstepm,age,hstepm,x,nlstate,stepm,oldm, savm, ij);
|
|
|
|
/*for (h=0, eij[i][j][(int)age]=0; h<=nhstepm-1; h++) printf("%f %.5f\n", age*12+h, p3mat[1][1][h]);*/
|
|
|
hf=hstepm*stepm/YEARM; /* Duration of hstepm expressed in year unit. */
|
hf=hstepm*stepm/YEARM; /* Duration of hstepm expressed in year unit. */
|
for(i=1; i<=nlstate;i++)
|
for(i=1; i<=nlstate;i++)
|
for(j=1; j<=nlstate;j++)
|
for(j=1; j<=nlstate;j++)
|
Line 1587 void evsij(char fileres[], double ***eij
|
Line 1606 void evsij(char fileres[], double ***eij
|
}
|
}
|
|
|
/************ Variance ******************/
|
/************ Variance ******************/
|
void varevsij(char fileres[], double ***vareij, double **matcov, double x[], double delti[], int nlstate, int stepm, double bage, double fage, double **oldm, double **savm, double **prlim, double ftolpl, int ij)
|
void varevsij(char fileres[], double ***vareij, double **matcov, double x[], double delti[], int nlstate, int stepm, double bage, double fage, double **oldm, double **savm, double **prlim, double ftolpl, int ij, int estepm)
|
{
|
{
|
/* Variance of health expectancies */
|
/* Variance of health expectancies */
|
/* double **prevalim(double **prlim, int nlstate, double *xp, double age, double **oldm, double ** savm,double ftolpl);*/
|
/* double **prevalim(double **prlim, int nlstate, double *xp, double age, double **oldm, double ** savm,double ftolpl);*/
|
double **newm;
|
double **newm;
|
double **dnewm,**doldm;
|
double **dnewm,**doldm;
|
int i, j, nhstepm, hstepm, h, nstepm, kk;
|
int i, j, nhstepm, hstepm, h, nstepm ;
|
int k, cptcode;
|
int k, cptcode;
|
double *xp;
|
double *xp;
|
double **gp, **gm;
|
double **gp, **gm;
|
Line 1613 void varevsij(char fileres[], double ***
|
Line 1632 void varevsij(char fileres[], double ***
|
dnewm=matrix(1,nlstate,1,npar);
|
dnewm=matrix(1,nlstate,1,npar);
|
doldm=matrix(1,nlstate,1,nlstate);
|
doldm=matrix(1,nlstate,1,nlstate);
|
|
|
kk=1; /* For example stepm=6 months */
|
if(estepm < stepm){
|
hstepm=kk*YEARM; /* (a) Every k years of age (in months), for example every k=2 years 24 m */
|
printf ("Problem %d lower than %d\n",estepm, stepm);
|
hstepm=stepm; /* or (b) We decided to compute the life expectancy with the smallest unit */
|
}
|
|
else hstepm=estepm;
|
|
/* For example we decided to compute the life expectancy with the smallest unit */
|
/* hstepm beeing the number of stepms, if hstepm=1 the length of hstepm is stepm.
|
/* 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
|
nhstepm is the number of hstepm from age to agelim
|
nstepm is the number of stepm from age to agelin.
|
nstepm is the number of stepm from age to agelin.
|
Line 1627 void varevsij(char fileres[], double ***
|
Line 1648 void varevsij(char fileres[], double ***
|
you sum them up and add 1 year (area under the trapezoids) you won't get the same
|
you sum them up and add 1 year (area under the trapezoids) you won't get the same
|
results. So we changed our mind and took the option of the best precision.
|
results. So we changed our mind and took the option of the best precision.
|
*/
|
*/
|
hstepm=hstepm/stepm; /* Typically in stepm units, if k= 2 years, = 2/6 months = 4 */
|
hstepm=hstepm/stepm; /* Typically in stepm units, if stepm=6 & estepm=24 , = 24/6 months = 4 */
|
agelim = AGESUP;
|
agelim = AGESUP;
|
for (age=bage; age<=fage; age ++){ /* If stepm=6 months */
|
for (age=bage; age<=fage; age ++){ /* If stepm=6 months */
|
nstepm=(int) rint((agelim-age)*YEARM/stepm); /* Typically 20 years = 20*12/6=40 */
|
nstepm=(int) rint((agelim-age)*YEARM/stepm); /* Typically 20 years = 20*12/6=40 */
|
Line 1804 void varprevlim(char fileres[], double *
|
Line 1825 void varprevlim(char fileres[], double *
|
}
|
}
|
|
|
/************ Variance of one-step probabilities ******************/
|
/************ Variance of one-step probabilities ******************/
|
void varprob(char fileres[], double **matcov, double x[], double delti[], int nlstate, double bage, double fage, int ij)
|
void varprob(char fileres[], double **matcov, double x[], double delti[], int nlstate, double bage, double fage, int ij, int *Tvar, int **nbcode, int *ncodemax)
|
{
|
{
|
int i, j;
|
int i, j, i1, k1, j1, z1;
|
int k=0, cptcode;
|
int k=0, cptcode;
|
double **dnewm,**doldm;
|
double **dnewm,**doldm;
|
double *xp;
|
double *xp;
|
Line 1829 void varprob(char fileres[], double **ma
|
Line 1850 void varprob(char fileres[], double **ma
|
doldm=matrix(1,(nlstate+ndeath)*(nlstate+ndeath),1,(nlstate+ndeath)*(nlstate+ndeath));
|
doldm=matrix(1,(nlstate+ndeath)*(nlstate+ndeath),1,(nlstate+ndeath)*(nlstate+ndeath));
|
|
|
cov[1]=1;
|
cov[1]=1;
|
for (age=bage; age<=fage; age ++){
|
j=cptcoveff;
|
cov[2]=age;
|
if (cptcovn<1) {j=1;ncodemax[1]=1;}
|
gradg=matrix(1,npar,1,9);
|
j1=0;
|
trgradg=matrix(1,9,1,npar);
|
for(k1=1; k1<=1;k1++){
|
gp=vector(1,(nlstate+ndeath)*(nlstate+ndeath));
|
for(i1=1; i1<=ncodemax[k1];i1++){
|
gm=vector(1,(nlstate+ndeath)*(nlstate+ndeath));
|
j1++;
|
|
|
|
if (cptcovn>0) {
|
|
fprintf(ficresprob, "\n#********** Variable ");
|
|
for (z1=1; z1<=cptcoveff; z1++) fprintf(ficresprob, "V%d=%d ",Tvaraff[z1],nbcode[Tvaraff[z1]][codtab[j1][z1]]);
|
|
fprintf(ficresprob, "**********\n#");
|
|
}
|
|
|
for(theta=1; theta <=npar; theta++){
|
for (age=bage; age<=fage; age ++){
|
for(i=1; i<=npar; i++)
|
cov[2]=age;
|
xp[i] = x[i] + (i==theta ?delti[theta]:0);
|
for (k=1; k<=cptcovn;k++) {
|
|
cov[2+k]=nbcode[Tvar[k]][codtab[j1][Tvar[k]]];
|
pmij(pmmij,cov,ncovmodel,xp,nlstate);
|
|
|
|
k=0;
|
|
for(i=1; i<= (nlstate+ndeath); i++){
|
|
for(j=1; j<=(nlstate+ndeath);j++){
|
|
k=k+1;
|
|
gp[k]=pmmij[i][j];
|
|
}
|
}
|
}
|
for (k=1; k<=cptcovage;k++) cov[2+Tage[k]]=cov[2+Tage[k]]*cov[2];
|
|
for (k=1; k<=cptcovprod;k++)
|
for(i=1; i<=npar; i++)
|
cov[2+Tprod[k]]=nbcode[Tvard[k][1]][codtab[ij][Tvard[k][1]]]*nbcode[Tvard[k][2]][codtab[ij][Tvard[k][2]]];
|
xp[i] = x[i] - (i==theta ?delti[theta]:0);
|
|
|
gradg=matrix(1,npar,1,9);
|
|
trgradg=matrix(1,9,1,npar);
|
|
gp=vector(1,(nlstate+ndeath)*(nlstate+ndeath));
|
|
gm=vector(1,(nlstate+ndeath)*(nlstate+ndeath));
|
|
|
|
for(theta=1; theta <=npar; theta++){
|
pmij(pmmij,cov,ncovmodel,xp,nlstate);
|
for(i=1; i<=npar; i++)
|
k=0;
|
xp[i] = x[i] + (i==theta ?delti[theta]:0);
|
for(i=1; i<=(nlstate+ndeath); i++){
|
|
for(j=1; j<=(nlstate+ndeath);j++){
|
pmij(pmmij,cov,ncovmodel,xp,nlstate);
|
k=k+1;
|
|
gm[k]=pmmij[i][j];
|
k=0;
|
}
|
for(i=1; i<= (nlstate+ndeath); i++){
|
}
|
for(j=1; j<=(nlstate+ndeath);j++){
|
|
k=k+1;
|
|
gp[k]=pmmij[i][j];
|
|
}
|
|
}
|
|
|
|
for(i=1; i<=npar; i++)
|
|
xp[i] = x[i] - (i==theta ?delti[theta]:0);
|
|
|
|
pmij(pmmij,cov,ncovmodel,xp,nlstate);
|
|
k=0;
|
|
for(i=1; i<=(nlstate+ndeath); i++){
|
|
for(j=1; j<=(nlstate+ndeath);j++){
|
|
k=k+1;
|
|
gm[k]=pmmij[i][j];
|
|
}
|
|
}
|
|
|
for(i=1; i<= (nlstate+ndeath)*(nlstate+ndeath); i++)
|
for(i=1; i<= (nlstate+ndeath)*(nlstate+ndeath); i++)
|
gradg[theta][i]=(gp[i]-gm[i])/2./delti[theta];
|
gradg[theta][i]=(gp[i]-gm[i])/2./delti[theta];
|
}
|
}
|
|
|
for(j=1; j<=(nlstate+ndeath)*(nlstate+ndeath);j++)
|
|
for(theta=1; theta <=npar; theta++)
|
|
trgradg[j][theta]=gradg[theta][j];
|
|
|
|
matprod2(dnewm,trgradg,1,9,1,npar,1,npar,matcov);
|
|
matprod2(doldm,dnewm,1,9,1,npar,1,9,gradg);
|
|
|
|
pmij(pmmij,cov,ncovmodel,x,nlstate);
|
|
|
|
k=0;
|
for(j=1; j<=(nlstate+ndeath)*(nlstate+ndeath);j++)
|
for(i=1; i<=(nlstate+ndeath); i++){
|
for(theta=1; theta <=npar; theta++)
|
for(j=1; j<=(nlstate+ndeath);j++){
|
trgradg[j][theta]=gradg[theta][j];
|
k=k+1;
|
|
gm[k]=pmmij[i][j];
|
matprod2(dnewm,trgradg,1,9,1,npar,1,npar,matcov);
|
|
matprod2(doldm,dnewm,1,9,1,npar,1,9,gradg);
|
|
|
|
pmij(pmmij,cov,ncovmodel,x,nlstate);
|
|
|
|
k=0;
|
|
for(i=1; i<=(nlstate+ndeath); i++){
|
|
for(j=1; j<=(nlstate+ndeath);j++){
|
|
k=k+1;
|
|
gm[k]=pmmij[i][j];
|
|
}
|
}
|
}
|
}
|
|
|
|
/*printf("\n%d ",(int)age);
|
/*printf("\n%d ",(int)age);
|
for (i=1; i<=(nlstate+ndeath)*(nlstate+ndeath-1);i++){
|
for (i=1; i<=(nlstate+ndeath)*(nlstate+ndeath-1);i++){
|
|
|
|
|
printf("%e [%e ;%e] ",gm[i],gm[i]-2*sqrt(doldm[i][i]),gm[i]+2*sqrt(doldm[i][i]));
|
printf("%e [%e ;%e] ",gm[i],gm[i]-2*sqrt(doldm[i][i]),gm[i]+2*sqrt(doldm[i][i]));
|
}*/
|
}*/
|
|
|
fprintf(ficresprob,"\n%d ",(int)age);
|
fprintf(ficresprob,"\n%d ",(int)age);
|
|
|
for (i=1; i<=(nlstate+ndeath)*(nlstate+ndeath-1);i++){
|
|
if (i== 2) fprintf(ficresprob,"%.3e %.3e ",gm[i],doldm[i][i]);
|
|
if (i== 4) fprintf(ficresprob,"%.3e %.3e ",gm[i],doldm[i][i]);
|
|
}
|
|
|
|
|
for (i=1; i<=(nlstate+ndeath)*(nlstate+ndeath-1);i++)
|
|
fprintf(ficresprob,"%.3e (%.3e) ",gm[i],doldm[i][i]);
|
|
|
|
}
|
|
}
|
free_vector(gp,1,(nlstate+ndeath)*(nlstate+ndeath));
|
free_vector(gp,1,(nlstate+ndeath)*(nlstate+ndeath));
|
free_vector(gm,1,(nlstate+ndeath)*(nlstate+ndeath));
|
free_vector(gm,1,(nlstate+ndeath)*(nlstate+ndeath));
|
free_matrix(trgradg,1,(nlstate+ndeath)*(nlstate+ndeath),1,npar);
|
free_matrix(trgradg,1,(nlstate+ndeath)*(nlstate+ndeath),1,npar);
|
free_matrix(gradg,1,(nlstate+ndeath)*(nlstate+ndeath),1,npar);
|
free_matrix(gradg,1,(nlstate+ndeath)*(nlstate+ndeath),1,npar);
|
}
|
}
|
free_vector(xp,1,npar);
|
free_vector(xp,1,npar);
|
fclose(ficresprob);
|
fclose(ficresprob);
|
|
|
}
|
}
|
|
|
/******************* Printing html file ***********/
|
/******************* Printing html file ***********/
|
Line 1913 void printinghtml(char fileres[], char t
|
Line 1952 void printinghtml(char fileres[], char t
|
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 optionfile[], \
|
int imx,int jmin, int jmax, double jmeanint,char optionfile[], \
|
char optionfilehtm[],char rfileres[], char optionfilegnuplot[],\
|
char optionfilehtm[],char rfileres[], char optionfilegnuplot[],\
|
char version[], int popforecast ){
|
char version[], int popforecast, int estepm ){
|
int jj1, k1, i1, cpt;
|
int jj1, k1, i1, cpt;
|
FILE *fichtm;
|
FILE *fichtm;
|
/*char optionfilehtm[FILENAMELENGTH];*/
|
/*char optionfilehtm[FILENAMELENGTH];*/
|
Line 1924 void printinghtml(char fileres[], char t
|
Line 1963 void printinghtml(char fileres[], char t
|
printf("Problem with %s \n",optionfilehtm), exit(0);
|
printf("Problem with %s \n",optionfilehtm), exit(0);
|
}
|
}
|
|
|
fprintf(fichtm,"<body> <font size=\"2\">Imach, Version %s </font> <hr size=\"2\" color=\"#EC5E5E\"> \n
|
fprintf(fichtm,"<body> <font size=\"2\">%s </font> <hr size=\"2\" color=\"#EC5E5E\"> \n
|
Title=%s <br>Datafile=%s Firstpass=%d Lastpass=%d Stepm=%d Weight=%d Model=%s<br>\n
|
Title=%s <br>Datafile=%s Firstpass=%d Lastpass=%d Stepm=%d Weight=%d Model=%s<br>\n
|
\n
|
\n
|
Total number of observations=%d <br>\n
|
Total number of observations=%d <br>\n
|
Line 1936 Interval (in months) between two waves:
|
Line 1975 Interval (in months) between two waves:
|
- Observed prevalence in each state: <a href=\"p%s\">p%s</a> <br>\n
|
- Observed prevalence in each state: <a href=\"p%s\">p%s</a> <br>\n
|
- Stationary prevalence in each state: <a href=\"pl%s\">pl%s</a> <br>\n
|
- Stationary prevalence in each state: <a href=\"pl%s\">pl%s</a> <br>\n
|
- Transition probabilities: <a href=\"pij%s\">pij%s</a><br>\n
|
- Transition probabilities: <a href=\"pij%s\">pij%s</a><br>\n
|
- Life expectancies by age and initial health status: <a href=\"e%s\">e%s</a> <br>\n",version,title,datafile,firstpass,lastpass,stepm, weightopt,model,imx,jmin,jmax,jmean,fileres,fileres,optionfilegnuplot,optionfilegnuplot,fileres,fileres,fileres,fileres,fileres,fileres,fileres,fileres);
|
- Life expectancies by age and initial health status (estepm=%2d months): <a href=\"e%s\">e%s</a> <br>\n",version,title,datafile,firstpass,lastpass,stepm, weightopt,model,imx,jmin,jmax,jmean,fileres,fileres,optionfilegnuplot,optionfilegnuplot,fileres,fileres,fileres,fileres,fileres,fileres,estepm,fileres,fileres);
|
|
|
fprintf(fichtm,"\n
|
fprintf(fichtm,"\n
|
- Parameter file with estimated parameters and the covariance matrix: <a href=\"%s\">%s</a> <br>\n
|
- Parameter file with estimated parameters and the covariance matrix: <a href=\"%s\">%s</a> <br>\n
|
- Variances of life expectancies by age and initial health status: <a href=\"v%s\">v%s</a><br>\n
|
- Variances of life expectancies by age and initial health status (estepm=%d months): <a href=\"v%s\">v%s</a><br>\n
|
- Health expectancies with their variances: <a href=\"t%s\">t%s</a> <br>\n
|
- Health expectancies with their variances: <a href=\"t%s\">t%s</a> <br>\n
|
- Standard deviation of stationary prevalences: <a href=\"vpl%s\">vpl%s</a> <br>\n",rfileres,rfileres,fileres,fileres,fileres,fileres,fileres,fileres);
|
- Standard deviation of stationary prevalences: <a href=\"vpl%s\">vpl%s</a> <br>\n",rfileres,rfileres, estepm, fileres,fileres,fileres,fileres,fileres,fileres);
|
|
|
if(popforecast==1) fprintf(fichtm,"\n
|
if(popforecast==1) fprintf(fichtm,"\n
|
- Prevalences forecasting: <a href=\"f%s\">f%s</a> <br>\n
|
- Prevalences forecasting: <a href=\"f%s\">f%s</a> <br>\n
|
Line 2493 int main(int argc, char *argv[])
|
Line 2532 int main(int argc, char *argv[])
|
double dateprev1, dateprev2,jproj1,mproj1,anproj1,jproj2,mproj2,anproj2;
|
double dateprev1, dateprev2,jproj1,mproj1,anproj1,jproj2,mproj2,anproj2;
|
|
|
|
|
char version[80]="Imach version 0.8a, March 2002, INED-EUROREVES ";
|
char version[80]="Imach version 0.8b, March 2002, INED-EUROREVES ";
|
char *alph[]={"a","a","b","c","d","e"}, str[4];
|
char *alph[]={"a","a","b","c","d","e"}, str[4];
|
|
|
|
|
Line 2733 while((c=getc(ficpar))=='#' && c!= EOF){
|
Line 2772 while((c=getc(ficpar))=='#' && c!= EOF){
|
if ((s[2][i]==3) && (s[3][i]==2)) s[3][i]=3;
|
if ((s[2][i]==3) && (s[3][i]==2)) s[3][i]=3;
|
if ((s[3][i]==3) && (s[4][i]==2)) s[4][i]=3;
|
if ((s[3][i]==3) && (s[4][i]==2)) s[4][i]=3;
|
}*/
|
}*/
|
|
/* for (i=1; i<=imx; i++){
|
/* for (i=1; i<=imx; i++){
|
|
if (s[4][i]==9) s[4][i]=-1;
|
if (s[4][i]==9) s[4][i]=-1;
|
printf("%d %.lf %.lf %.lf %.lf/%.lf %.lf/%.lf %.lf/%.lf %d %.lf/%.lf %d %.lf/%.lf %d %.lf/%.lf %d\n",num[i],(covar[1][i]), (covar[2][i]), (weight[i]), (moisnais[i]), (annais[i]), (moisdc[i]), (andc[i]), (mint[1][i]), (anint[1][i]), (s[1][i]), (mint[2][i]), (anint[2][i]), (s[2][i]), (mint[3][i]), (anint[3][i]), (s[3][i]), (mint[4][i]), (anint[4][i]), (s[4][i]));}
|
printf("%d %.lf %.lf %.lf %.lf/%.lf %.lf/%.lf %.lf/%.lf %d %.lf/%.lf %d %.lf/%.lf %d %.lf/%.lf %d\n",num[i],(covar[1][i]), (covar[2][i]), (weight[i]), (moisnais[i]), (annais[i]), (moisdc[i]), (andc[i]), (mint[1][i]), (anint[1][i]), (s[1][i]), (mint[2][i]), (anint[2][i]), (s[2][i]), (mint[3][i]), (anint[3][i]), (s[3][i]), (mint[4][i]), (anint[4][i]), (s[4][i]));}*/
|
*/
|
|
|
|
/* Calculation of the number of parameter from char model*/
|
/* Calculation of the number of parameter from char model*/
|
Tvar=ivector(1,15);
|
Tvar=ivector(1,15);
|
Line 3021 printf("Total number of individuals= %d,
|
Line 3059 printf("Total number of individuals= %d,
|
fputs(line,ficparo);
|
fputs(line,ficparo);
|
}
|
}
|
ungetc(c,ficpar);
|
ungetc(c,ficpar);
|
|
estepm=0;
|
fscanf(ficpar,"agemin=%lf agemax=%lf bage=%lf fage=%lf\n",&ageminpar,&agemaxpar, &bage, &fage);
|
fscanf(ficpar,"agemin=%lf agemax=%lf bage=%lf fage=%lf estepm=%d\n",&ageminpar,&agemaxpar, &bage, &fage, &estepm);
|
|
if (estepm==0 || estepm < stepm) estepm=stepm;
|
if (fage <= 2) {
|
if (fage <= 2) {
|
bage = ageminpar;
|
bage = ageminpar;
|
fage = agemaxpar;
|
fage = agemaxpar;
|
}
|
}
|
|
|
fprintf(ficres,"# agemin agemax for life expectancy, bage fage (if mle==0 ie no data nor Max likelihood).\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",ageminpar,agemaxpar,bage,fage);
|
fprintf(ficres,"agemin=%.0f agemax=%.0f bage=%.0f fage=%.0f estepm=%d\n",ageminpar,agemaxpar,bage,fage, estepm);
|
fprintf(ficparo,"agemin=%.0f agemax=%.0f bage=%.0f fage=%.0f\n",ageminpar,agemaxpar,bage,fage);
|
fprintf(ficparo,"agemin=%.0f agemax=%.0f bage=%.0f fage=%.0f estepm=%d\n",ageminpar,agemaxpar,bage,fage, estepm);
|
|
|
while((c=getc(ficpar))=='#' && c!= EOF){
|
while((c=getc(ficpar))=='#' && c!= EOF){
|
ungetc(c,ficpar);
|
ungetc(c,ficpar);
|
Line 3105 while((c=getc(ficpar))=='#' && c!= EOF){
|
Line 3143 while((c=getc(ficpar))=='#' && c!= EOF){
|
|
|
/*--------- index.htm --------*/
|
/*--------- index.htm --------*/
|
|
|
printinghtml(fileres,title,datafile, firstpass, lastpass, stepm, weightopt,model,imx,jmin,jmax,jmean,optionfile,optionfilehtm,rfileres,optionfilegnuplot,version,popforecast);
|
printinghtml(fileres,title,datafile, firstpass, lastpass, stepm, weightopt,model,imx,jmin,jmax,jmean,optionfile,optionfilehtm,rfileres,optionfilegnuplot,version,popforecast,estepm);
|
|
|
|
|
/*--------------- Prevalence limit --------------*/
|
/*--------------- Prevalence limit --------------*/
|
Line 3202 while((c=getc(ficpar))=='#' && c!= EOF){
|
Line 3240 while((c=getc(ficpar))=='#' && c!= EOF){
|
}
|
}
|
}
|
}
|
|
|
/* varprob(fileres, matcov, p, delti, nlstate, (int) bage, (int) fage,k);*/
|
varprob(fileres, matcov, p, delti, nlstate, (int) bage, (int) fage,k,Tvar,nbcode, ncodemax);
|
|
|
fclose(ficrespij);
|
fclose(ficrespij);
|
|
|
Line 3265 while((c=getc(ficpar))=='#' && c!= EOF){
|
Line 3303 while((c=getc(ficpar))=='#' && c!= EOF){
|
|
|
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);
|
evsij(fileres, eij, p, nlstate, stepm, (int) bage, (int)fage, oldm, savm, k, estepm);
|
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;
|
varevsij(fileres, vareij, matcov, p, delti, nlstate, stepm, (int) bage, (int) fage, oldm, savm, prlim, ftolpl,k);
|
varevsij(fileres, vareij, matcov, p, delti, nlstate, stepm, (int) bage, (int) fage, oldm, savm, prlim, ftolpl,k, estepm);
|
|
|
|
|
|
|
Line 3294 while((c=getc(ficpar))=='#' && c!= EOF){
|
Line 3332 while((c=getc(ficpar))=='#' && c!= EOF){
|
for(i=1, vepp=0.;i <=nlstate;i++)
|
for(i=1, vepp=0.;i <=nlstate;i++)
|
for(j=1;j <=nlstate;j++)
|
for(j=1;j <=nlstate;j++)
|
vepp += vareij[i][j][(int)age];
|
vepp += vareij[i][j][(int)age];
|
fprintf(ficrest," %7.2f (%7.2f)", epj[nlstate+1],sqrt(vepp));
|
fprintf(ficrest," %7.3f (%7.3f)", epj[nlstate+1],sqrt(vepp));
|
for(j=1;j <=nlstate;j++){
|
for(j=1;j <=nlstate;j++){
|
fprintf(ficrest," %7.2f (%7.2f)", epj[j],sqrt(vareij[j][j][(int)age]));
|
fprintf(ficrest," %7.3f (%7.3f)", epj[j],sqrt(vareij[j][j][(int)age]));
|
}
|
}
|
fprintf(ficrest,"\n");
|
fprintf(ficrest,"\n");
|
}
|
}
|