/*------------- h Pij x at various ages ------------*/ strcpy(filerespij,"pij"); strcat(filerespij,fileres); if((ficrespij=fopen(filerespij,"w"))==NULL) { printf("Problem with Pij resultfile: %s\n", filerespij);goto end; fprintf(ficlog,"Problem with Pij resultfile: %s\n", filerespij);goto end; } printf("Computing pij: result on file '%s' \n", filerespij); fprintf(ficlog,"Computing pij: result on file '%s' \n", filerespij); stepsize=(int) (stepm+YEARM-1)/YEARM; /*if (stepm<=24) stepsize=2;*/ agelim=AGESUP; hstepm=stepsize*YEARM; /* Every year of age */ hstepm=hstepm/stepm; /* Typically 2 years, = 2/6 months = 4 */ /* hstepm=1; aff par mois*/ pstamp(ficrespij); fprintf(ficrespij,"#****** h Pij x Probability to be in state j at age x+h being in i at x "); i1=pow(2,cptcoveff); for(cptcov=1,k=0;cptcov<=i1;cptcov++){ /*for(cptcod=1;cptcod<=ncodemax[cptcov];cptcod++){*/ k=k+1; fprintf(ficrespij,"\n#****** "); for(j=1;j<=cptcoveff;j++) fprintf(ficrespij,"V%d=%d ",Tvaraff[j],nbcode[Tvaraff[j]][codtab[k][j]]); fprintf(ficrespij,"******\n"); for (agedeb=fage; agedeb>=bage; agedeb--){ /* If stepm=6 months */ nhstepm=(int) rint((agelim-agedeb)*YEARM/stepm); /* Typically 20 years = 20*12/6=40 */ nhstepm = nhstepm/hstepm; /* Typically 40/4=10 */ /* nhstepm=nhstepm*YEARM; aff par mois*/ p3mat=ma3x(1,nlstate+ndeath,1, nlstate+ndeath, 0,nhstepm); oldm=oldms;savm=savms; hpxij(p3mat,nhstepm,agedeb,hstepm,p,nlstate,stepm,oldm,savm, k); fprintf(ficrespij,"# Cov Agex agex+h hpijx with i,j="); for(i=1; i<=nlstate;i++) for(j=1; j<=nlstate+ndeath;j++) fprintf(ficrespij," %1d-%1d",i,j); fprintf(ficrespij,"\n"); for (h=0; h<=nhstepm; h++){ fprintf(ficrespij,"%d %3.f %3.f",k,agedeb, agedeb+ h*hstepm/YEARM*stepm ); for(i=1; i<=nlstate;i++) for(j=1; j<=nlstate+ndeath;j++) fprintf(ficrespij," %.5f", p3mat[i][j][h]); fprintf(ficrespij,"\n"); } free_ma3x(p3mat,1,nlstate+ndeath,1, nlstate+ndeath, 0,nhstepm); fprintf(ficrespij,"\n"); } /*}*/ }