Diff for /imach/src/imach.c between versions 1.284 and 1.285

version 1.284, 2018/04/20 05:22:13 version 1.285, 2018/04/21 21:02:16
Line 1 Line 1
 /* $Id$  /* $Id$
   $State$    $State$
   $Log$    $Log$
     Revision 1.285  2018/04/21 21:02:16  brouard
     Summary: Some bugs fixed, valgrind tested
   
   Revision 1.284  2018/04/20 05:22:13  brouard    Revision 1.284  2018/04/20 05:22:13  brouard
   Summary: Computing mean and stdeviation of fixed quantitative variables    Summary: Computing mean and stdeviation of fixed quantitative variables
   
Line 4640  Title=%s <br>Datafile=%s Firstpass=%d La Line 4643  Title=%s <br>Datafile=%s Firstpass=%d La
         Printing means of quantitative variables if any          Printing means of quantitative variables if any
       */        */
       for (z1=1; z1<= nqfveff; z1++) {        for (z1=1; z1<= nqfveff; z1++) {
         fprintf(ficlog,"Mean of quantitative variable V%d on %.0f individuals sum=%f", ncovcol+z1, idq[z1], meanq[z1]);          fprintf(ficlog,"Mean of fixed quantitative variable V%d on %.0f individuals sum=%f", ncovcol+z1, idq[z1], meanq[z1]);
         fprintf(ficlog,", mean=%.3g\n",meanq[z1]/idq[z1]);          fprintf(ficlog,", mean=%.3g\n",meanq[z1]/idq[z1]);
         if(weightopt==1){          if(weightopt==1){
           printf(" Weighted mean and standard deviation of");            printf(" Weighted mean and standard deviation of");
           fprintf(ficlog," Weighted mean and standard deviation of");            fprintf(ficlog," Weighted mean and standard deviation of");
           fprintf(ficresphtmfr," Weighted mean and standard deviation of");            fprintf(ficresphtmfr," Weighted mean and standard deviation of");
         }          }
         printf(" quantitative variable V%d on %.0f representatives of the population : %6.3g (%6.3g)\n", ncovcol+z1, idq[z1],meanq[z1]/idq[z1], sqrt((stdq[z1]-meanq[z1]*meanq[z1]/idq[z1])/idq[z1]));          printf(" fixed quantitative variable V%d on %.0f representatives of the population : %6.3g (%6.3g)\n", ncovcol+z1, idq[z1],meanq[z1]/idq[z1], sqrt((stdq[z1]-meanq[z1]*meanq[z1]/idq[z1])/idq[z1]));
         fprintf(ficlog," quantitative variable V%d on %.0f representatives of the population : %6.3g (%6.3g)\n", ncovcol+z1, idq[z1],meanq[z1]/idq[z1], sqrt((stdq[z1]-meanq[z1]*meanq[z1]/idq[z1])/idq[z1]));          fprintf(ficlog," fixed quantitative variable V%d on %.0f representatives of the population : %6.3g (%6.3g)\n", ncovcol+z1, idq[z1],meanq[z1]/idq[z1], sqrt((stdq[z1]-meanq[z1]*meanq[z1]/idq[z1])/idq[z1]));
         fprintf(ficresphtmfr," quantitative variable V%d on %.0f representatives of the population : %6.3g (%6.3g)<p>\n", ncovcol+z1, idq[z1],meanq[z1]/idq[z1], sqrt((stdq[z1]-meanq[z1]*meanq[z1]/idq[z1])/idq[z1]));          fprintf(ficresphtmfr," fixed quantitative variable V%d on %.0f representatives of the population : %6.3g (%6.3g)<p>\n", ncovcol+z1, idq[z1],meanq[z1]/idq[z1], sqrt((stdq[z1]-meanq[z1]*meanq[z1]/idq[z1])/idq[z1]));
       }        }
       /* for (z1=1; z1<= nqtveff; z1++) { */        /* for (z1=1; z1<= nqtveff; z1++) { */
       /*        for(m=1;m<=lastpass;m++){ */        /*        for(m=1;m<=lastpass;m++){ */
