--- imach/src/imach.c 2018/04/20 05:22:13 1.284 +++ imach/src/imach.c 2018/04/21 21:02:16 1.285 @@ -1,6 +1,9 @@ -/* $Id: imach.c,v 1.284 2018/04/20 05:22:13 brouard Exp $ +/* $Id: imach.c,v 1.285 2018/04/21 21:02:16 brouard Exp $ $State: Exp $ $Log: imach.c,v $ + 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 Summary: Computing mean and stdeviation of fixed quantitative variables @@ -1057,12 +1060,12 @@ typedef struct { #define ODIRSEPARATOR '\\' #endif -/* $Id: imach.c,v 1.284 2018/04/20 05:22:13 brouard Exp $ */ +/* $Id: imach.c,v 1.285 2018/04/21 21:02:16 brouard Exp $ */ /* $State: Exp $ */ #include "version.h" char version[]=__IMACH_VERSION__; char copyright[]="April 2018,INED-EUROREVES-Institut de longevite-Japan Society for the Promotion of Science (Grant-in-Aid for Scientific Research 25293121), Intel Software 2015-2018"; -char fullversion[]="$Revision: 1.284 $ $Date: 2018/04/20 05:22:13 $"; +char fullversion[]="$Revision: 1.285 $ $Date: 2018/04/21 21:02:16 $"; char strstart[80]; char optionfilext[10], optionfilefiname[FILENAMELENGTH]; int erreur=0, nberr=0, nbwarn=0; /* Error number, number of errors number of warnings */ @@ -4640,16 +4643,16 @@ Title=%s
Datafile=%s Firstpass=%d La Printing means of quantitative variables if any */ 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]); if(weightopt==1){ printf(" Weighted mean and standard deviation of"); fprintf(ficlog," 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])); - 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(ficresphtmfr," 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," 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," 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])); } /* for (z1=1; z1<= nqtveff; z1++) { */ /* for(m=1;m<=lastpass;m++){ */ @@ -5355,6 +5358,9 @@ void concatwav(int wav[], int **dh, int /* *cptcov=0; */ 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 */ /* for (j=1; j<=(cptcovs); j++) { /\* From model V1 + V2*age+ V3 + V3*V4 keeps V1 + V3 = 2 only *\/ */ @@ -9730,7 +9736,7 @@ 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\ 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); - 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 */ if (Tvar[k] <=ncovcol && Typevar[k]==0 ){ /* Simple fixed dummy (<=ncovcol) covariates */ Fixed[k]= 0; @@ -9980,11 +9986,12 @@ Dummy[k] 0=dummy (0 1), 1 quantitative ( /* Searching for doublons in the model */ for(k1=1; k1<= cptcovt;k1++){ for(k2=1; k2