1: /*------------- h Pij x at various ages ------------*/
2:
3: strcpy(filerespij,"pij"); strcat(filerespij,fileres);
4: if((ficrespij=fopen(filerespij,"w"))==NULL) {
5: printf("Problem with Pij resultfile: %s\n", filerespij);goto end;
6: fprintf(ficlog,"Problem with Pij resultfile: %s\n", filerespij);goto end;
7: }
8: printf("Computing pij: result on file '%s' \n", filerespij);
9: fprintf(ficlog,"Computing pij: result on file '%s' \n", filerespij);
10:
11: stepsize=(int) (stepm+YEARM-1)/YEARM;
12: /*if (stepm<=24) stepsize=2;*/
13:
14: agelim=AGESUP;
15: hstepm=stepsize*YEARM; /* Every year of age */
16: hstepm=hstepm/stepm; /* Typically 2 years, = 2/6 months = 4 */
17:
18: /* hstepm=1; aff par mois*/
19: pstamp(ficrespij);
20: fprintf(ficrespij,"#****** h Pij x Probability to be in state j at age x+h being in i at x ");
21: i1=pow(2,cptcoveff);
22: for(cptcov=1,k=0;cptcov<=i1;cptcov++){
23: /*for(cptcod=1;cptcod<=ncodemax[cptcov];cptcod++){*/
24: k=k+1;
25: fprintf(ficrespij,"\n#****** ");
26: for(j=1;j<=cptcoveff;j++)
27: fprintf(ficrespij,"V%d=%d ",Tvaraff[j],nbcode[Tvaraff[j]][codtab[k][j]]);
28: fprintf(ficrespij,"******\n");
29:
30: for (agedeb=fage; agedeb>=bage; agedeb--){ /* If stepm=6 months */
31: nhstepm=(int) rint((agelim-agedeb)*YEARM/stepm); /* Typically 20 years = 20*12/6=40 */
32: nhstepm = nhstepm/hstepm; /* Typically 40/4=10 */
33:
34: /* nhstepm=nhstepm*YEARM; aff par mois*/
35:
36: p3mat=ma3x(1,nlstate+ndeath,1, nlstate+ndeath, 0,nhstepm);
37: oldm=oldms;savm=savms;
38: hpxij(p3mat,nhstepm,agedeb,hstepm,p,nlstate,stepm,oldm,savm, k);
39: fprintf(ficrespij,"# Cov Agex agex+h hpijx with i,j=");
40: for(i=1; i<=nlstate;i++)
41: for(j=1; j<=nlstate+ndeath;j++)
42: fprintf(ficrespij," %1d-%1d",i,j);
43: fprintf(ficrespij,"\n");
44: for (h=0; h<=nhstepm; h++){
45: fprintf(ficrespij,"%d %3.f %3.f",k,agedeb, agedeb+ h*hstepm/YEARM*stepm );
46: for(i=1; i<=nlstate;i++)
47: for(j=1; j<=nlstate+ndeath;j++)
48: fprintf(ficrespij," %.5f", p3mat[i][j][h]);
49: fprintf(ficrespij,"\n");
50: }
51: free_ma3x(p3mat,1,nlstate+ndeath,1, nlstate+ndeath, 0,nhstepm);
52: fprintf(ficrespij,"\n");
53: }
54: /*}*/
55: }
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>