Line 5355  void  concatwav(int wav[], int **dh, int Line 5358  void  concatwav(int wav[], int **dh, int
    /* *cptcov=0; */     /* *cptcov=0; */
     
    for (k=1; k <= maxncov; k++) ncodemax[k]=0; /* Horrible constant again replaced by NCOVMAX */     for (k=1; k <= maxncov; k++) ncodemax[k]=0; /* Horrible constant again replaced by NCOVMAX */
      for (k=1; k <= maxncov; k++)
        for(j=1; j<=2; j++)
          nbcode[k][j]=0; /* Valgrind */
   
    /* Loop on covariates without age and products and no quantitative variable */     /* Loop on covariates without age and products and no quantitative variable */
    /* for (j=1; j<=(cptcovs); j++) { /\* From model V1 + V2*age+ V3 + V3*V4 keeps V1 + V3 = 2 only *\/ */     /* for (j=1; j<=(cptcovs); j++) { /\* From model V1 + V2*age+ V3 + V3*V4 keeps V1 + V3 = 2 only *\/ */
Line 9730  Dummy[k] 0=dummy (0 1), 1 quantitative ( Line 9736  Dummy[k] 0=dummy (0 1), 1 quantitative (
 Typevar: 0 for simple covariate (dummy, quantitative, fixed or varying), 1 for age product, 2 for  product \n\  Typevar: 0 for simple covariate (dummy, quantitative, fixed or varying), 1 for age product, 2 for  product \n\
 Fixed[k] 0=fixed (product or simple), 1 varying, 2 fixed with age product, 3 varying with age product \n\  Fixed[k] 0=fixed (product or simple), 1 varying, 2 fixed with age product, 3 varying with age product \n\
 Dummy[k] 0=dummy (0 1), 1 quantitative (single or product without age), 2 dummy with age product, 3 quant with age product\n",model);  Dummy[k] 0=dummy (0 1), 1 quantitative (single or product without age), 2 dummy with age product, 3 quant with age product\n",model);
   for(k=1;k<=cptcovt; k++){ Fixed[k]=0; Dummy[k]=0;}    for(k=-1;k<=cptcovt; k++){ Fixed[k]=0; Dummy[k]=0;}
   for(k=1, ncovf=0, nsd=0, nsq=0, ncovv=0, ncova=0, ncoveff=0, nqfveff=0, ntveff=0, nqtveff=0;k<=cptcovt; k++){ /* or cptocvt */    for(k=1, ncovf=0, nsd=0, nsq=0, ncovv=0, ncova=0, ncoveff=0, nqfveff=0, ntveff=0, nqtveff=0;k<=cptcovt; k++){ /* or cptocvt */
     if (Tvar[k] <=ncovcol && Typevar[k]==0 ){ /* Simple fixed dummy (<=ncovcol) covariates */      if (Tvar[k] <=ncovcol && Typevar[k]==0 ){ /* Simple fixed dummy (<=ncovcol) covariates */
       Fixed[k]= 0;        Fixed[k]= 0;
Line 9980  Dummy[k] 0=dummy (0 1), 1 quantitative ( Line 9986  Dummy[k] 0=dummy (0 1), 1 quantitative (
   /* Searching for doublons in the model */    /* Searching for doublons in the model */
   for(k1=1; k1<= cptcovt;k1++){    for(k1=1; k1<= cptcovt;k1++){
     for(k2=1; k2 <k1;k2++){      for(k2=1; k2 <k1;k2++){
       if((Typevar[k1]==Typevar[k2]) && (Fixed[Tvar[k1]]==Fixed[Tvar[k2]]) && (Dummy[Tvar[k1]]==Dummy[Tvar[k2]] )){        /* if((Typevar[k1]==Typevar[k2]) && (Fixed[Tvar[k1]]==Fixed[Tvar[k2]]) && (Dummy[Tvar[k1]]==Dummy[Tvar[k2]] )){ */
         if((Typevar[k1]==Typevar[k2]) && (Fixed[k1]==Fixed[k2]) && (Dummy[k1]==Dummy[k2] )){
         if((Typevar[k1] == 0 || Typevar[k1] == 1)){ /* Simple or age product */          if((Typevar[k1] == 0 || Typevar[k1] == 1)){ /* Simple or age product */
           if(Tvar[k1]==Tvar[k2]){            if(Tvar[k1]==Tvar[k2]){
             printf("Error duplication in the model=%s at positions (+) %d and %d, Tvar[%d]=V%d, Tvar[%d]=V%d, Typevar=%d, Fixed=%d, Dummy=%d\n", model, k1,k2, k1, Tvar[k1], k2, Tvar[k2],Typevar[k1],Fixed[Tvar[k1]],Dummy[Tvar[k1]]);              printf("Error duplication in the model=%s at positions (+) %d and %d, Tvar[%d]=V%d, Tvar[%d]=V%d, Typevar=%d, Fixed=%d, Dummy=%d\n", model, k1,k2, k1, Tvar[k1], k2, Tvar[k2],Typevar[k1],Fixed[k1],Dummy[k1]);
             fprintf(ficlog,"Error duplication in the model=%s at positions (+) %d and %d, Tvar[%d]=V%d, Tvar[%d]=V%d, Typevar=%d, Fixed=%d, Dummy=%d\n", model, k1,k2, k1, Tvar[k1], k2, Tvar[k2],Typevar[k1],Fixed[Tvar[k1]],Dummy[Tvar[k1]]); fflush(ficlog);              fprintf(ficlog,"Error duplication in the model=%s at positions (+) %d and %d, Tvar[%d]=V%d, Tvar[%d]=V%d, Typevar=%d, Fixed=%d, Dummy=%d\n", model, k1,k2, k1, Tvar[k1], k2, Tvar[k2],Typevar[k1],Fixed[k1],Dummy[k1]); fflush(ficlog);
             return(1);              return(1);
           }            }
         }else if (Typevar[k1] ==2){          }else if (Typevar[k1] ==2){

Removed from v.1.284  
changed lines
  Added in v.1.285


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