|
|
| version 1.324, 2022/07/23 17:44:26 | version 1.328, 2022/07/27 17:40:48 |
|---|---|
| Line 1 | Line 1 |
| /* $Id$ | /* $Id$ |
| $State$ | $State$ |
| $Log$ | $Log$ |
| Revision 1.328 2022/07/27 17:40:48 brouard | |
| Summary: valgrind bug fixed by initializing to zero DummyV as well as Tage | |
| Revision 1.327 2022/07/27 14:47:35 brouard | |
| Summary: Still a problem for one-step probabilities in case of quantitative variables | |
| Revision 1.326 2022/07/26 17:33:55 brouard | |
| Summary: some test with nres=1 | |
| Revision 1.325 2022/07/25 14:27:23 brouard | |
| Summary: r30 | |
| * imach.c (Module): Error cptcovn instead of nsd in bmij (was | |
| coredumped, revealed by Feiuno, thank you. | |
| Revision 1.324 2022/07/23 17:44:26 brouard | Revision 1.324 2022/07/23 17:44:26 brouard |
| *** empty log message *** | *** empty log message *** |
| Line 1051 Important routines | Line 1066 Important routines |
| - Tricode which tests the modality of dummy variables (in order to warn with wrong or empty modalities) | - Tricode which tests the modality of dummy variables (in order to warn with wrong or empty modalities) |
| and returns the number of efficient covariates cptcoveff and modalities nbcode[Tvar[k]][1]= 0 and nbcode[Tvar[k]][2]= 1 usually. | and returns the number of efficient covariates cptcoveff and modalities nbcode[Tvar[k]][1]= 0 and nbcode[Tvar[k]][2]= 1 usually. |
| - printinghtml which outputs results like life expectancy in and from a state for a combination of modalities of dummy variables | - printinghtml which outputs results like life expectancy in and from a state for a combination of modalities of dummy variables |
| o There are 2*cptcoveff combinations of (0,1) for cptcoveff variables. Outputting only combinations with people, eĢliminating 1 1 if | o There are 2**cptcoveff combinations of (0,1) for cptcoveff variables. Outputting only combinations with people, eĢliminating 1 1 if |
| race White (0 0), Black vs White (1 0), Hispanic (0 1) and 1 1 being meaningless. | race White (0 0), Black vs White (1 0), Hispanic (0 1) and 1 1 being meaningless. |
| Line 1188 typedef struct { | Line 1203 typedef struct { |
| #define NINTERVMAX 8 | #define NINTERVMAX 8 |
| #define NLSTATEMAX 8 /**< Maximum number of live states (for func) */ | #define NLSTATEMAX 8 /**< Maximum number of live states (for func) */ |
| #define NDEATHMAX 8 /**< Maximum number of dead states (for func) */ | #define NDEATHMAX 8 /**< Maximum number of dead states (for func) */ |
| #define NCOVMAX 30 /**< Maximum number of covariates, including generated covariates V1*V2 */ | #define NCOVMAX 30 /**< Maximum number of covariates used in the model, including generated covariates V1*V2 or V1*age */ |
| #define codtabm(h,k) (1 & (h-1) >> (k-1))+1 | #define codtabm(h,k) (1 & (h-1) >> (k-1))+1 |
| /*#define decodtabm(h,k,cptcoveff)= (h <= (1<<cptcoveff)?(((h-1) >> (k-1)) & 1) +1 : -1)*/ | /*#define decodtabm(h,k,cptcoveff)= (h <= (1<<cptcoveff)?(((h-1) >> (k-1)) & 1) +1 : -1)*/ |
| #define decodtabm(h,k,cptcoveff) (((h-1) >> (k-1)) & 1) +1 | #define decodtabm(h,k,cptcoveff) (((h-1) >> (k-1)) & 1) +1 |
| Line 3138 double **pmij(double **ps, double *cov, | Line 3153 double **pmij(double **ps, double *cov, |
| ps[i][i]=1./(s1+1.); | ps[i][i]=1./(s1+1.); |
| /* Computing other pijs */ | /* Computing other pijs */ |
| for(j=1; j<i; j++) | for(j=1; j<i; j++) |
| ps[i][j]= exp(ps[i][j])*ps[i][i]; | ps[i][j]= exp(ps[i][j])*ps[i][i];/* Bug valgrind */ |
| for(j=i+1; j<=nlstate+ndeath; j++) | for(j=i+1; j<=nlstate+ndeath; j++) |
| ps[i][j]= exp(ps[i][j])*ps[i][i]; | ps[i][j]= exp(ps[i][j])*ps[i][i]; |
| /* ps[i][nlstate+1]=1.-s1- ps[i][i];*/ /* Sum should be 1 */ | /* ps[i][nlstate+1]=1.-s1- ps[i][i];*/ /* Sum should be 1 */ |
| Line 3196 double **pmij(double **ps, double *cov, | Line 3211 double **pmij(double **ps, double *cov, |
| /* dsavm=pmij(pmmij,cov,ncovmodel,x,nlstate); */ | /* dsavm=pmij(pmmij,cov,ncovmodel,x,nlstate); */ |
| /* P_x */ | /* P_x */ |
| pmmij=pmij(pmmij,cov,ncovmodel,x,nlstate); /*This is forward probability from agefin to agefin + stepm */ | pmmij=pmij(pmmij,cov,ncovmodel,x,nlstate); /*This is forward probability from agefin to agefin + stepm *//* Bug valgrind */ |
| /* outputs pmmij which is a stochastic matrix in row */ | /* outputs pmmij which is a stochastic matrix in row */ |
| /* Diag(w_x) */ | /* Diag(w_x) */ |
| Line 3541 double ***hbxij(double ***po, int nhstep | Line 3556 double ***hbxij(double ***po, int nhstep |
| cov[2]=agexact; | cov[2]=agexact; |
| if(nagesqr==1) | if(nagesqr==1) |
| cov[3]= agexact*agexact; | cov[3]= agexact*agexact; |
| for (k=1; k<=cptcovn;k++){ | for (k=1; k<=nsd;k++){ /* For single dummy covariates only *//* cptcovn error */ |
| /* cov[2+nagesqr+k]=nbcode[Tvar[k]][codtabm(ij,k)]; */ | /* cov[2+nagesqr+k]=nbcode[Tvar[k]][codtabm(ij,k)]; */ |
| /* /\* cov[2+nagesqr+k]=nbcode[Tvar[k]][codtabm(ij,Tvar[k])]; *\/ */ | /* /\* cov[2+nagesqr+k]=nbcode[Tvar[k]][codtabm(ij,Tvar[k])]; *\/ */ |
| cov[2+nagesqr+TvarsDind[k]]=nbcode[TvarsD[k]][codtabm(ij,k)]; | cov[2+nagesqr+TvarsDind[k]]=nbcode[TvarsD[k]][codtabm(ij,k)];/* Bug valgrind */ |
| /* printf("hbxij Dummy agexact=%.0f combi=%d k=%d TvarsD[%d]=V%d TvarsDind[%d]=%d nbcode=%d cov[%d]=%lf codtabm(%d,Tvar[%d])=%d \n",agexact,ij,k, k, TvarsD[k],k,TvarsDind[k],nbcode[TvarsD[k]][codtabm(ij,k)],2+nagesqr+TvarsDind[k],cov[2+nagesqr+TvarsDind[k]], ij, k, codtabm(ij,k)); */ | /* printf("hbxij Dummy agexact=%.0f combi=%d k=%d TvarsD[%d]=V%d TvarsDind[%d]=%d nbcode=%d cov[%d]=%lf codtabm(%d,Tvar[%d])=%d \n",agexact,ij,k, k, TvarsD[k],k,TvarsDind[k],nbcode[TvarsD[k]][codtabm(ij,k)],2+nagesqr+TvarsDind[k],cov[2+nagesqr+TvarsDind[k]], ij, k, codtabm(ij,k)); */ |
| } | } |
| for (k=1; k<=nsq;k++) { /* For single varying covariates only */ | for (k=1; k<=nsq;k++) { /* For single varying covariates only */ |
| Line 3563 double ***hbxij(double ***po, int nhstep | Line 3578 double ***hbxij(double ***po, int nhstep |
| } | } |
| for (k=1; k<=cptcovprod;k++){ /* Useless because included in cptcovn */ | for (k=1; k<=cptcovprod;k++){ /* Useless because included in cptcovn */ |
| cov[2+nagesqr+Tprod[k]]=nbcode[Tvard[k][1]][codtabm(ij,k)]*nbcode[Tvard[k][2]][codtabm(ij,k)]; | cov[2+nagesqr+Tprod[k]]=nbcode[Tvard[k][1]][codtabm(ij,k)]*nbcode[Tvard[k][2]][codtabm(ij,k)]; |
| if(Dummy[Tvard[k][1]==0]){ | |
| if(Dummy[Tvard[k][2]==0]){ | |
| cov[2+nagesqr+Tprod[k]]=nbcode[Tvard[k][1]][codtabm(ij,k)] * nbcode[Tvard[k][2]][codtabm(ij,k)]; | |
| }else{ | |
| cov[2+nagesqr+Tprod[k]]=nbcode[Tvard[k][1]][codtabm(ij,k)] * Tqresult[nres][k]; | |
| } | |
| }else{ | |
| if(Dummy[Tvard[k][2]==0]){ | |
| cov[2+nagesqr+Tprod[k]]=nbcode[Tvard[k][2]][codtabm(ij,k)] * Tqinvresult[nres][Tvard[k][1]]; | |
| }else{ | |
| cov[2+nagesqr+Tprod[k]]=Tqinvresult[nres][Tvard[k][1]]* Tqinvresult[nres][Tvard[k][2]]; | |
| } | |
| } | |
| } | } |
| /*printf("hxi cptcov=%d cptcode=%d\n",cptcov,cptcode);*/ | /*printf("hxi cptcov=%d cptcode=%d\n",cptcov,cptcode);*/ |
| /*printf("h=%d d=%d age=%f cov=%f\n",h,d,age,cov[2]);*/ | /*printf("h=%d d=%d age=%f cov=%f\n",h,d,age,cov[2]);*/ |
| Line 3572 double ***hbxij(double ***po, int nhstep | Line 3600 double ***hbxij(double ***po, int nhstep |
| /* out=matprod2(newm, bmij(pmmij,cov,ncovmodel,x,nlstate,prevacurrent, dnewm, doldm, dsavm,ij),\ */ | /* out=matprod2(newm, bmij(pmmij,cov,ncovmodel,x,nlstate,prevacurrent, dnewm, doldm, dsavm,ij),\ */ |
| /* 1,nlstate+ndeath,1,nlstate+ndeath,1,nlstate+ndeath, oldm); */ | /* 1,nlstate+ndeath,1,nlstate+ndeath,1,nlstate+ndeath, oldm); */ |
| out=matprod2(newm, bmij(pmmij,cov,ncovmodel,x,nlstate,prevacurrent,ij),\ | out=matprod2(newm, bmij(pmmij,cov,ncovmodel,x,nlstate,prevacurrent,ij),\ |
| 1,nlstate+ndeath,1,nlstate+ndeath,1,nlstate+ndeath, oldm); | 1,nlstate+ndeath,1,nlstate+ndeath,1,nlstate+ndeath, oldm);/* Bug valgrind */ |
| /* if((int)age == 70){ */ | /* if((int)age == 70){ */ |
| /* printf(" Backward hbxij age=%d agexact=%f d=%d nhstepm=%d hstepm=%d\n", (int) age, agexact, d, nhstepm, hstepm); */ | /* printf(" Backward hbxij age=%d agexact=%f d=%d nhstepm=%d hstepm=%d\n", (int) age, agexact, d, nhstepm, hstepm); */ |
| /* for(i=1; i<=nlstate+ndeath; i++) { */ | /* for(i=1; i<=nlstate+ndeath; i++) { */ |
| Line 6800 void varprob(char optionfilefiname[], do | Line 6828 void varprob(char optionfilefiname[], do |
| int k2, l2, j1, z1; | int k2, l2, j1, z1; |
| int k=0, l; | int k=0, l; |
| int first=1, first1, first2; | int first=1, first1, first2; |
| int nres=0; /* New */ | |
| double cv12, mu1, mu2, lc1, lc2, v12, v21, v11, v22,v1,v2, c12, tnalp; | double cv12, mu1, mu2, lc1, lc2, v12, v21, v11, v22,v1,v2, c12, tnalp; |
| double **dnewm,**doldm; | double **dnewm,**doldm; |
| double *xp; | double *xp; |
| Line 6888 To be simple, these graphs help to under | Line 6917 To be simple, these graphs help to under |
| if (cptcovn<1) {tj=1;ncodemax[1]=1;} | if (cptcovn<1) {tj=1;ncodemax[1]=1;} |
| j1=0; | j1=0; |
| for(j1=1; j1<=tj;j1++){ /* For each valid combination of covariates or only once*/ | for(j1=1; j1<=tj;j1++){ /* For each valid combination of covariates or only once*/ |
| for(nres=1;nres <=1; nres++){ /* For each resultline */ | |
| /* for(nres=1;nres <=nresult; nres++){ /\* For each resultline *\/ */ | |
| if (cptcovn>0) { | if (cptcovn>0) { |
| fprintf(ficresprob, "\n#********** Variable "); | fprintf(ficresprob, "\n#********** Variable "); |
| for (z1=1; z1<=cptcoveff; z1++) fprintf(ficresprob, "V%d=%d ",Tvaraff[z1],nbcode[Tvaraff[z1]][codtabm(j1,z1)]); | for (z1=1; z1<=cptcoveff; z1++) fprintf(ficresprob, "V%d=%d ",Tvaraff[z1],nbcode[Tvaraff[z1]][codtabm(j1,z1)]); |
| Line 6923 To be simple, these graphs help to under | Line 6954 To be simple, these graphs help to under |
| cov[2]=age; | cov[2]=age; |
| if(nagesqr==1) | if(nagesqr==1) |
| cov[3]= age*age; | cov[3]= age*age; |
| for (k=1; k<=cptcovn;k++) { | /* for (k=1; k<=cptcovn;k++) { */ |
| cov[2+nagesqr+k]=nbcode[Tvar[k]][codtabm(j1,k)]; | /* cov[2+nagesqr+k]=nbcode[Tvar[k]][codtabm(j1,k)]; */ |
| for (k=1; k<=nsd;k++) { /* For single dummy covariates only */ | |
| /* Here comes the value of the covariate 'j1' after renumbering k with single dummy covariates */ | |
| cov[2+nagesqr+TvarsDind[k]]=nbcode[TvarsD[k]][codtabm(j1,k)]; | |
| /*cov[2+nagesqr+k]=nbcode[Tvar[k]][codtabm(j1,Tvar[k])];*//* j1 1 2 3 4 | /*cov[2+nagesqr+k]=nbcode[Tvar[k]][codtabm(j1,Tvar[k])];*//* j1 1 2 3 4 |
| * 1 1 1 1 1 | * 1 1 1 1 1 |
| * 2 2 1 1 1 | * 2 2 1 1 1 |
| Line 6935 To be simple, these graphs help to under | Line 6969 To be simple, these graphs help to under |
| /* V2+V1+V4+V3*age Tvar[4]=3 ; V1+V2*age Tvar[2]=2; V1+V1*age Tvar[2]=1, Tage[1]=2 */ | /* V2+V1+V4+V3*age Tvar[4]=3 ; V1+V2*age Tvar[2]=2; V1+V1*age Tvar[2]=1, Tage[1]=2 */ |
| /* ) p nbcode[Tvar[Tage[k]]][(1 & (ij-1) >> (k-1))+1] */ | /* ) p nbcode[Tvar[Tage[k]]][(1 & (ij-1) >> (k-1))+1] */ |
| /*for (k=1; k<=cptcovage;k++) cov[2+Tage[k]]=cov[2+Tage[k]]*cov[2]; */ | /*for (k=1; k<=cptcovage;k++) cov[2+Tage[k]]=cov[2+Tage[k]]*cov[2]; */ |
| for (k=1; k<=cptcovage;k++) | for (k=1; k<=cptcovage;k++){ /* For product with age */ |
| cov[2+Tage[k]+nagesqr]=nbcode[Tvar[Tage[k]]][codtabm(ij,k)]*cov[2]; | if(Dummy[Tage[k]]==2){ /* dummy with age */ |
| for (k=1; k<=cptcovprod;k++) | cov[2+nagesqr+Tage[k]]=nbcode[Tvar[Tage[k]]][codtabm(j1,k)]*cov[2]; |
| cov[2+nagesqr+Tprod[k]]=nbcode[Tvard[k][1]][codtabm(ij,k)]*nbcode[Tvard[k][2]][codtabm(ij,k)]; | /* cov[++k1]=nbcode[Tvar[Tage[k]]][codtabm(ij,k)]*cov[2]; */ |
| } else if(Dummy[Tage[k]]==3){ /* quantitative with age */ | |
| printf("Internal IMaCh error, don't know which value for quantitative covariate with age, Tage[k]%d, k=%d, Tvar[Tage[k]]=V%d, age=%d\n",Tage[k],k ,Tvar[Tage[k]], (int)cov[2]); | |
| exit(1); | |
| /* cov[2+nagesqr+Tage[k]]=meanq[k]/idq[k]*cov[2];/\* Using the mean of quantitative variable Tvar[Tage[k]] /\* Tqresult[nres][k]; *\/ */ | |
| /* cov[++k1]=Tqresult[nres][k]; */ | |
| } | |
| /* cov[2+Tage[k]+nagesqr]=nbcode[Tvar[Tage[k]]][codtabm(ij,k)]*cov[2]; */ | |
| } | |
| for (k=1; k<=cptcovprod;k++){/* For product without age */ | |
| if(Dummy[Tvard[k][1]==0]){ | |
| if(Dummy[Tvard[k][2]==0]){ | |
| cov[2+nagesqr+Tprod[k]]=nbcode[Tvard[k][1]][codtabm(j1,k)] * nbcode[Tvard[k][2]][codtabm(j1,k)]; | |
| /* cov[++k1]=nbcode[Tvard[k][1]][codtabm(ij,k)] * nbcode[Tvard[k][2]][codtabm(ij,k)]; */ | |
| }else{ /* Should we use the mean of the quantitative variables? */ | |
| cov[2+nagesqr+Tprod[k]]=nbcode[Tvard[k][1]][codtabm(j1,k)] * Tqresult[nres][k]; | |
| /* cov[++k1]=nbcode[Tvard[k][1]][codtabm(ij,k)] * Tqresult[nres][k]; */ | |
| } | |
| }else{ | |
| if(Dummy[Tvard[k][2]==0]){ | |
| cov[2+nagesqr+Tprod[k]]=nbcode[Tvard[k][2]][codtabm(j1,k)] * Tqinvresult[nres][Tvard[k][1]]; | |
| /* cov[++k1]=nbcode[Tvard[k][2]][codtabm(ij,k)] * Tqinvresult[nres][Tvard[k][1]]; */ | |
| }else{ | |
| cov[2+nagesqr+Tprod[k]]=Tqinvresult[nres][Tvard[k][1]]* Tqinvresult[nres][Tvard[k][2]]; | |
| /* cov[++k1]=Tqinvresult[nres][Tvard[k][1]]* Tqinvresult[nres][Tvard[k][2]]; */ | |
| } | |
| } | |
| /* cov[2+nagesqr+Tprod[k]]=nbcode[Tvard[k][1]][codtabm(ij,k)]*nbcode[Tvard[k][2]][codtabm(ij,k)]; */ | |
| } | |
| /* For each age and combination of dummy covariates we slightly move the parameters of delti in order to get the gradient*/ | |
| for(theta=1; theta <=npar; theta++){ | for(theta=1; theta <=npar; theta++){ |
| for(i=1; i<=npar; i++) | for(i=1; i<=npar; i++) |
| xp[i] = x[i] + (i==theta ?delti[theta]:(double)0); | xp[i] = x[i] + (i==theta ?delti[theta]:(double)0); |
| Line 7125 To be simple, these graphs help to under | Line 7186 To be simple, these graphs help to under |
| } /* k12 */ | } /* k12 */ |
| } /*l1 */ | } /*l1 */ |
| }/* k1 */ | }/* k1 */ |
| } /* loop on nres */ | |
| } /* loop on combination of covariates j1 */ | } /* loop on combination of covariates j1 */ |
| free_ma3x(varpij,1,nlstate,1,nlstate+ndeath,(int) bage, (int)fage); | free_ma3x(varpij,1,nlstate,1,nlstate+ndeath,(int) bage, (int)fage); |
| free_matrix(mu,1,(nlstate+ndeath)*(nlstate+ndeath),(int) bage, (int)fage); | free_matrix(mu,1,(nlstate+ndeath)*(nlstate+ndeath),(int) bage, (int)fage); |
| Line 8349 set ter svg size 640, 480\nunset log y\n | Line 8411 set ter svg size 640, 480\nunset log y\n |
| for(j=1; j <=cptcovt; j++) { /* For each covariate of the simplified model */ | for(j=1; j <=cptcovt; j++) { /* For each covariate of the simplified model */ |
| /* printf("Tage[%d]=%d, j=%d\n", ij, Tage[ij], j); */ | /* printf("Tage[%d]=%d, j=%d\n", ij, Tage[ij], j); */ |
| if(cptcovage >0){ /* V5+V4+V3+V4*V3+V5*age+V2+V1*V2+V1*age+V1, 2 V5 and V1 */ | if(cptcovage >0){ /* V5+V4+V3+V4*V3+V5*age+V2+V1*V2+V1*age+V1, 2 V5 and V1 */ |
| if(j==Tage[ij]) { /* Product by age To be looked at!!*/ | if(j==Tage[ij]) { /* Product by age To be looked at!!*//* Bug valgrind */ |
| if(ij <=cptcovage) { /* V5+V4+V3+V4*V3+V5*age+V2+V1*V2+V1*age+V1, 2 V5 and V1 */ | if(ij <=cptcovage) { /* V5+V4+V3+V4*V3+V5*age+V2+V1*V2+V1*age+V1, 2 V5 and V1 */ |
| if(DummyV[j]==0){ | if(DummyV[j]==0){/* Bug valgrind */ |
| fprintf(ficgp,"+p%d*%d*x",i+j+2+nagesqr-1,Tinvresult[nres][Tvar[j]]);; | fprintf(ficgp,"+p%d*%d*x",i+j+2+nagesqr-1,Tinvresult[nres][Tvar[j]]);; |
| }else{ /* quantitative */ | }else{ /* quantitative */ |
| fprintf(ficgp,"+p%d*%f*x",i+j+2+nagesqr-1,Tqinvresult[nres][Tvar[j]]); /* Tqinvresult in decoderesult */ | fprintf(ficgp,"+p%d*%f*x",i+j+2+nagesqr-1,Tqinvresult[nres][Tvar[j]]); /* Tqinvresult in decoderesult */ |
| Line 9541 int readdata(char datafile[], int firsto | Line 9603 int readdata(char datafile[], int firsto |
| DummyV=ivector(1,NCOVMAX); /* 1 to 3 */ | DummyV=ivector(1,NCOVMAX); /* 1 to 3 */ |
| FixedV=ivector(1,NCOVMAX); /* 1 to 3 */ | FixedV=ivector(1,NCOVMAX); /* 1 to 3 */ |
| for(v=1;v<NCOVMAX;v++){ | |
| DummyV[v]=0; | |
| FixedV[v]=0; | |
| } | |
| for(v=1; v <=ncovcol;v++){ | for(v=1; v <=ncovcol;v++){ |
| DummyV[v]=0; | DummyV[v]=0; |
| Line 11180 int hPijx(double *p, int bage, int fage) | Line 11246 int hPijx(double *p, int bage, int fage) |
| /* oldm=oldms;savm=savms; */ | /* oldm=oldms;savm=savms; */ |
| /* hbxij(p3mat,nhstepm,agedeb,hstepm,p,nlstate,stepm,oldm,savm, k); */ | /* hbxij(p3mat,nhstepm,agedeb,hstepm,p,nlstate,stepm,oldm,savm, k); */ |
| hbxij(p3mat,nhstepm,agedeb,hstepm,p,prevacurrent,nlstate,stepm, k, nres); | hbxij(p3mat,nhstepm,agedeb,hstepm,p,prevacurrent,nlstate,stepm, k, nres);/* Bug valgrind */ |
| /* hbxij(p3mat,nhstepm,agedeb,hstepm,p,prevacurrent,nlstate,stepm,oldm,savm, dnewm, doldm, dsavm, k); */ | /* hbxij(p3mat,nhstepm,agedeb,hstepm,p,prevacurrent,nlstate,stepm,oldm,savm, dnewm, doldm, dsavm, k); */ |
| fprintf(ficrespijb,"# Cov Agex agex-h hbijx with i,j="); | fprintf(ficrespijb,"# Cov Agex agex-h hbijx with i,j="); |
| for(i=1; i<=nlstate;i++) | for(i=1; i<=nlstate;i++) |
| Line 11193 int hPijx(double *p, int bage, int fage) | Line 11259 int hPijx(double *p, int bage, int fage) |
| /* fprintf(ficrespijb,"%d %3.f %3.f",k, agedeb, agedeb + h*hstepm/YEARM*stepm ); */ | /* fprintf(ficrespijb,"%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(ficrespijb," %.5f", p3mat[i][j][h]); | fprintf(ficrespijb," %.5f", p3mat[i][j][h]);/* Bug valgrind */ |
| fprintf(ficrespijb,"\n"); | fprintf(ficrespijb,"\n"); |
| } | } |
| free_ma3x(p3mat,1,nlstate+ndeath,1, nlstate+ndeath, 0,nhstepm); | free_ma3x(p3mat,1,nlstate+ndeath,1, nlstate+ndeath, 0,nhstepm); |
| Line 11878 Please run with mle=-1 to get a correct | Line 11944 Please run with mle=-1 to get a correct |
| } | } |
| mint=matrix(1,maxwav,firstobs,lastobs); | mint=matrix(1,maxwav,firstobs,lastobs); |
| anint=matrix(1,maxwav,firstobs,lastobs); | anint=matrix(1,maxwav,firstobs,lastobs); |
| s=imatrix(1,maxwav+1,firstobs,lastobs); /* s[i][j] health state for wave i and individual j */ | s=imatrix(1,maxwav+1,firstobs,lastobs); /* s[i][j] health state for wave i and individual j */ |
| printf("BUG ncovmodel=%d NCOVMAX=%d 2**ncovmodel=%f BUG\n",ncovmodel,NCOVMAX,pow(2,ncovmodel)); | |
| tab=ivector(1,NCOVMAX); | tab=ivector(1,NCOVMAX); |
| ncodemax=ivector(1,NCOVMAX); /* Number of code per covariate; if O and 1 only, 2**ncov; V1+V2+V3+V4=>16 */ | ncodemax=ivector(1,NCOVMAX); /* Number of code per covariate; if O and 1 only, 2**ncov; V1+V2+V3+V4=>16 */ |
| ncodemaxwundef=ivector(1,NCOVMAX); /* Number of code per covariate; if - 1 O and 1 only, 2**ncov; V1+V2+V3+V4=>16 */ | ncodemaxwundef=ivector(1,NCOVMAX); /* Number of code per covariate; if - 1 O and 1 only, 2**ncov; V1+V2+V3+V4=>16 */ |
| Line 11942 Please run with mle=-1 to get a correct | Line 12009 Please run with mle=-1 to get a correct |
| Tage=ivector(1,NCOVMAX); /* Gives the covariate id of covariates associated with age: V2 + V1 + age*V4 + V3*age | Tage=ivector(1,NCOVMAX); /* Gives the covariate id of covariates associated with age: V2 + V1 + age*V4 + V3*age |
| 4 covariates (3 plus signs) | 4 covariates (3 plus signs) |
| Tage[1=V3*age]= 4; Tage[2=age*V4] = 3 | Tage[1=V3*age]= 4; Tage[2=age*V4] = 3 |
| */ | */ |
| for(i=1;i<NCOVMAX;i++) | |
| Tage[i]=0; | |
| Tmodelind=ivector(1,NCOVMAX);/** gives the k model position of an | Tmodelind=ivector(1,NCOVMAX);/** gives the k model position of an |
| * individual dummy, fixed or varying: | * individual dummy, fixed or varying: |
| * Tmodelind[Tvaraff[3]]=9,Tvaraff[1]@9={4, | * Tmodelind[Tvaraff[3]]=9,Tvaraff[1]@9={4, |