Diff for /imach/src/imach.c between versions 1.362 and 1.365

version 1.362, 2024/06/28 08:00:31 version 1.365, 2024/06/28 13:53:38
Line 1 Line 1
 /* $Id$  /* $Id$
   $State$    $State$
   $Log$    $Log$
     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
   
   Revision 1.362  2024/06/28 08:00:31  brouard    Revision 1.362  2024/06/28 08:00:31  brouard
   Summary: 0.99s6    Summary: 0.99s6
   
Line 1245  Important routines Line 1254  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, eliminating 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 3018  static void print2() /* print a line of Line 3027  static void print2() /* print a line of
    /* printf("... after %u function calls ...\n", nf); */     /* printf("... after %u function calls ...\n", nf); */
    /* printf("... including %u linear searches ...\n", nl); */     /* printf("... including %u linear searches ...\n", nl); */
    /* printf("%10d    %10d%14.7g",nl, nf, fx); */     /* printf("%10d    %10d%14.7g",nl, nf, fx); */
   printf ( "\n" );    /* printf ( "\n" ); */
   printf ( "  Linear searches      %d", nl );    printf ( "  Linear searches      %d", nl );
     fprintf (ficlog, "  Linear searches      %d", nl );
   /* printf ( "  Linear searches      %d\n", nl ); */    /* printf ( "  Linear searches      %d\n", nl ); */
   /* printf ( "  Function evaluations %d\n", nf ); */    /* printf ( "  Function evaluations %d\n", nf ); */
   /* printf ( "  Function value FX = %g\n", fx ); */    /* printf ( "  Function value FX = %g\n", fx ); */
   printf ( "  Function evaluations %d", nf );    printf ( "  Function evaluations %d", nf );
   printf ( "  Function value FX = %.12lf\n", fx );    printf ( "  Function value FX = %.12lf\n", fx );
     fprintf (ficlog, "  Function evaluations %d", nf );
     fprintf (ficlog, "  Function value FX = %.12lf\n", fx );
 #ifdef DEBUGPRAX  #ifdef DEBUGPRAX
    printf("n=%d prin=%d\n",n,prin);     printf("n=%d prin=%d\n",n,prin);
 #endif  #endif
    if(fx <= fmin) printf(" UNDEFINED "); else  printf("%14.7g",log(fx-fmin));     /* if(fx <= fmin) printf(" UNDEFINED "); else  printf("%14.7g",log(fx-fmin)); */
    if ( n <= 4 || 2 < prin )     if ( n <= 4 || 2 < prin )
    {     {
      /* for(i=1;i<=n;i++)printf("%14.7g",x[i-1]); */       /* for(i=1;i<=n;i++)printf("%14.7g",x[i-1]); */
      for(i=1;i<=n;i++)printf("%14.7g",x[i]);       for(i=1;i<=n;i++){
          printf(" %14.7g",x[i]);
          fprintf(ficlog," %14.7g",x[i]);
        }
      /* r8vec_print ( n, x, "  X:" ); */       /* r8vec_print ( n, x, "  X:" ); */
    }     }
    printf("\n");     printf("\n");
      fprintf(ficlog,"\n");
  }   }
   
   
Line 6604  void mlikeli(FILE *ficres,double p[], in Line 6620  void mlikeli(FILE *ficres,double p[], in
 #else  /* FLATSUP */  #else  /* FLATSUP */
 /*  powell(p,xi,npar,ftol,&iter,&fret,func);*/  /*  powell(p,xi,npar,ftol,&iter,&fret,func);*/
 /*   praxis ( t0, h0, n, prin, x, beale_f ); */  /*   praxis ( t0, h0, n, prin, x, beale_f ); */
   /* int prin=1; */   int prin=4;
   /* double h0=0.25; */    /* double h0=0.25; */
   /* double macheps; */    /* double macheps; */
   /* double fmin; */    /* double fmin; */
Line 9980  void printinggnuplot(char fileresu[], ch Line 9996  void printinggnuplot(char fileresu[], ch
   char dirfileres[256],optfileres[256];    char dirfileres[256],optfileres[256];
   char gplotcondition[256], gplotlabel[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 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 ng=0;
   int vpopbased;    int vpopbased;
   int ioffset; /* variable offset for columns */    int ioffset; /* variable offset for columns */
Line 10778  set ter svg size 640, 480\nunset log y\n Line 10796  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]][lv]; /\* Value of the modality of Tvaraff[k] *\/ */
               /* vlv= nbcode[Tvaraff[k]][codtabm(k1,TnsdVar[Tvaraff[k]])]; */                /* vlv= nbcode[Tvaraff[k]][codtabm(k1,TnsdVar[Tvaraff[k]])]; */
               kl++;                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,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++;                kl++;
               if(k <cptcovs && cptcovs>1)                if(k <cptcovs && cptcovs>1)
                 sprintf(gplotcondition+strlen(gplotcondition)," && ");                  sprintf(gplotcondition+strlen(gplotcondition)," && ");
Line 10793  set ter svg size 640, 480\nunset log y\n Line 10812  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, \                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 );                        ioffset+(cpt-1)*(nlstate+1)+1+(i-1),  ioffset+1+(i-1)+(nlstate+1)*nlstate,iyearc, cpt );
               fprintf(ficgp,",\\\n '' ");                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, \                fprintf(ficgp,"%s && (($%d-$%d) == %d ) ? $%d/(1.-$%d) : 1/0):%d with labels center not ", gplotcondition, \
                       iyearc, iagec, offyear,                           \                        iyearc, iagec, offyear,                           \
                       ioffset+(cpt-1)*(nlstate+1)+1+(i-1),  ioffset+1+(i-1)+(nlstate+1)*nlstate, iyearc );                        ioffset+(cpt-1)*(nlstate+1)+1+(i-1),  ioffset+1+(i-1)+(nlstate+1)*nlstate, iyearc );
Line 15870  Interval (in months) between two waves: Line 15891  Interval (in months) between two waves:
 #else  #else
       free_ivector(flatdir,1,npar);         free_ivector(flatdir,1,npar); 
 #endif  /* LINMINORIGINAL*/  #endif  /* LINMINORIGINAL*/
       #endif /* POWELL */   
     hesscov(matcov, hess, p, NDIM, delti, 1e-4, gompertz);       hesscov(matcov, hess, p, NDIM, delti, 1e-4, gompertz); 
   
     for(i=1; i <=NDIM; i++)      for(i=1; i <=NDIM; i++)

Removed from v.1.362  
changed lines
  Added in v.1.365


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>