--- imach/src/imach.c 2022/06/02 04:45:11 1.319 +++ imach/src/imach.c 2022/07/22 12:04:24 1.321 @@ -1,6 +1,14 @@ -/* $Id: imach.c,v 1.319 2022/06/02 04:45:11 brouard Exp $ +/* $Id: imach.c,v 1.321 2022/07/22 12:04:24 brouard Exp $ $State: Exp $ $Log: imach.c,v $ + Revision 1.321 2022/07/22 12:04:24 brouard + Summary: r28 + + * imach.c (Module): Output of Wald test in the htm file and not only in the log. + + Revision 1.320 2022/06/02 05:10:11 brouard + *** empty log message *** + Revision 1.319 2022/06/02 04:45:11 brouard * imach.c (Module): Adding the Wald tests from the log to the main htm for better display of the maximum likelihood estimators. @@ -1195,12 +1203,12 @@ typedef struct { #define ODIRSEPARATOR '\\' #endif -/* $Id: imach.c,v 1.319 2022/06/02 04:45:11 brouard Exp $ */ +/* $Id: imach.c,v 1.321 2022/07/22 12:04:24 brouard Exp $ */ /* $State: Exp $ */ #include "version.h" char version[]=__IMACH_VERSION__; char copyright[]="May 2022,INED-EUROREVES-Institut de longevite-Japan Society for the Promotion of Science (Grant-in-Aid for Scientific Research 25293121), Intel Software 2015-2020, Nihon University 2021-202, INED 2000-2022"; -char fullversion[]="$Revision: 1.319 $ $Date: 2022/06/02 04:45:11 $"; +char fullversion[]="$Revision: 1.321 $ $Date: 2022/07/22 12:04:24 $"; char strstart[80]; char optionfilext[10], optionfilefiname[FILENAMELENGTH]; int erreur=0, nberr=0, nbwarn=0; /* Error number, number of errors number of warnings */ @@ -1422,7 +1430,7 @@ int **nbcode, *Tvar; /**< model=V2 => Tv /* Tage[cptcovage]=k 5 8 */ /* Position in the model of ith cov*age */ /* Tvard[1][1]@4={4,3,1,2} V4*V3 V1*V2 */ /* Position in model of the ith prod without age */ /* TvarF TvarF[1]=Tvar[6]=2, TvarF[2]=Tvar[7]=7, TvarF[3]=Tvar[9]=1 ID of fixed covariates or product V2, V1*V2, V1 */ -/* TvarFind; /**< TvarFind[1]=6, TvarFind[2]=7, TvarFind[3]=9 *//* Inverse V2(6) is first fixed (single or prod) */ +/* TvarFind; TvarFind[1]=6, TvarFind[2]=7, TvarFind[3]=9 *//* Inverse V2(6) is first fixed (single or prod) */ /* Type */ /* V 1 2 3 4 5 */ /* F F V V V */ @@ -3645,7 +3653,7 @@ double func( double *x) /* # V1=sex, V2=raedyrs Quant Fixed, State=livarnb4..livarnb11, V3=iadl4..iald11, V4=adlw4..adlw11, V5=r4bmi..r11bmi */ /* V5+V4+V3+V4*V3+V5*age+V2+V1*V2+V1*age+V1 */ /* TvarF[1]=Tvar[6]=2, TvarF[2]=Tvar[7]=7, TvarF[3]=Tvar[9]=1 ID of fixed covariates or product V2, V1*V2, V1 */ - /* TvarFind; /**< TvarFind[1]=6, TvarFind[2]=7, TvarFind[3]=9 *//* Inverse V2(6) is first fixed (single or prod) */ + /* TvarFind; TvarFind[1]=6, TvarFind[2]=7, TvarFind[3]=9 *//* Inverse V2(6) is first fixed (single or prod) */ cov[ioffset+TvarFind[k]]=covar[Tvar[TvarFind[k]]][i];/* V5+V4+V3+V4*V3+V5*age+V2+V1*V2+V1*age+V1, only V1 is fixed (TvarFind[1]=6)*/ /* V1*V2 (7) TvarFind[2]=7, TvarFind[3]=9 */ } @@ -6118,9 +6126,9 @@ void concatwav(int wav[], int **dh, int varhe[ij][ji][(int)age] += doldm[ij][ji]*hf*hf; } } - if((int)age ==50){ - printf(" age=%d cij=%d nres=%d varhe[%d][%d]=%f ",(int)age, cij, nres, 1,2,varhe[1][2]); - } + /* if((int)age ==50){ */ + /* printf(" age=%d cij=%d nres=%d varhe[%d][%d]=%f ",(int)age, cij, nres, 1,2,varhe[1][2]); */ + /* } */ /* Computing expectancies */ hpxij(p3matm,nhstepm,age,hstepm,x,nlstate,stepm,oldm, savm, cij,nres); for(i=1; i<=nlstate;i++) @@ -7237,7 +7245,7 @@ void printinghtml(char fileresu[], char } /* if(nqfveff+nqtveff 0) */ /* Test to be done */ - fprintf(fichtm," ************\n
"); + fprintf(fichtm," (model=%s) ************\n
",model); if(invalidvarcomb[k1]){ fprintf(fichtm,"\n

