/* $Id: prevlim.h,v 1.2 2014/12/16 10:13:01 brouard Exp $
/*--------------- Prevalence limit (period or stable prevalence) --------------*/
strcpy(filerespl,"pl");
strcat(filerespl,fileres);
if((ficrespl=fopen(filerespl,"w"))==NULL) {
printf("Problem with period (stable) prevalence resultfile: %s\n", filerespl);goto end;
fprintf(ficlog,"Problem with period (stable) prevalence resultfile: %s\n", filerespl);goto end;
}
printf("Computing period (stable) prevalence: result on file '%s' \n", filerespl);
fprintf(ficlog,"Computing period (stable) prevalence: result on file '%s' \n", filerespl);
pstamp(ficrespl);
fprintf(ficrespl,"# Period (stable) prevalence \n");
fprintf(ficrespl,"#Age ");
for(i=1; i<=nlstate;i++) fprintf(ficrespl,"%d-%d ",i,i);
fprintf(ficrespl,"\n");
prlim=matrix(1,nlstate,1,nlstate);
agebase=ageminpar;
agelim=agemaxpar;
ftolpl=1.e-10;
i1=pow(2,cptcoveff);
if (cptcovn < 1){i1=1;}
for(cptcov=1,k=0;cptcov<=i1;cptcov++){
/* for(cptcov=1,k=0;cptcov<=1;cptcov++){ */
//for(cptcod=1;cptcod<=ncodemax[cptcov];cptcod++){
k=k+1;
/* to clean */
//printf("cptcov=%d cptcod=%d codtab=%d\n",cptcov, cptcod,codtab[cptcod][cptcov]);
fprintf(ficrespl,"\n#******");
printf("\n#******");
fprintf(ficlog,"\n#******");
for(j=1;j<=cptcoveff;j++) {
fprintf(ficrespl," V%d=%d ",Tvaraff[j],nbcode[Tvaraff[j]][codtab[k][j]]);
printf(" V%d=%d ",Tvaraff[j],nbcode[Tvaraff[j]][codtab[k][j]]);
fprintf(ficlog," V%d=%d ",Tvaraff[j],nbcode[Tvaraff[j]][codtab[k][j]]);
}
fprintf(ficrespl,"******\n");
printf("******\n");
fprintf(ficlog,"******\n");
fprintf(ficrespl,"#Age ");
for(j=1;j<=cptcoveff;j++) {
fprintf(ficrespl,"V%d %d",Tvaraff[j],nbcode[Tvaraff[j]][codtab[k][j]]);
}
for(i=1; i<=nlstate;i++) fprintf(ficrespl,"%d-%d ",i,i);
fprintf(ficrespl,"\n");
for (age=agebase; age<=agelim; age++){
/* for (age=agebase; age<=agebase; age++){ */
prevalim(prlim, nlstate, p, age, oldm, savm,ftolpl,k);
fprintf(ficrespl,"%.0f ",age );
for(j=1;j<=cptcoveff;j++)
fprintf(ficrespl,"%d %d ",Tvaraff[j],nbcode[Tvaraff[j]][codtab[k][j]]);
for(i=1; i<=nlstate;i++)
fprintf(ficrespl," %.5f", prlim[i][i]);
fprintf(ficrespl,"\n");
} /* Age */
/* was end of cptcod */
} /* cptcov */
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>