--- imach/src/imach.c 2015/07/16 16:49:02 1.192 +++ imach/src/imach.c 2015/08/04 07:17:42 1.193 @@ -1,6 +1,9 @@ -/* $Id: imach.c,v 1.192 2015/07/16 16:49:02 brouard Exp $ +/* $Id: imach.c,v 1.193 2015/08/04 07:17:42 brouard Exp $ $State: Exp $ $Log: imach.c,v $ + Revision 1.193 2015/08/04 07:17:42 brouard + Summary: 0.98q4 + Revision 1.192 2015/07/16 16:49:02 brouard Summary: Fixing some outputs @@ -693,11 +696,11 @@ typedef struct { #define ODIRSEPARATOR '\\' #endif -/* $Id: imach.c,v 1.192 2015/07/16 16:49:02 brouard Exp $ */ +/* $Id: imach.c,v 1.193 2015/08/04 07:17:42 brouard Exp $ */ /* $State: Exp $ */ -char version[]="Imach version 0.98q3, July 2015,INED-EUROREVES-Institut de longevite-Japan Society for the Promotion of Science (Grant-in-Aid for Scientific Research 25293121), Intel Software 2015"; -char fullversion[]="$Revision: 1.192 $ $Date: 2015/07/16 16:49:02 $"; +char version[]="Imach version 0.98q4, July 2015,INED-EUROREVES-Institut de longevite-Japan Society for the Promotion of Science (Grant-in-Aid for Scientific Research 25293121), Intel Software 2015"; +char fullversion[]="$Revision: 1.193 $ $Date: 2015/08/04 07:17:42 $"; char strstart[80]; char optionfilext[10], optionfilefiname[FILENAMELENGTH]; int erreur=0, nberr=0, nbwarn=0; /* Error number, number of errors number of warnings */ @@ -4536,12 +4539,12 @@ fprintf(fichtm," \n"); - fprintf(fichtm,"\ \n
  • Result files (second order: variances)

    \n\ - - Parameter file with estimated parameters and covariance matrix: %s
    \n", rfileres,rfileres); + - Parameter file with estimated parameters and covariance matrix: %s
    \ + - 95%% confidence intervals and T statistics are in the log file.
    \n", rfileres,rfileres); - fprintf(fichtm," - Variance of one-step probabilities: %s
    \n", + fprintf(fichtm," - Standard deviation of one-step probabilities: %s
    \n", subdirf2(fileres,"prob"),subdirf2(fileres,"prob")); fprintf(fichtm,"\ - Variance-covariance of one-step probabilities: %s
    \n", @@ -6561,7 +6564,7 @@ int main(int argc, char *argv[]) if(jj==i) continue; j++; fscanf(ficpar,"%1d%1d",&i1,&j1); - if ((i1 != i) && (j1 != j)){ + if ((i1 != i) || (j1 != jj)){ printf("Error in line parameters number %d, %1d%1d instead of %1d%1d \n \ It might be a problem of design; if ncovcol and the model are correct\n \ run imach with mle=-1 to get a correct template of the parameter file.\n",numlinepar, i,j, i1, j1); @@ -6569,8 +6572,8 @@ run imach with mle=-1 to get a correct t } fprintf(ficparo,"%1d%1d",i1,j1); if(mle==1) - printf("%1d%1d",i,j); - fprintf(ficlog,"%1d%1d",i,j); + printf("%1d%1d",i,jj); + fprintf(ficlog,"%1d%1d",i,jj); for(k=1; k<=ncovmodel;k++){ fscanf(ficpar," %lf",¶m[i][j][k]); if(mle==1){ @@ -7111,9 +7114,10 @@ Interval (in months) between two waves: } printf("iter=%d MLE=%f Eq=%lf*exp(%lf*(age-%d))\n",iter,-gompertz(p),p[1],p[2],agegomp); - for (i=1;i<=NDIM;i++) + for (i=1;i<=NDIM;i++) { printf("%f [%f ; %f]\n",p[i],p[i]-2*sqrt(matcov[i][i]),p[i]+2*sqrt(matcov[i][i])); - + fprintf(ficlog,"%f [%f ; %f]\n",p[i],p[i]-2*sqrt(matcov[i][i]),p[i]+2*sqrt(matcov[i][i])); + } lsurv=vector(1,AGESUP); lpop=vector(1,AGESUP); tpop=vector(1,AGESUP); @@ -7210,6 +7214,24 @@ Interval (in months) between two waves: ftolhess=ftol; /* Usually correct */ hesscov(matcov, p, npar, delti, ftolhess, func); } + printf("Parameters and 95%% confidence intervals\n"); + fprintf(ficlog, "Parameters, T and confidence intervals\n"); + for(i=1,jk=1; i <=nlstate; i++){ + for(k=1; k <=(nlstate+ndeath); k++){ + if (k != i) { + printf("%d%d ",i,k); + fprintf(ficlog,"%d%d ",i,k); + for(j=1; j <=ncovmodel; j++){ + printf("%12.7f T=%8.3f CI=[%12.7f ; %12.7f] ",p[jk], p[jk]/sqrt(matcov[jk][jk]), p[jk]-2*sqrt(matcov[jk][jk]),p[jk]+2*sqrt(matcov[jk][jk])); + fprintf(ficlog,"%12.7f T=%8.3f CI=[%12.7f ; %12.7f] ",p[jk], p[jk]/sqrt(matcov[jk][jk]), p[jk]-2*sqrt(matcov[jk][jk]),p[jk]+2*sqrt(matcov[jk][jk])); + jk++; + } + printf("\n"); + fprintf(ficlog,"\n"); + } + } + } + fprintf(ficres,"# Scales (for hessian or gradient estimation)\n"); printf("# Scales (for hessian or gradient estimation)\n"); fprintf(ficlog,"# Scales (for hessian or gradient estimation)\n"); @@ -7366,6 +7388,7 @@ Interval (in months) between two waves: dateprev2=anprev2+(mprev2-1)/12.+(jprev2-1)/365.; fscanf(ficpar,"pop_based=%d\n",&popbased); + fprintf(ficlog,"pop_based=%d\n",popbased); fprintf(ficparo,"pop_based=%d\n",popbased); fprintf(ficres,"pop_based=%d\n",popbased);