Combination (%d) ignored because no cases

\n",k1); printf("\nCombination (%d) ignored because no cases \n",k1); @@ -7424,7 +7432,7 @@ See page 'Matrix of variance-covariance fprintf(fichtm," V%d=%f ",Tvqresult[nres][k4],Tqresult[nres][k4]); } - fprintf(fichtm," ************\n
"); + fprintf(fichtm," (model=%s) ************\n
",model); if(invalidvarcomb[k1]){ fprintf(fichtm,"\n

Combination (%d) ignored because no cases

\n",k1); @@ -7560,7 +7568,7 @@ void printinggnuplot(char fileresu[], ch fprintf(ficgp,"\nset out \"%s_%d-%d-%d.svg\" \n",subdirf2(optionfilefiname,"V_"),cpt,k1,nres); fprintf(ficgp,"\n#set out \"V_%s_%d-%d-%d.svg\" \n",optionfilefiname,cpt,k1,nres); /* fprintf(ficgp,"set label \"Alive state %d %s\" at graph 0.98,0.5 center rotate font \"Helvetica,12\"\n",cpt,gplotlabel); */ - fprintf(ficgp,"set title \"Alive state %d %s\" font \"Helvetica,12\"\n",cpt,gplotlabel); + fprintf(ficgp,"set title \"Alive state %d %s model=%s\" font \"Helvetica,12\"\n",cpt,gplotlabel,model); fprintf(ficgp,"set xlabel \"Age\" \nset ylabel \"Probability\" \nset ter svg size 640, 480\nplot [%.f:%.f] \"%s\" every :::%d::%d u 1:($2==%d ? $3:1/0) \"%%lf %%lf",ageminpar,fage,subdirf2(fileresu,"VPL_"),nres-1,nres-1,nres); /* fprintf(ficgp,"set xlabel \"Age\" \nset ylabel \"Probability\" \nset ter svg size 640, 480\nplot [%.f:%.f] \"%s\" every :::%d::%d u 1:($2==%d ? $3:1/0) \"%%lf %%lf",ageminpar,fage,subdirf2(fileresu,"VPL_"),k1-1,k1-1,nres); */ /* k1-1 error should be nres-1*/ @@ -12548,6 +12556,7 @@ Please run with mle=-1 to get a correct hesscov(matcov, hess, p, npar, delti, ftolhess, func); printf("Parameters and 95%% confidence intervals\n W is simply the result of the division of the parameter by the square root of covariance of the parameter.\n And Wald-based confidence intervals plus and minus 1.96 * W .\n But be careful that parameters are highly correlated because incidence of disability is highly correlated to incidence of recovery.\n It might be better to visualize the covariance matrix. See the page 'Matrix of variance-covariance of one-step probabilities' and its graphs.\n"); fprintf(ficlog, "Parameters, Wald tests and Wald-based confidence intervals\n W is simply the result of the division of the parameter by the square root of covariance of the parameter.\n And Wald-based confidence intervals plus and minus 1.96 * W \n It might be better to visualize the covariance matrix. See the page 'Matrix of variance-covariance of one-step probabilities' and its graphs.\n"); + fprintf(fichtm, "\n

Parameters, Wald tests and Wald-based confidence intervals\n
W is simply the result of the division of the parameter by the square root of covariance of the parameter.\n
And Wald-based confidence intervals plus and minus 1.96 * W \n
It might be better to visualize the covariance matrix. See the page 'Matrix of variance-covariance of one-step probabilities' and its graphs.\n
"); fprintf(fichtm,"\n"); fprintf(fichtm, "\n"); if(nagesqr==1){ @@ -12578,15 +12587,14 @@ Please run with mle=-1 to get a correct fprintf(fichtm, "",i,k); for(j=1; j <=ncovmodel; j++){ wald=p[jk]/sqrt(matcov[jk][jk]); - printf("%12.7f(%12.7f) W=%8.3f CI=[%12.7f ; %12.7f] ",p[jk],sqrt(matcov[jk][jk]), p[jk]/sqrt(matcov[jk][jk]), p[jk]-1.96*sqrt(matcov[jk][jk]),p[jk]+1.96*sqrt(matcov[jk][jk])); - fprintf(ficlog,"%12.7f(%12.7f) W=%8.3f CI=[%12.7f ; %12.7f] ",p[jk],sqrt(matcov[jk][jk]), p[jk]/sqrt(matcov[jk][jk]), p[jk]-1.96*sqrt(matcov[jk][jk]),p[jk]+1.96*sqrt(matcov[jk][jk])); + printf("%12.7f(%12.7f) sqrt(W)=%8.3f CI=[%12.7f ; %12.7f] ",p[jk],sqrt(matcov[jk][jk]), p[jk]/sqrt(matcov[jk][jk]), p[jk]-1.96*sqrt(matcov[jk][jk]),p[jk]+1.96*sqrt(matcov[jk][jk])); + fprintf(ficlog,"%12.7f(%12.7f) sqrt(W)=%8.3f CI=[%12.7f ; %12.7f] ",p[jk],sqrt(matcov[jk][jk]), p[jk]/sqrt(matcov[jk][jk]), p[jk]-1.96*sqrt(matcov[jk][jk]),p[jk]+1.96*sqrt(matcov[jk][jk])); if(fabs(wald) > 1.96){ - fprintf(fichtm, "", p[jk]-1.96*sqrt(matcov[jk][jk]),p[jk]+1.96*sqrt(matcov[jk][jk])); jk++; } @@ -13188,9 +13196,9 @@ Please run with mle=-1 to get a correct for(k=1; k<=i1;k++){ /* For any combination of dummy covariates, fixed and varying */ if(i1 != 1 && TKresult[nres]!= k) continue; - printf("\n#****** Result for:"); - fprintf(ficrest,"\n#****** Result for:"); - fprintf(ficlog,"\n#****** Result for:"); + printf("\n# model %s \n#****** Result for:", model); + fprintf(ficrest,"\n# model %s \n#****** Result for:", model); + fprintf(ficlog,"\n# model %s \n#****** Result for:", model); for(j=1;j<=cptcoveff;j++){ printf("V%d=%d ",Tvaraff[j],nbcode[Tvaraff[j]][codtabm(k,j)]); fprintf(ficrest,"V%d=%d ",Tvaraff[j],nbcode[Tvaraff[j]][codtabm(k,j)]);
Model=1+ age%1d%1d%12.7f (%12.7f)
",p[jk],sqrt(matcov[jk][jk])); - fprintf(fichtm,"W=%8.3f
",wald); + fprintf(fichtm, "
%12.7f
(%12.7f)
",p[jk],sqrt(matcov[jk][jk])); }else{ fprintf(fichtm, "
%12.7f (%12.7f)
",p[jk],sqrt(matcov[jk][jk])); - fprintf(fichtm,"W=%8.3f
",wald); } + fprintf(fichtm,"sqrt(W)=%8.3f
",wald); fprintf(fichtm,"[%12.7f;%12.7f]