--- imach/src/imach.c 2015/09/30 17:45:14 1.203 +++ imach/src/imach.c 2015/10/01 16:20:26 1.204 @@ -1,6 +1,9 @@ -/* $Id: imach.c,v 1.203 2015/09/30 17:45:14 brouard Exp $ +/* $Id: imach.c,v 1.204 2015/10/01 16:20:26 brouard Exp $ $State: Exp $ $Log: imach.c,v $ + Revision 1.204 2015/10/01 16:20:26 brouard + Summary: Some new graphs of contribution to likelihood + Revision 1.203 2015/09/30 17:45:14 brouard Summary: looking at better estimation of the hessian @@ -745,12 +748,12 @@ typedef struct { #define ODIRSEPARATOR '\\' #endif -/* $Id: imach.c,v 1.203 2015/09/30 17:45:14 brouard Exp $ */ +/* $Id: imach.c,v 1.204 2015/10/01 16:20:26 brouard Exp $ */ /* $State: Exp $ */ #include "version.h" char version[]=__IMACH_VERSION__; -char copyright[]="September 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.203 $ $Date: 2015/09/30 17:45:14 $"; +char copyright[]="October 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.204 $ $Date: 2015/10/01 16:20:26 $"; char strstart[80]; char optionfilext[10], optionfilefiname[FILENAMELENGTH]; int erreur=0, nberr=0, nbwarn=0; /* Error number, number of errors number of warnings */ @@ -2652,9 +2655,17 @@ void likelione(FILE *ficres,double p[], if(*globpri !=0){ fclose(ficresilk); fprintf(fichtm,"\n
File of contributions to the likelihood computed with initial parameters and mle >= 1. You should at least run with mle >= 1 and starting values corresponding to the optimized parameters in order to visualize the real contribution of each individual/wave: %s
\n",subdirf(fileresilk),subdirf(fileresilk)); - fprintf(fichtm,"
- The first 3 individuals are drawn with lines. The function drawn is -2Log(L) in log scale: %s.png
\ -",subdirf2(optionfilefiname,"ILK_"),subdirf2(optionfilefiname,"ILK_"),subdirf2(optionfilefiname,"ILK_")); + fprintf(fichtm,"
- The function drawn is -2Log(L) in Log scale: by state of origin %s-ori.png
\ +",subdirf2(optionfilefiname,"ILK_"),subdirf2(optionfilefiname,"ILK_"),subdirf2(optionfilefiname,"ILK_")); + fprintf(fichtm,"
- and by state of destination %s-dest.png
\ +",subdirf2(optionfilefiname,"ILK_"),subdirf2(optionfilefiname,"ILK_"),subdirf2(optionfilefiname,"ILK_")); fflush(fichtm); + + for (k=1; k<= nlstate ; k++) { + fprintf(fichtm,"
- Probability p%dj by origin %d and destination j %s-p%dj.png
\ +",k,k,subdirf2(optionfilefiname,"ILK_"),k,subdirf2(optionfilefiname,"ILK_"),k,subdirf2(optionfilefiname,"ILK_"),k); + + } } return; } @@ -4863,13 +4874,26 @@ void printinggnuplot(char fileresu[], ch fprintf(ficgp,"\n set log y; unset log x;set xlabel \"Age\"; set ylabel \"Likelihood (-2Log(L))\";"); /* fprintf(ficgp,"\nset ter svg size 640, 480"); */ /* Too big for svg */ fprintf(ficgp,"\nset ter png size 640, 480"); -/* good for mle=4 plot by number of matrix products. +/* nice for mle=4 plot by number of matrix products. replot "rrtest1/toto.txt" u 2:($4 == 1 && $5==2 ? $9 : 1/0):5 t "p12" with point lc 1 */ /* replot exp(p1+p2*x)/(1+exp(p1+p2*x)+exp(p3+p4*x)+exp(p5+p6*x)) t "p12(x)" */ /* fprintf(ficgp,"\nset out \"%s.svg\";",subdirf2(optionfilefiname,"ILK_")); */ - fprintf(ficgp,"\nset out \"%s.png\";",subdirf2(optionfilefiname,"ILK_")); - fprintf(ficgp,"\nplot \"%s\" u 2:(-$11):3 t \"All sample, all transitions\" with dots lc variable",subdirf(fileresilk)); - fprintf(ficgp,"\nreplot \"%s\" u 2:($3 <= 3 ? -$11 : 1/0):3 t \"First 3 individuals\" with line lc variable", subdirf(fileresilk)); + fprintf(ficgp,"\nset out \"%s-dest.png\";",subdirf2(optionfilefiname,"ILK_")); + fprintf(ficgp,"\nset log y;plot \"%s\" u 2:(-$11):5 t \"All sample, transitions colored by destination\" with dots lc variable; set out;\n",subdirf(fileresilk)); + fprintf(ficgp,"\nset out \"%s-ori.png\";",subdirf2(optionfilefiname,"ILK_")); + fprintf(ficgp,"\nset log y;plot \"%s\" u 2:(-$11):4 t \"All sample, transitions colored by origin\" with dots lc variable; set out;\n\n",subdirf(fileresilk)); + for (i=1; i<= nlstate ; i ++) { + fprintf(ficgp,"\nset out \"%s-p%dj.png\";set ylabel \"Probability for each individual/wave\";",subdirf2(optionfilefiname,"ILK_"),i); + fprintf(ficgp,"unset log;\n plot \"%s\"",subdirf(fileresilk)); + fprintf(ficgp," u 2:($4 == %d && $5==%d ? $9 : 1/0):5 t \"p%d%d\" with points lc variable \\\n",i,1,i,1); + for (j=2; j<= nlstate+ndeath ; j ++) { + fprintf(ficgp,", \"\" u 2:($4 == %d && $5==%d ? $9 : 1/0):5 t \"p%d%d\" with points lc variable ",i,j,i,j); + } + fprintf(ficgp,";\nset out; unset ylabel;\n"); + } + /* unset log; plot "rrtest1_sorted_4/ILK_rrtest1_sorted_4.txt" u 2:($4 == 1 && $5==2 ? $9 : 1/0):5 t "p12" with points lc variable */ + /* fprintf(ficgp,"\nset log y;plot \"%s\" u 2:(-$11):3 t \"All sample, all transitions\" with dots lc variable",subdirf(fileresilk)); */ + /* fprintf(ficgp,"\nreplot \"%s\" u 2:($3 <= 3 ? -$11 : 1/0):3 t \"First 3 individuals\" with line lc variable", subdirf(fileresilk)); */ fprintf(ficgp,"\nset out;unset log\n"); /* fprintf(ficgp,"\nset out \"%s.svg\"; replot; set out; # bug gnuplot",subdirf2(optionfilefiname,"ILK_")); */ @@ -7319,7 +7343,7 @@ Please run with mle=-1 to get a correct printf("Problem with file %s",optionfilegnuplot); } else{ - fprintf(ficgp,"\n# %s\n", version); + fprintf(ficgp,"\n# IMaCh-%s\n", version); fprintf(ficgp,"# %s\n", optionfilegnuplot); //fprintf(ficgp,"set missing 'NaNq'\n"); fprintf(ficgp,"set datafile missing 'NaNq'\n"); @@ -7346,13 +7370,15 @@ Please run with mle=-1 to get a correct else{ fprintf(fichtmcov,"\nIMaCh Cov %s\n %s
%s
\
\n\ -Title=%s
Datafile=%s Firstpass=%d Lastpass=%d Stepm=%d Weight=%d Model=%s
\n",\ +Title=%s
Datafile=%s Firstpass=%d Lastpass=%d Stepm=%d Weight=%d Model=1+age+%s
\n",\ optionfilehtmcov,version,fullversion,title,datafile,firstpass,lastpass,stepm, weightopt, model); } - fprintf(fichtm,"\nIMaCh %s\n %s
%s
\ + fprintf(fichtm,"\n\n\nIMaCh %s\n IMaCh for Interpolated Markov Chain
\nSponsored by Copyright (C) 2002-2015 INED-EUROREVES-Institut de longévité-Japan Society for the Promotion of Sciences 日本学術振興会 (Grant-in-Aid for Scientific Research 25293121) - Intel Software 2015
\ +
\n\ +IMaCh-%s
%s
\
\n\ -Title=%s
Datafile=%s Firstpass=%d Lastpass=%d Stepm=%d Weight=%d Model=%s
\n\ +Title=%s
Datafile=%s Firstpass=%d Lastpass=%d Stepm=%d Weight=%d Model=1+age+%s
\n\ \n\
\