--- imach/src/imach.c 2024/06/28 09:31:55 1.363 +++ imach/src/imach.c 2024/06/28 13:53:38 1.365 @@ -1,6 +1,12 @@ -/* $Id: imach.c,v 1.363 2024/06/28 09:31:55 brouard Exp $ +/* $Id: imach.c,v 1.365 2024/06/28 13:53:38 brouard Exp $ $State: Exp $ $Log: imach.c,v $ + Revision 1.365 2024/06/28 13:53:38 brouard + * imach.c (Module): fixing some bugs in gnuplot and quantitative variables, but not completely solved + + Revision 1.364 2024/06/28 12:27:05 brouard + * imach.c (Module): fixing some bugs in gnuplot and quantitative variables, but not completely solved + Revision 1.363 2024/06/28 09:31:55 brouard Summary: Adding log lines too @@ -1248,7 +1254,7 @@ Important routines - 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. - 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, eliminating 1 1 if race White (0 0), Black vs White (1 0), Hispanic (0 1) and 1 1 being meaningless. @@ -1413,12 +1419,12 @@ double gnuplotversion=GNUPLOTVERSION; #define ODIRSEPARATOR '\\' #endif -/* $Id: imach.c,v 1.363 2024/06/28 09:31:55 brouard Exp $ */ +/* $Id: imach.c,v 1.365 2024/06/28 13:53:38 brouard Exp $ */ /* $State: Exp $ */ #include "version.h" char version[]=__IMACH_VERSION__; char copyright[]="April 2024,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-2024"; -char fullversion[]="$Revision: 1.363 $ $Date: 2024/06/28 09:31:55 $"; +char fullversion[]="$Revision: 1.365 $ $Date: 2024/06/28 13:53:38 $"; char strstart[80]; char optionfilext[10], optionfilefiname[FILENAMELENGTH]; int erreur=0, nberr=0, nbwarn=0; /* Error number, number of errors number of warnings */ @@ -3023,6 +3029,7 @@ static void print2() /* print a line of /* printf("%10d %10d%14.7g",nl, nf, fx); */ /* printf ( "\n" ); */ printf ( " Linear searches %d", nl ); + fprintf (ficlog, " Linear searches %d", nl ); /* printf ( " Linear searches %d\n", nl ); */ /* printf ( " Function evaluations %d\n", nf ); */ /* printf ( " Function value FX = %g\n", fx ); */ @@ -3038,8 +3045,8 @@ static void print2() /* print a line of { /* for(i=1;i<=n;i++)printf("%14.7g",x[i-1]); */ for(i=1;i<=n;i++){ - printf("%14.7g",x[i]); - fprintf(ficlog,"%14.7g",x[i]); + printf(" %14.7g",x[i]); + fprintf(ficlog," %14.7g",x[i]); } /* r8vec_print ( n, x, " X:" ); */ } @@ -6613,7 +6620,7 @@ void mlikeli(FILE *ficres,double p[], in #else /* FLATSUP */ /* powell(p,xi,npar,ftol,&iter,&fret,func);*/ /* praxis ( t0, h0, n, prin, x, beale_f ); */ - /* int prin=1; */ + int prin=4; /* double h0=0.25; */ /* double macheps; */ /* double fmin; */ @@ -9989,7 +9996,9 @@ void printinggnuplot(char fileresu[], ch char dirfileres[256],optfileres[256]; char gplotcondition[256], gplotlabel[256]; int cpt=0,k1=0,i=0,k=0,j=0,jk=0,k2=0,k3=0,k4=0,kf=0,kvar=0,kk=0,ipos=0,iposold=0,ij=0, ijp=0, l=0; - int lv=0, vlv=0, kl=0; + /* int lv=0, vlv=0, kl=0; */ + int lv=0, kl=0; + double vlv=0; int ng=0; int vpopbased; int ioffset; /* variable offset for columns */ @@ -10787,8 +10796,9 @@ set ter svg size 640, 480\nunset log y\n /* vlv= nbcode[Tvaraff[k]][lv]; /\* Value of the modality of Tvaraff[k] *\/ */ /* vlv= nbcode[Tvaraff[k]][codtabm(k1,TnsdVar[Tvaraff[k]])]; */ kl++; + /* Problem with quantitative variables TinvDoQresult[nres] */ /* sprintf(gplotcondition+strlen(gplotcondition),"$%d==%d && $%d==%d " ,kl,Tvaraff[k], kl+1, nbcode[Tvaraff[k]][lv]); */ - sprintf(gplotcondition+strlen(gplotcondition),"$%d==%d && $%d==%d " ,kl,lv, kl+1, vlv ); + sprintf(gplotcondition+strlen(gplotcondition),"$%d==%d && $%d==%lg " ,kl,lv, kl+1, vlv );/* Solved but quantitative must be shifted */ kl++; if(k 1) sprintf(gplotcondition+strlen(gplotcondition)," && "); @@ -10802,7 +10812,9 @@ set ter svg size 640, 480\nunset log y\n fprintf(ficgp,"%s ? $%d/(1.-$%d) : 1/0):%d t 'p.%d' with line lc variable", gplotcondition, \ ioffset+(cpt-1)*(nlstate+1)+1+(i-1), ioffset+1+(i-1)+(nlstate+1)*nlstate,iyearc, cpt ); fprintf(ficgp,",\\\n '' "); - fprintf(ficgp," u %d:(",iagec); + fprintf(ficgp," u %d:(",iagec); /* Below iyearc should be increades if quantitative variable in the reult line */ + /* $7==6 && $8==2.47 ) && (($9-$10) == 1953 ) ? $12/(1.-$24) : 1/0):7 with labels center not */ + /* but was && $7==6 && $8==2 ) && (($7-$8) == 1953 ) ? $12/(1.-$24) : 1/0):7 with labels center not */ fprintf(ficgp,"%s && (($%d-$%d) == %d ) ? $%d/(1.-$%d) : 1/0):%d with labels center not ", gplotcondition, \ iyearc, iagec, offyear, \ ioffset+(cpt-1)*(nlstate+1)+1+(i-1), ioffset+1+(i-1)+(nlstate+1)*nlstate, iyearc ); @@ -15879,7 +15891,7 @@ Interval (in months) between two waves: #else free_ivector(flatdir,1,npar); #endif /* LINMINORIGINAL*/ - +#endif /* POWELL */ hesscov(matcov, hess, p, NDIM, delti, 1e-4, gompertz); for(i=1; i <=NDIM; i++)