|
|
| version 1.69, 2003/02/04 20:55:29 | version 1.73, 2003/04/08 14:06:50 |
|---|---|
| Line 83 | Line 83 |
| #define ODIRSEPARATOR '\\' | #define ODIRSEPARATOR '\\' |
| #endif | #endif |
| char version[80]="Imach version 0.91, November 2002, INED-EUROREVES "; | char version[80]="Imach version 0.94, February 2003, INED-EUROREVES "; |
| int erreur; /* Error number */ | int erreur; /* Error number */ |
| int nvar; | int nvar; |
| int cptcovn=0, cptcovage=0, cptcoveff=0,cptcov; | int cptcovn=0, cptcovage=0, cptcoveff=0,cptcov; |
| Line 972 double func( double *x) | Line 972 double func( double *x) |
| * is higher than the multiple of stepm and negative otherwise. | * is higher than the multiple of stepm and negative otherwise. |
| */ | */ |
| /* lli= (savm[s1][s2]>1.e-8 ?(1.+bbh)*log(out[s1][s2])- bbh*log(savm[s1][s2]):log((1.+bbh)*out[s1][s2]));*/ | /* lli= (savm[s1][s2]>1.e-8 ?(1.+bbh)*log(out[s1][s2])- bbh*log(savm[s1][s2]):log((1.+bbh)*out[s1][s2]));*/ |
| lli= (savm[s1][s2]>(double)1.e-8 ?log((1.+bbh)*out[s1][s2]- bbh*(savm[s1][s2])):log((1.+bbh)*out[s1][s2])); /* linear interpolation */ | if( s2 > nlstate){ |
| /* i.e. if s2 is a death state and if the date of death is known then the contribution | |
| to the likelihood is the probability to die between last step unit time and current | |
| step unit time, which is also the differences between probability to die before dh | |
| and probability to die before dh-stepm . | |
| In version up to 0.92 likelihood was computed | |
| as if date of death was unknown. Death was treated as any other | |
| health state: the date of the interview describes the actual state | |
| and not the date of a change in health state. The former idea was | |
| to consider that at each interview the state was recorded | |
| (healthy, disable or death) and IMaCh was corrected; but when we | |
| introduced the exact date of death then we should have modified | |
| the contribution of an exact death to the likelihood. This new | |
| contribution is smaller and very dependent of the step unit | |
| stepm. It is no more the probability to die between last interview | |
| and month of death but the probability to survive from last | |
| interview up to one month before death multiplied by the | |
| probability to die within a month. Thanks to Chris | |
| Jackson for correcting this bug. Former versions increased | |
| mortality artificially. The bad side is that we add another loop | |
| which slows down the processing. The difference can be up to 10% | |
| lower mortality. | |
| */ | |
| lli=log(out[s1][s2] - savm[s1][s2]); | |
| }else{ | |
| lli= log((1.+bbh)*out[s1][s2]- bbh*savm[s1][s2]); /* linear interpolation */ | |
| /* lli= (savm[s1][s2]>(double)1.e-8 ?log((1.+bbh)*out[s1][s2]- bbh*(savm[s1][s2])):log((1.+bbh)*out[s1][s2]));*/ /* linear interpolation */ | |
| } | |
| /*lli=(1.+bbh)*log(out[s1][s2])- bbh*log(savm[s1][s2]);*/ | /*lli=(1.+bbh)*log(out[s1][s2])- bbh*log(savm[s1][s2]);*/ |
| /*if(lli ==000.0)*/ | /*if(lli ==000.0)*/ |
| /*printf("bbh= %f lli=%f savm=%f out=%f %d\n",bbh,lli,savm[s1][s2], out[s[mw[mi][i]][i]][s[mw[mi+1][i]][i]],i); */ | /*printf("bbh= %f lli=%f savm=%f out=%f %d\n",bbh,lli,savm[s1][s2], out[s[mw[mi][i]][i]][s[mw[mi+1][i]][i]],i); */ |
| ipmx +=1; | ipmx +=1; |
| sw += weight[i]; | sw += weight[i]; |
| ll[s[mw[mi][i]][i]] += 2*weight[i]*lli; | ll[s[mw[mi][i]][i]] += 2*weight[i]*lli; |
| } /* end of wave */ | } /* end of wave */ |
| Line 1402 void freqsummary(char fileres[], int ag | Line 1429 void freqsummary(char fileres[], int ag |
| int i, m, jk, k1,i1, j1, bool, z1,z2,j; | int i, m, jk, k1,i1, j1, bool, z1,z2,j; |
| int first; | int first; |
| double ***freq; /* Frequencies */ | double ***freq; /* Frequencies */ |
| double *pp; | double *pp, **prop; |
| double pos, k2, dateintsum=0,k2cpt=0; | double pos,posprop, k2, dateintsum=0,k2cpt=0; |
| FILE *ficresp; | FILE *ficresp; |
| char fileresp[FILENAMELENGTH]; | char fileresp[FILENAMELENGTH]; |
| pp=vector(1,nlstate); | pp=vector(1,nlstate); |
| prop=matrix(1,nlstate,agemin,agemax+3); | |
| probs= ma3x(1,AGESUP,1,NCOVMAX, 1,NCOVMAX); | probs= ma3x(1,AGESUP,1,NCOVMAX, 1,NCOVMAX); |
| strcpy(fileresp,"p"); | strcpy(fileresp,"p"); |
| strcat(fileresp,fileres); | strcat(fileresp,fileres); |
| Line 1433 void freqsummary(char fileres[], int ag | Line 1461 void freqsummary(char fileres[], int ag |
| for (jk=-1; jk<=nlstate+ndeath; jk++) | for (jk=-1; jk<=nlstate+ndeath; jk++) |
| for(m=agemin; m <= agemax+3; m++) | for(m=agemin; m <= agemax+3; m++) |
| freq[i][jk][m]=0; | freq[i][jk][m]=0; |
| for (i=1; i<=nlstate; i++) | |
| for(m=agemin; m <= agemax+3; m++) | |
| prop[i][m]=0; | |
| dateintsum=0; | dateintsum=0; |
| k2cpt=0; | k2cpt=0; |
| Line 1449 void freqsummary(char fileres[], int ag | Line 1481 void freqsummary(char fileres[], int ag |
| 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; |
| if (s[m][i]>0 && s[m][i]<=nlstate) prop[s[m][i]][(int)agev[m][i]] += weight[i]; | |
| if (m<lastpass) { | if (m<lastpass) { |
| freq[s[m][i]][s[m+1][i]][(int)agev[m][i]] += weight[i]; | freq[s[m][i]][s[m+1][i]][(int)agev[m][i]] += weight[i]; |
| freq[s[m][i]][s[m+1][i]][(int) agemax+3] += weight[i]; | freq[s[m][i]][s[m+1][i]][(int) agemax+3] += weight[i]; |
| Line 1506 void freqsummary(char fileres[], int ag | Line 1539 void freqsummary(char fileres[], int ag |
| for(jk=1; jk <=nlstate ; jk++){ | for(jk=1; jk <=nlstate ; jk++){ |
| for(m=0, pp[jk]=0; m <=nlstate+ndeath; m++) | for(m=0, pp[jk]=0; m <=nlstate+ndeath; m++) |
| pp[jk] += freq[jk][m][i]; | pp[jk] += freq[jk][m][i]; |
| } | } |
| for(jk=1,pos=0,posprop=0; jk <=nlstate ; jk++){ | |
| for(jk=1,pos=0; jk <=nlstate ; jk++) | |
| pos += pp[jk]; | pos += pp[jk]; |
| posprop += prop[jk][i]; | |
| } | |
| for(jk=1; jk <=nlstate ; jk++){ | for(jk=1; jk <=nlstate ; jk++){ |
| if(pos>=1.e-5){ | if(pos>=1.e-5){ |
| if(first==1) | if(first==1) |
| Line 1522 void freqsummary(char fileres[], int ag | Line 1556 void freqsummary(char fileres[], int ag |
| } | } |
| if( i <= (int) agemax){ | if( i <= (int) agemax){ |
| if(pos>=1.e-5){ | if(pos>=1.e-5){ |
| fprintf(ficresp," %d %.5f %.0f %.0f",i,pp[jk]/pos, pp[jk],pos); | fprintf(ficresp," %d %.5f %.0f %.0f",i,prop[jk][i]/posprop, prop[jk][i],posprop); |
| probs[i][jk][j1]= pp[jk]/pos; | probs[i][jk][j1]= pp[jk]/pos; |
| /*printf("\ni=%d jk=%d j1=%d %.5f %.0f %.0f %f",i,jk,j1,pp[jk]/pos, pp[jk],pos,probs[i][jk][j1]);*/ | /*printf("\ni=%d jk=%d j1=%d %.5f %.0f %.0f %f",i,jk,j1,pp[jk]/pos, pp[jk],pos,probs[i][jk][j1]);*/ |
| } | } |
| else | else |
| fprintf(ficresp," %d NaNq %.0f %.0f",i,pp[jk],pos); | fprintf(ficresp," %d NaNq %.0f %.0f",i,prop[jk][i],posprop); |
| } | } |
| } | } |
| Line 1551 void freqsummary(char fileres[], int ag | Line 1585 void freqsummary(char fileres[], int ag |
| fclose(ficresp); | fclose(ficresp); |
| free_ma3x(freq,-1,nlstate+ndeath,-1,nlstate+ndeath,(int) agemin,(int) agemax+3); | free_ma3x(freq,-1,nlstate+ndeath,-1,nlstate+ndeath,(int) agemin,(int) agemax+3); |
| free_vector(pp,1,nlstate); | free_vector(pp,1,nlstate); |
| free_matrix(prop,1,nlstate,(int) agemin,(int) agemax+3); | |
| /* End of Freq */ | /* End of Freq */ |
| } | } |
| /************ Prevalence ********************/ | /************ Prevalence ********************/ |
| void prevalence(int agemin, float agemax, int **s, double **agev, int nlstate, int imx, int *Tvar, int **nbcode, int *ncodemax,double **mint,double **anint, double dateprev1,double dateprev2, double calagedatem) | void prevalence(int agemin, float agemax, int **s, double **agev, int nlstate, int imx, int *Tvar, int **nbcode, int *ncodemax,double **mint,double **anint, double dateprev1,double dateprev2, int firstpass, int lastpass) |
| { | { |
| /* Compute observed prevalence between dateprev1 and dateprev2 by counting the number of people | /* Compute observed prevalence between dateprev1 and dateprev2 by counting the number of people |
| in each health status at the date of interview (if between dateprev1 and dateprev2). | in each health status at the date of interview (if between dateprev1 and dateprev2). |
| Line 1565 void prevalence(int agemin, float agemax | Line 1599 void prevalence(int agemin, float agemax |
| int i, m, jk, k1, i1, j1, bool, z1,z2,j; | int i, m, jk, k1, i1, j1, bool, z1,z2,j; |
| double ***freq; /* Frequencies */ | double ***freq; /* Frequencies */ |
| double *pp; | double *pp, **prop; |
| double pos; | double pos,posprop; |
| double y2; /* in fractional years */ | double y2; /* in fractional years */ |
| pp=vector(1,nlstate); | pp=vector(1,nlstate); |
| prop=matrix(1,nlstate,agemin,agemax+3); | |
| freq=ma3x(-1,nlstate+ndeath,-1,nlstate+ndeath,agemin,agemax+3); | freq=ma3x(-1,nlstate+ndeath,-1,nlstate+ndeath,agemin,agemax+3); |
| j1=0; | j1=0; |
| Line 1581 void prevalence(int agemin, float agemax | Line 1615 void prevalence(int agemin, float agemax |
| for(i1=1; i1<=ncodemax[k1];i1++){ | for(i1=1; i1<=ncodemax[k1];i1++){ |
| j1++; | j1++; |
| for (i=-1; i<=nlstate+ndeath; i++) | for (i=1; i<=nlstate; i++) |
| for (jk=-1; jk<=nlstate+ndeath; jk++) | for(m=agemin; m <= agemax+3; m++) |
| for(m=agemin; m <= agemax+3; m++) | prop[i][m]=0; |
| freq[i][jk][m]=0; | |
| for (i=1; i<=imx; i++) { /* Each individual */ | for (i=1; i<=imx; i++) { /* Each individual */ |
| bool=1; | bool=1; |
| Line 1599 void prevalence(int agemin, float agemax | Line 1632 void prevalence(int agemin, float agemax |
| if ((y2>=dateprev1) && (y2<=dateprev2)) { /* Here is the main selection (fractional years) */ | if ((y2>=dateprev1) && (y2<=dateprev2)) { /* Here is the main selection (fractional years) */ |
| 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; |
| if (m<lastpass) { | if (s[m][i]>0 && s[m][i]<=nlstate) { |
| if (calagedatem>0) /* We compute prevalence at exact age, agev in fractional years */ | prop[s[m][i]][(int)agev[m][i]] += weight[i]; |
| freq[s[m][i]][s[m+1][i]][(int)(agev[m][i]+1-((int)calagedatem %12)/12.)] += weight[i]; | prop[s[m][i]][(int)(agemax+3)] += weight[i]; |
| else | |
| freq[s[m][i]][s[m+1][i]][(int)agev[m][i]] += weight[i]; | |
| freq[s[m][i]][s[m+1][i]][(int)(agemax+3)] += weight[i]; | |
| } | } |
| } | } |
| } /* end selection of waves */ | } /* end selection of waves */ |
| } | } |
| } | } |
| for(i=(int)agemin; i <= (int)agemax+3; i++){ | for(i=(int)agemin; i <= (int)agemax+3; i++){ |
| for(jk=1; jk <=nlstate ; jk++){ | |
| for(m=-1, pp[jk]=0; m <=nlstate+ndeath ; m++) | |
| pp[jk] += freq[jk][m][i]; | |
| } | |
| for(jk=1; jk <=nlstate ; jk++){ | |
| for(m=-1, pos=0; m <=0 ; m++) | |
| pos += freq[jk][m][i]; | |
| } | |
| for(jk=1; jk <=nlstate ; jk++){ | for(jk=1,posprop=0; jk <=nlstate ; jk++) { |
| for(m=0, pp[jk]=0; m <=nlstate+ndeath; m++) | posprop += prop[jk][i]; |
| pp[jk] += freq[jk][m][i]; | |
| } | } |
| for(jk=1,pos=0; jk <=nlstate ; jk++) pos += pp[jk]; | |
| for(jk=1; jk <=nlstate ; jk++){ | for(jk=1; jk <=nlstate ; jk++){ |
| if( i <= (int) agemax){ | if( i <= (int) agemax){ |
| if(pos>=1.e-5){ | if(posprop>=1.e-5){ |
| probs[i][jk][j1]= pp[jk]/pos; | probs[i][jk][j1]= prop[jk][i]/posprop; |
| } | } |
| } | } |
| }/* end jk */ | }/* end jk */ |
| Line 1641 void prevalence(int agemin, float agemax | Line 1660 void prevalence(int agemin, float agemax |
| free_ma3x(freq,-1,nlstate+ndeath,-1,nlstate+ndeath,(int) agemin,(int) agemax+3); | free_ma3x(freq,-1,nlstate+ndeath,-1,nlstate+ndeath,(int) agemin,(int) agemax+3); |
| free_vector(pp,1,nlstate); | free_vector(pp,1,nlstate); |
| free_matrix(prop,1,nlstate,(int) agemin,(int) agemax+3); | |
| } /* End of Freq */ | } /* End of Freq */ |
| /************* Waves Concatenation ***************/ | /************* Waves Concatenation ***************/ |
| Line 1710 void concatwav(int wav[], int **dh, int | Line 1729 void concatwav(int wav[], int **dh, int |
| sum=sum+j; | sum=sum+j; |
| /*if (j<0) printf("j=%d num=%d \n",j,i); */ | /*if (j<0) printf("j=%d num=%d \n",j,i); */ |
| /* printf("%d %d %d %d\n", s[mw[mi][i]][i] ,s[mw[mi+1][i]][i],j,i);*/ | /* printf("%d %d %d %d\n", s[mw[mi][i]][i] ,s[mw[mi+1][i]][i],j,i);*/ |
| /*printf("%d %lf %d %d %d\n", i,agev[mw[mi][i]][i],j,s[mw[mi][i]][i] ,s[mw[mi+1][i]][i]);*/ | |
| } | } |
| } | } |
| else{ | else{ |
| Line 1719 void concatwav(int wav[], int **dh, int | Line 1739 void concatwav(int wav[], int **dh, int |
| if (j >= jmax) jmax=j; | if (j >= jmax) jmax=j; |
| else if (j <= jmin)jmin=j; | else if (j <= jmin)jmin=j; |
| /* if (j<10) printf("j=%d jmin=%d num=%d ",j,jmin,i); */ | /* if (j<10) printf("j=%d jmin=%d num=%d ",j,jmin,i); */ |
| /*printf("%d %lf %d %d %d\n", i,agev[mw[mi][i]][i],j,s[mw[mi][i]][i] ,s[mw[mi+1][i]][i]);*/ | |
| sum=sum+j; | sum=sum+j; |
| } | } |
| jk= j/stepm; | jk= j/stepm; |
| Line 1747 void concatwav(int wav[], int **dh, int | Line 1768 void concatwav(int wav[], int **dh, int |
| if(dh[mi][i]==0){ | if(dh[mi][i]==0){ |
| dh[mi][i]=1; /* At least one step */ | dh[mi][i]=1; /* At least one step */ |
| bh[mi][i]=ju; /* At least one step */ | bh[mi][i]=ju; /* At least one step */ |
| printf(" bh=%d ju=%d jl=%d dh=%d jk=%d stepm=%d %d\n",bh[mi][i],ju,jl,dh[mi][i],jk,stepm,i); | /* printf(" bh=%d ju=%d jl=%d dh=%d jk=%d stepm=%d %d\n",bh[mi][i],ju,jl,dh[mi][i],jk,stepm,i);*/ |
| } | } |
| } | } |
| } /* end if mle */ | } /* end if mle */ |
| Line 2215 void varevsij(char optionfilefiname[], d | Line 2236 void varevsij(char optionfilefiname[], d |
| vareij[i][j][(int)age] += doldm[i][j]*hf*hf; | vareij[i][j][(int)age] += doldm[i][j]*hf*hf; |
| } | } |
| } | } |
| /* pptj */ | /* pptj */ |
| matprod2(dnewmp,trgradgp,nlstate+1,nlstate+ndeath,1,npar,1,npar,matcov); | matprod2(dnewmp,trgradgp,nlstate+1,nlstate+ndeath,1,npar,1,npar,matcov); |
| matprod2(doldmp,dnewmp,nlstate+1,nlstate+ndeath,1,npar,nlstate+1,nlstate+ndeath,gradgp); | matprod2(doldmp,dnewmp,nlstate+1,nlstate+ndeath,1,npar,nlstate+1,nlstate+ndeath,gradgp); |
| for(j=nlstate+1;j<=nlstate+ndeath;j++) | |
| for(j=nlstate+1;j<=nlstate+ndeath;j++) | for(i=nlstate+1;i<=nlstate+ndeath;i++) |
| for(i=nlstate+1;i<=nlstate+ndeath;i++){ | |
| varppt[j][i]=doldmp[j][i]; | varppt[j][i]=doldmp[j][i]; |
| /* end ppptj */ | /* end ppptj */ |
| /* x centered again */ | /* x centered again */ |
| Line 2237 void varevsij(char optionfilefiname[], d | Line 2257 void varevsij(char optionfilefiname[], d |
| prlim[i][i]=mobaverage[(int)age][i][ij]; | prlim[i][i]=mobaverage[(int)age][i][ij]; |
| } | } |
| } | } |
| /* This for computing probability of death (h=1 means | /* This for computing probability of death (h=1 means |
| computed over hstepm (estepm) matrices product = hstepm*stepm months) | computed over hstepm (estepm) matrices product = hstepm*stepm months) |
| as a weighted average of prlim. | as a weighted average of prlim. |
| Line 2283 void varevsij(char optionfilefiname[], d | Line 2303 void varevsij(char optionfilefiname[], d |
| fprintf(ficgp,"\n replot \"%s\" u 1:(($3+1.96*$4)) t \"95\%% interval\" w l 2 ",fileresprobmorprev); | fprintf(ficgp,"\n replot \"%s\" u 1:(($3+1.96*$4)) t \"95\%% interval\" w l 2 ",fileresprobmorprev); |
| fprintf(ficgp,"\n replot \"%s\" u 1:(($3-1.96*$4)) not w l 2 ",fileresprobmorprev); | fprintf(ficgp,"\n replot \"%s\" u 1:(($3-1.96*$4)) not w l 2 ",fileresprobmorprev); |
| fprintf(fichtm,"\n<br> File (multiple files are possible if covariates are present): <A href=\"%s\">%s</a>\n",fileresprobmorprev,fileresprobmorprev); | fprintf(fichtm,"\n<br> File (multiple files are possible if covariates are present): <A href=\"%s\">%s</a>\n",fileresprobmorprev,fileresprobmorprev); |
| fprintf(fichtm,"\n<br> Probability is computed over estepm=%d months. <br> <img src=\"varmuptjgr%s%s.png\"> <br>\n", estepm,digitp,digit); | fprintf(fichtm,"\n<br> Probability is computed over estepm=%d months. <br> <img src=\"varmuptjgr%s%s%s.png\"> <br>\n", estepm,digitp,optionfilefiname,digit); |
| /* fprintf(fichtm,"\n<br> Probability is computed over estepm=%d months and then divided by estepm and multiplied by %.0f in order to have the probability to die over a year <br> <img src=\"varmuptjgr%s%s.png\"> <br>\n", stepm,YEARM,digitp,digit); | /* fprintf(fichtm,"\n<br> Probability is computed over estepm=%d months and then divided by estepm and multiplied by %.0f in order to have the probability to die over a year <br> <img src=\"varmuptjgr%s%s.png\"> <br>\n", stepm,YEARM,digitp,digit); |
| */ | */ |
| fprintf(ficgp,"\nset out \"varmuptjgr%s%s.png\";replot;",digitp,digit); | fprintf(ficgp,"\nset out \"varmuptjgr%s%s%s.png\";replot;",digitp,optionfilefiname,digit); |
| free_vector(xp,1,npar); | free_vector(xp,1,npar); |
| free_matrix(doldm,1,nlstate,1,nlstate); | free_matrix(doldm,1,nlstate,1,nlstate); |
| Line 2298 void varevsij(char optionfilefiname[], d | Line 2318 void varevsij(char optionfilefiname[], d |
| fclose(ficresprobmorprev); | fclose(ficresprobmorprev); |
| fclose(ficgp); | fclose(ficgp); |
| fclose(fichtm); | fclose(fichtm); |
| } | } |
| /************ Variance of prevlim ******************/ | /************ Variance of prevlim ******************/ |
| void varprevlim(char fileres[], double **varpl, 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 varprevlim(char fileres[], double **varpl, double **matcov, double x[], double delti[], int nlstate, int stepm, double bage, double fage, double **oldm, double **savm, double **prlim, double ftolpl, int ij) |
| Line 3018 int movingaverage(double ***probs, doubl | Line 3038 int movingaverage(double ***probs, doubl |
| /************** Forecasting ******************/ | /************** Forecasting ******************/ |
| prevforecast(char fileres[], double anproj1,double mproj1,double jproj1,double ageminpar, double agemax,double dateprev1, double dateprev2, int mobilav, double agedeb, double fage, int popforecast, char popfile[], double anproj2,double p[], int i2){ | prevforecast(char fileres[], double anproj1, double mproj1, double jproj1, double ageminpar, double agemax, double dateprev1, double dateprev2, int mobilav, double bage, double fage, int firstpass, int lastpass, double anproj2, double p[], int cptcoveff){ |
| /* proj1, year, month, day of starting projection | /* proj1, year, month, day of starting projection |
| agemin, agemax range of age | agemin, agemax range of age |
| dateprev1 dateprev2 range of dates during which prevalence is computed | dateprev1 dateprev2 range of dates during which prevalence is computed |
| anproj2 year of en of projection (same day and month as proj1). | |
| */ | */ |
| int yearp, stepsize, hstepm, nhstepm, j,k,c, cptcod, i,h; | int yearp, stepsize, hstepm, nhstepm, j, k, c, cptcod, i, h, i1; |
| int *popage; | int *popage; |
| double calagedatem, agelim, kk1, kk2, yp,yp1,yp2,jprojmean,mprojmean,anprojmean; | double agec; /* generic age */ |
| double agelim, ppij, yp,yp1,yp2,jprojmean,mprojmean,anprojmean; | |
| double *popeffectif,*popcount; | double *popeffectif,*popcount; |
| double ***p3mat; | double ***p3mat; |
| double ***mobaverage; | double ***mobaverage; |
| char fileresf[FILENAMELENGTH]; | char fileresf[FILENAMELENGTH]; |
| agelim=AGESUP; | agelim=AGESUP; |
| calagedatem=(anproj1+mproj1/12.+jproj1/365.-dateintmean)*YEARM; /* offset | prevalence(ageminpar, agemax, s, agev, nlstate, imx, Tvar, nbcode, ncodemax, mint, anint, dateprev1, dateprev2, firstpass, lastpass); |
| from the mean date of interviews between dateprev1 and dateprev2 | |
| (in fractional years converted to fractional months) */ | |
| /* Computing age-specific starting prevalence between exact | |
| dateprev1 and dateprev2 (in float years) and | |
| shifting ages from calagedatem. | |
| */ | |
| prevalence(ageminpar, agemax, s, agev, nlstate, imx,Tvar,nbcode, ncodemax,mint,anint,dateprev1,dateprev2, calagedatem); | |
| strcpy(fileresf,"f"); | strcpy(fileresf,"f"); |
| strcat(fileresf,fileres); | strcat(fileresf,fileres); |
| Line 3064 prevforecast(char fileres[], double anpr | Line 3078 prevforecast(char fileres[], double anpr |
| stepsize=(int) (stepm+YEARM-1)/YEARM; | stepsize=(int) (stepm+YEARM-1)/YEARM; |
| if (stepm<=12) stepsize=1; | if (stepm<=12) stepsize=1; |
| agelim=AGESUP; | |
| hstepm=1; | hstepm=1; |
| hstepm=hstepm/stepm; | hstepm=hstepm/stepm; |
| yp1=modf(dateintmean,&yp);/* extracts integral of datemean in yp and | yp1=modf(dateintmean,&yp);/* extracts integral of datemean in yp and |
| Line 3077 prevforecast(char fileres[], double anpr | Line 3089 prevforecast(char fileres[], double anpr |
| jprojmean=yp; | jprojmean=yp; |
| if(jprojmean==0) jprojmean=1; | if(jprojmean==0) jprojmean=1; |
| if(mprojmean==0) jprojmean=1; | if(mprojmean==0) jprojmean=1; |
| i1=cptcoveff; | |
| if (cptcovn < 1){i1=1;} | |
| fprintf(ficresf,"# Mean day of interviews %.lf/%.lf/%.lf (%.2f) between %.2f and %.2f ",jprojmean,mprojmean,anprojmean,dateintmean,dateprev1,dateprev2); | fprintf(ficresf,"# Mean day of interviews %.lf/%.lf/%.lf (%.2f) between %.2f and %.2f \n",jprojmean,mprojmean,anprojmean,dateintmean,dateprev1,dateprev2); |
| for(cptcov=1, k=0;cptcov<=i2;cptcov++){ | fprintf(ficresf,"#****** Routine prevforecast **\n"); |
| for(cptcov=1, k=0;cptcov<=i1;cptcov++){ | |
| for(cptcod=1;cptcod<=ncodemax[cptcoveff];cptcod++){ | for(cptcod=1;cptcod<=ncodemax[cptcoveff];cptcod++){ |
| k=k+1; | k=k+1; |
| fprintf(ficresf,"\n#******"); | fprintf(ficresf,"\n#******"); |
| for(j=1;j<=cptcoveff;j++) { | for(j=1;j<=cptcoveff;j++) { |
| fprintf(ficresf," V%d=%d ",Tvaraff[j],nbcode[Tvaraff[j]][codtab[k][j]]); | fprintf(ficresf," V%d=%d, hpijx=probability over h years, hp.jx is weighted by observed prev ",Tvaraff[j],nbcode[Tvaraff[j]][codtab[k][j]]); |
| } | } |
| fprintf(ficresf,"******\n"); | fprintf(ficresf,"******\n"); |
| fprintf(ficresf,"# StartingAge FinalAge"); | fprintf(ficresf,"# Covariate valuofcovar yearproj age"); |
| for(j=1; j<=nlstate+ndeath;j++) fprintf(ficresf," P.%d",j); | for(j=1; j<=nlstate+ndeath;j++){ |
| for(i=1; i<=nlstate;i++) | |
| fprintf(ficresf," p%d%d",i,j); | |
| fprintf(ficresf," p.%d",j); | |
| } | |
| for (yearp=0; yearp<=(anproj2-anproj1);yearp++) { | for (yearp=0; yearp<=(anproj2-anproj1);yearp++) { |
| fprintf(ficresf,"\n"); | fprintf(ficresf,"\n"); |
| fprintf(ficresf,"\n# Forecasting at date %.lf/%.lf/%.lf ",jproj1,mproj1,anproj1+cpt); | fprintf(ficresf,"\n# Forecasting at date %.lf/%.lf/%.lf ",jproj1,mproj1,anproj1+yearp); |
| for (agedeb=(fage-((int)calagedatem %12/12.)); agedeb>=(ageminpar-((int)calagedatem %12)/12.); agedeb--){ | for (agec=fage; agec>=(ageminpar-1); agec--){ |
| nhstepm=(int) rint((agelim-agedeb)*YEARM/stepm); | nhstepm=(int) rint((agelim-agec)*YEARM/stepm); |
| nhstepm = nhstepm/hstepm; | nhstepm = nhstepm/hstepm; |
| 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,agec,hstepm,p,nlstate,stepm,oldm,savm, k); |
| for (h=0; h<=nhstepm; h++){ | for (h=0; h<=nhstepm; h++){ |
| if (h==(int) (calagedatem+YEARM*yearp)) { | if (h==(int) (YEARM*yearp)) { |
| fprintf(ficresf,"\n"); | fprintf(ficresf,"\n"); |
| for(j=1;j<=cptcoveff;j++) | for(j=1;j<=cptcoveff;j++) |
| fprintf(ficresf,"%d %d ",Tvaraff[j],nbcode[Tvaraff[j]][codtab[k][j]]); | fprintf(ficresf,"%d %d ",Tvaraff[j],nbcode[Tvaraff[j]][codtab[k][j]]); |
| fprintf(ficresf,"%.f %.f ",anproj1+yearp,agedeb+h*hstepm/YEARM*stepm); | fprintf(ficresf,"%.f %.f ",anproj1+yearp,agec+h*hstepm/YEARM*stepm); |
| } | } |
| for(j=1; j<=nlstate+ndeath;j++) { | for(j=1; j<=nlstate+ndeath;j++) { |
| kk1=0.;kk2=0; | ppij=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+1][i][cptcod]; | ppij=ppij+p3mat[i][j][h]*mobaverage[(int)agec][i][cptcod]; |
| else { | else { |
| kk1=kk1+p3mat[i][j][h]*probs[(int)(agedeb+1)][i][cptcod]; | ppij=ppij+p3mat[i][j][h]*probs[(int)(agec)][i][cptcod]; |
| } | } |
| if (h==(int)(YEARM*yearp)) | |
| fprintf(ficresf," %.3f", p3mat[i][j][h]); | |
| } | } |
| if (h==(int)(calagedatem+12*yearp)){ | if (h==(int)(YEARM*yearp)){ |
| fprintf(ficresf," %.3f", kk1); | fprintf(ficresf," %.3f", ppij); |
| } | } |
| } | } |
| } | } |
| Line 3135 prevforecast(char fileres[], double anpr | Line 3155 prevforecast(char fileres[], double anpr |
| fclose(ficresf); | fclose(ficresf); |
| } | } |
| /************** Forecasting ******************/ | |
| /************** Forecasting *****not tested NB*************/ | |
| populforecast(char fileres[], double anpyram,double mpyram,double jpyram,double ageminpar, double agemax,double dateprev1, double dateprev2, int mobilav, double agedeb, double fage, int popforecast, char popfile[], double anpyram1,double p[], int i2){ | populforecast(char fileres[], double anpyram,double mpyram,double jpyram,double ageminpar, double agemax,double dateprev1, double dateprev2, int mobilav, double agedeb, double fage, int popforecast, char popfile[], double anpyram1,double p[], int i2){ |
| int cpt, stepsize, hstepm, nhstepm, j,k,c, cptcod, i,h; | int cpt, stepsize, hstepm, nhstepm, j,k,c, cptcod, i,h; |
| Line 3151 populforecast(char fileres[], double anp | Line 3172 populforecast(char fileres[], double anp |
| agelim=AGESUP; | agelim=AGESUP; |
| calagedatem=(anpyram+mpyram/12.+jpyram/365.-dateintmean)*YEARM; | calagedatem=(anpyram+mpyram/12.+jpyram/365.-dateintmean)*YEARM; |
| prevalence(ageminpar, agemax, s, agev, nlstate, imx,Tvar,nbcode, ncodemax,mint,anint,dateprev1,dateprev2, calagedatem); | prevalence(ageminpar, agemax, s, agev, nlstate, imx, Tvar, nbcode, ncodemax, mint, anint, dateprev1, dateprev2, firstpass, lastpass); |
| strcpy(filerespop,"pop"); | strcpy(filerespop,"pop"); |
| Line 3324 int main(int argc, char *argv[]) | Line 3345 int main(int argc, char *argv[]) |
| int mobilavproj=0 , prevfcast=0 ; /* moving average of prev, If prevfcast=1 prevalence projection */ | int mobilavproj=0 , prevfcast=0 ; /* moving average of prev, If prevfcast=1 prevalence projection */ |
| int mobilav=0,popforecast=0; | int mobilav=0,popforecast=0; |
| int hstepm, nhstepm; | int hstepm, nhstepm; |
| double jprev1, mprev1,anprev1,jprev2, mprev2,anprev2,jpyram, mpyram,anpyram,jpyram1, mpyram1,anpyram1, calagedatem; | double jprev1, mprev1,anprev1,jprev2, mprev2,anprev2,jpyram, mpyram,anpyram,jpyram1, mpyram1,anpyram1; |
| double bage, fage, age, agelim, agebase; | double bage, fage, age, agelim, agebase; |
| double ftolpl=FTOL; | double ftolpl=FTOL; |
| Line 3622 int main(int argc, char *argv[]) | Line 3643 int main(int argc, char *argv[]) |
| 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]));}*/ |
| for (i=1; i<=imx; i++) | |
| /*if ((s[3][i]==3) || (s[4][i]==3)) weight[i]=0.08; | |
| else weight[i]=1;*/ | |
| /* Calculation of the number of parameter from char model*/ | /* Calculation of the number of parameter from char model*/ |
| Tvar=ivector(1,15); /* stores the number n of the covariates in Vm+Vn at 1 and m at 2 */ | Tvar=ivector(1,15); /* stores the number n of the covariates in Vm+Vn at 1 and m at 2 */ |
| Tprod=ivector(1,15); | Tprod=ivector(1,15); |
| Line 3724 int main(int argc, char *argv[]) | Line 3749 int main(int argc, char *argv[]) |
| for (i=1; i<=imx; i++) { | for (i=1; i<=imx; i++) { |
| agedc[i]=(moisdc[i]/12.+andc[i])-(moisnais[i]/12.+annais[i]); | agedc[i]=(moisdc[i]/12.+andc[i])-(moisnais[i]/12.+annais[i]); |
| for(m=1; (m<= maxwav); m++){ | for(m=firstpass; (m<= lastpass); m++){ |
| if(s[m][i] >0){ | if(s[m][i] >0){ |
| if (s[m][i] >= nlstate+1) { | if (s[m][i] >= nlstate+1) { |
| if(agedc[i]>0) | if(agedc[i]>0) |
| Line 3738 int main(int argc, char *argv[]) | Line 3763 int main(int argc, char *argv[]) |
| agev[m][i]=-1; | agev[m][i]=-1; |
| } | } |
| } | } |
| }< | } |
| else if(s[m][i] !=9){ /* Standard case, age in fractional | else if(s[m][i] !=9){ /* Standard case, age in fractional |
| years but with the precision of a | years but with the precision of a |
| month */ | month */ |
| Line 3767 int main(int argc, char *argv[]) | Line 3792 int main(int argc, char *argv[]) |
| } | } |
| for (i=1; i<=imx; i++) { | for (i=1; i<=imx; i++) { |
| for(m=1; (m<= maxwav); m++){ | for(m=firstpass; (m<=lastpass); m++){ |
| if (s[m][i] > (nlstate+ndeath)) { | if (s[m][i] > (nlstate+ndeath)) { |
| printf("Error: on wave %d of individual %d status %d > (nlstate+ndeath)=(%d+%d)=%d\n",m,i,s[m][i],nlstate, ndeath, nlstate+ndeath); | printf("Error: on wave %d of individual %d status %d > (nlstate+ndeath)=(%d+%d)=%d\n",m,i,s[m][i],nlstate, ndeath, nlstate+ndeath); |
| fprintf(ficlog,"Error: on wave %d of individual %d status %d > (nlstate+ndeath)=(%d+%d)=%d\n",m,i,s[m][i],nlstate, ndeath, nlstate+ndeath); | fprintf(ficlog,"Error: on wave %d of individual %d status %d > (nlstate+ndeath)=(%d+%d)=%d\n",m,i,s[m][i],nlstate, ndeath, nlstate+ndeath); |
| Line 3776 int main(int argc, char *argv[]) | Line 3801 int main(int argc, char *argv[]) |
| } | } |
| } | } |
| /*for (i=1; i<=imx; i++){ | |
| for (m=firstpass; (m<lastpass); m++){ | |
| printf("%d %d %.lf %d %d\n", num[i],(covar[1][i]),agev[m][i],s[m][i],s[m+1][i]); | |
| } | |
| }*/ | |
| printf("Total number of individuals= %d, Agemin = %.2f, Agemax= %.2f\n\n", imx, agemin, agemax); | printf("Total number of individuals= %d, Agemin = %.2f, Agemax= %.2f\n\n", imx, agemin, agemax); |
| fprintf(ficlog,"Total number of individuals= %d, Agemin = %.2f, Agemax= %.2f\n\n", imx, agemin, agemax); | fprintf(ficlog,"Total number of individuals= %d, Agemin = %.2f, Agemax= %.2f\n\n", imx, agemin, agemax); |
| Line 3972 int main(int argc, char *argv[]) | Line 4004 int main(int argc, char *argv[]) |
| ungetc(c,ficpar); | ungetc(c,ficpar); |
| dateprev1=anprev1+mprev1/12.+jprev1/365.; | dateprev1=anprev1+(mprev1-1)/12.+(jprev1-1)/365.; |
| dateprev2=anprev2+mprev2/12.+jprev2/365.; | dateprev2=anprev2+(mprev2-1)/12.+(jprev2-1)/365.; |
| fscanf(ficpar,"pop_based=%d\n",&popbased); | fscanf(ficpar,"pop_based=%d\n",&popbased); |
| fprintf(ficparo,"pop_based=%d\n",popbased); | fprintf(ficparo,"pop_based=%d\n",popbased); |
| Line 3988 int main(int argc, char *argv[]) | Line 4020 int main(int argc, char *argv[]) |
| ungetc(c,ficpar); | ungetc(c,ficpar); |
| fscanf(ficpar,"prevforecast=%d starting-proj-date=%lf/%lf/%lf final-proj-date=%lf/%lf/%lf mobil_average=%d\n",&prevfcast,&jproj1,&mproj1,&anproj1,&jproj2,&mproj2,&anproj2,&mobilavproj); | fscanf(ficpar,"prevforecast=%d starting-proj-date=%lf/%lf/%lf final-proj-date=%lf/%lf/%lf mobil_average=%d\n",&prevfcast,&jproj1,&mproj1,&anproj1,&jproj2,&mproj2,&anproj2,&mobilavproj); |
| fprintf(ficparo,"prevforecast=%d starting-proj-date=%.lf/%.lf/%.lf final-proj-date=%.lf/%.lf/%.lf mobil_average=%d\n",&prevfcast,jproj1,mproj1,anproj1,jproj2,mproj2,anproj2,mobilavproj); | fprintf(ficparo,"prevforecast=%d starting-proj-date=%.lf/%.lf/%.lf final-proj-date=%.lf/%.lf/%.lf mobil_average=%d\n",prevfcast,jproj1,mproj1,anproj1,jproj2,mproj2,anproj2,mobilavproj); |
| printf("prevforecast=%d starting-proj-date=%.lf/%.lf/%.lf final-proj-date=%.lf/%.lf/%.lf mobilaverage=%d\n",&prevfcast,jproj1,mproj1,anproj1,jproj2,mproj2,anproj2,mobilavproj); | printf("prevforecast=%d starting-proj-date=%.lf/%.lf/%.lf final-proj-date=%.lf/%.lf/%.lf mobil_average=%d\n",prevfcast,jproj1,mproj1,anproj1,jproj2,mproj2,anproj2,mobilavproj); |
| fprintf(ficlog,"prevforecast=%d starting-proj-date=%.lf/%.lf/%.lf final-proj-date=%.lf/%.lf/%.lf mobilaverage=%d\n",&prevfcast,jproj1,mproj1,anproj1,jproj2,mproj2,anproj2,mobilavproj); | fprintf(ficlog,"prevforecast=%d starting-proj-date=%.lf/%.lf/%.lf final-proj-date=%.lf/%.lf/%.lf mobil_average=%d\n",prevfcast,jproj1,mproj1,anproj1,jproj2,mproj2,anproj2,mobilavproj); |
| fprintf(ficres,"prevforecast=%d starting-proj-date=%.lf/%.lf/%.lf final-proj-date=%.lf/%.lf/%.lf mobilaverage=%d\n",&prevfcast,jproj1,mproj1,anproj1,jproj2,mproj2,anproj2,mobilavproj); | fprintf(ficres,"prevforecast=%d starting-proj-date=%.lf/%.lf/%.lf final-proj-date=%.lf/%.lf/%.lf mobil_average=%d\n",prevfcast,jproj1,mproj1,anproj1,jproj2,mproj2,anproj2,mobilavproj); |
| /* day and month of proj2 are not used but only year anproj2.*/ | /* day and month of proj2 are not used but only year anproj2.*/ |
| while((c=getc(ficpar))=='#' && c!= EOF){ | while((c=getc(ficpar))=='#' && c!= EOF){ |
| Line 4129 Interval (in months) between two waves: | Line 4161 Interval (in months) between two waves: |
| /* hstepm=1; aff par mois*/ | /* hstepm=1; aff par mois*/ |
| fprintf(ficrespij,"#****** h Pij x Probability to be in state j at age x+h being in i at x "); | |
| 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 4146 Interval (in months) between two waves: | Line 4179 Interval (in months) between two waves: |
| 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); |
| fprintf(ficrespij,"# Age"); | fprintf(ficrespij,"# Cov Agex agex+h hpijx with i,j="); |
| for(i=1; i<=nlstate;i++) | for(i=1; i<=nlstate;i++) |
| for(j=1; j<=nlstate+ndeath;j++) | for(j=1; j<=nlstate+ndeath;j++) |
| fprintf(ficrespij," %1d-%1d",i,j); | fprintf(ficrespij," %1d-%1d",i,j); |
| fprintf(ficrespij,"\n"); | fprintf(ficrespij,"\n"); |
| for (h=0; h<=nhstepm; h++){ | for (h=0; h<=nhstepm; h++){ |
| fprintf(ficrespij,"%d %f %f",k,agedeb, agedeb+ h*hstepm/YEARM*stepm ); | fprintf(ficrespij,"%d %3.f %3.f",k,agedeb, agedeb+ h*hstepm/YEARM*stepm ); |
| for(i=1; i<=nlstate;i++) | for(i=1; i<=nlstate;i++) |
| for(j=1; j<=nlstate+ndeath;j++) | for(j=1; j<=nlstate+ndeath;j++) |
| fprintf(ficrespij," %.5f", p3mat[i][j][h]); | fprintf(ficrespij," %.5f", p3mat[i][j][h]); |
| Line 4173 Interval (in months) between two waves: | Line 4206 Interval (in months) between two waves: |
| /*if((stepm == 1) && (strcmp(model,".")==0)){*/ | /*if((stepm == 1) && (strcmp(model,".")==0)){*/ |
| if(prevfcast==1){ | if(prevfcast==1){ |
| if(stepm ==1){ | if(stepm ==1){ |
| prevforecast(fileres, anproj1,mproj1,jproj1, agemin,agemax, dateprev1, dateprev2,mobilavproj, agedeb, fage, popforecast, popfile, anproj2,p, i1); | prevforecast(fileres, anproj1, mproj1, jproj1, agemin, agemax, dateprev1, dateprev2, mobilavproj, bage, fage, firstpass, lastpass, anproj2, p, cptcoveff); |
| if (popforecast==1) populforecast(fileres, anpyram,mpyram,jpyram, agemin,agemax, dateprev1, dateprev2,mobilav, agedeb, fage, popforecast, popfile, anpyram1,p, i1); | if (popforecast==1) populforecast(fileres, anpyram,mpyram,jpyram, agemin,agemax, dateprev1, dateprev2,mobilav, agedeb, fage, popforecast, popfile, anpyram1,p, i1); |
| } | } |
| else{ | else{ |
| Line 4214 Interval (in months) between two waves: | Line 4247 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); |
| calagedatem=-1; | prevalence(ageminpar, agemax, s, agev, nlstate, imx, Tvar, nbcode, ncodemax, mint, anint, dateprev1, dateprev2, firstpass, lastpass); |
| prevalence(ageminpar, agemax, s, agev, nlstate, imx,Tvar,nbcode, ncodemax,mint,anint,dateprev1,dateprev2, calagedatem); | |
| if (mobilav!=0) { | if (mobilav!=0) { |
| mobaverage= ma3x(1, AGESUP,1,NCOVMAX, 1,NCOVMAX); | mobaverage= ma3x(1, AGESUP,1,NCOVMAX, 1,NCOVMAX); |