Diff for /imach/src/imach.c between versions 1.270 and 1.271

version 1.270, 2017/05/24 05:45:29 version 1.271, 2017/06/27 10:17:50
Line 1 Line 1
 /* $Id$  /* $Id$
   $State$    $State$
   $Log$    $Log$
     Revision 1.271  2017/06/27 10:17:50  brouard
     Summary: Some bug with rint
   
   Revision 1.270  2017/05/24 05:45:29  brouard    Revision 1.270  2017/05/24 05:45:29  brouard
   *** empty log message ***    *** empty log message ***
   
Line 3243  double ***hbxij(double ***po, int nhstep Line 3246  double ***hbxij(double ***po, int nhstep
       newm=savm;        newm=savm;
       /* Covariates have to be included here again */        /* Covariates have to be included here again */
       cov[1]=1.;        cov[1]=1.;
       agexact=age-((h-1)*hstepm + (d))*stepm/YEARM; /* age just before transition, d or d-1? */        agexact=age-( (h-1)*hstepm + (d)  )*stepm/YEARM; /* age just before transition, d or d-1? */
       /* agexact=age+((h-1)*hstepm + (d-1))*stepm/YEARM; /\* age just before transition *\/ */        /* agexact=age+((h-1)*hstepm + (d-1))*stepm/YEARM; /\* age just before transition *\/ */
       cov[2]=agexact;        cov[2]=agexact;
       if(nagesqr==1)        if(nagesqr==1)
Line 7042  void printinggnuplot(char fileresu[], ch Line 7045  void printinggnuplot(char fileresu[], ch
                   
         fprintf(ficgp,"\" t\"\" w l lt 1,\"%s\" u 1:((",subdirf2(fileresu,"P_"));          fprintf(ficgp,"\" t\"\" w l lt 1,\"%s\" u 1:((",subdirf2(fileresu,"P_"));
         if(cptcoveff ==0){          if(cptcoveff ==0){
           fprintf(ficgp,"$%d)) t 'Observed prevalence in state %d' with line lt 3",      2+(cpt-1),  cpt );            fprintf(ficgp,"$%d)) t 'Observed prevalence in state %d' with line lt 3",      2+3*(cpt-1),  cpt );
         }else{          }else{
           kl=0;            kl=0;
           for (k=1; k<=cptcoveff; k++){    /* For each combination of covariate  */            for (k=1; k<=cptcoveff; k++){    /* For each combination of covariate  */
Line 7100  void printinggnuplot(char fileresu[], ch Line 7103  void printinggnuplot(char fileresu[], ch
               if (i==cpt) fprintf(ficgp," %%lf (%%lf)");                if (i==cpt) fprintf(ficgp," %%lf (%%lf)");
               else        fprintf(ficgp," %%*lf (%%*lf)");                else        fprintf(ficgp," %%*lf (%%*lf)");
             }              }
             fprintf(ficgp,"\" t\"Backward (stable) prevalence\" w l lt 0,\"%s\" every :::%d::%d u 1:($2==%d ? $3+1.96*$4 : 1/0) \"%%lf %%lf",subdirf2(fileresu,"VBL_"),nres-1,nres-1,nres);              fprintf(ficgp,"\" t\"Backward (stable) prevalence\" w l lt 6 dt 3,\"%s\" every :::%d::%d u 1:($2==%d ? $3+1.96*$4 : 1/0) \"%%lf %%lf",subdirf2(fileresu,"VBL_"),nres-1,nres-1,nres);
             for (i=1; i<= nlstate ; i ++) {              for (i=1; i<= nlstate ; i ++) {
               if (i==cpt) fprintf(ficgp," %%lf (%%lf)");                if (i==cpt) fprintf(ficgp," %%lf (%%lf)");
               else fprintf(ficgp," %%*lf (%%*lf)");                else fprintf(ficgp," %%*lf (%%*lf)");
             }               } 
             fprintf(ficgp,"\" t\"95%% CI\" w l lt 1,\"%s\" every :::%d::%d u 1:($2==%d ? $3-1.96*$4 : 1/0) \"%%lf %%lf",subdirf2(fileresu,"VBL_"),nres-1,nres-1,nres);               fprintf(ficgp,"\" t\"95%% CI\" w l lt 6,\"%s\" every :::%d::%d u 1:($2==%d ? $3-1.96*$4 : 1/0) \"%%lf %%lf",subdirf2(fileresu,"VBL_"),nres-1,nres-1,nres); 
             for (i=1; i<= nlstate ; i ++) {              for (i=1; i<= nlstate ; i ++) {
               if (i==cpt) fprintf(ficgp," %%lf (%%lf)");                if (i==cpt) fprintf(ficgp," %%lf (%%lf)");
               else fprintf(ficgp," %%*lf (%%*lf)");                else fprintf(ficgp," %%*lf (%%*lf)");
             }               } 
             fprintf(ficgp,"\" t\"\" w l lt 1");              fprintf(ficgp,"\" t\"\" w l lt 6");
           } /* end if backprojcast */            } /* end if backprojcast */
         } /* end if backcast */          } /* end if backcast */
         fprintf(ficgp,"\nset out ;unset label;\n");          fprintf(ficgp,"\nset out ;unset label;\n");
Line 8345  set ter svg size 640, 480\nunset log y\n Line 8348  set ter svg size 640, 480\nunset log y\n
       /* for (yearp=0; yearp<=(anproj2-anproj1);yearp +=stepsize) {  */        /* for (yearp=0; yearp<=(anproj2-anproj1);yearp +=stepsize) {  */
       fprintf(ficresfb,"\n");        fprintf(ficresfb,"\n");
       fprintf(ficresfb,"\n# Back Forecasting at date %.lf/%.lf/%.lf ",jback1,mback1,anback1+yearp);        fprintf(ficresfb,"\n# Back Forecasting at date %.lf/%.lf/%.lf ",jback1,mback1,anback1+yearp);
       /* printf("\n# Back Forecasting at date %.lf/%.lf/%.lf ",jback1,mback1,anback1+yearp); */        printf("\n# Back Forecasting at date %.lf/%.lf/%.lf ",jback1,mback1,anback1+yearp);
       /* for (agec=bage; agec<=agemax-1; agec++){  /\* testing *\/ */        /* for (agec=bage; agec<=agemax-1; agec++){  /\* testing *\/ */
       for (agec=bage; agec<=fage; agec++){  /* testing */        for (agec=bage; agec<=fage; agec++){  /* testing */
         /* We compute bij at age agec over nhstepm, nhstepm decreases when agec increases because of agemax;*/          /* We compute bij at age agec over nhstepm, nhstepm decreases when agec increases because of agemax;*/
         nhstepm=(int) rint((agec-agelim)*YEARM/stepm);          nhstepm=(int) (agec-agelim) *YEARM/stepm;/*     nhstepm=(int) rint((agec-agelim)*YEARM/stepm);*/
         nhstepm = nhstepm/hstepm;          nhstepm = nhstepm/hstepm;
         p3mat=ma3x(1,nlstate+ndeath,1, nlstate+ndeath, 0,nhstepm);          p3mat=ma3x(1,nlstate+ndeath,1, nlstate+ndeath, 0,nhstepm);
         oldm=oldms;savm=savms;          oldm=oldms;savm=savms;
         /* computes hbxij at age agec over 1 to nhstepm */          /* computes hbxij at age agec over 1 to nhstepm */
           /* printf("####prevbackforecast debug  agec=%.2f nhstepm=%d\n",agec, nhstepm);fflush(stdout); */
         hbxij(p3mat,nhstepm,agec,hstepm,p,prevacurrent,nlstate,stepm, k, nres);          hbxij(p3mat,nhstepm,agec,hstepm,p,prevacurrent,nlstate,stepm, k, nres);
         /* hpxij(p3mat,nhstepm,agec,hstepm,p,             nlstate,stepm,oldm,savm, k,nres); */          /* hpxij(p3mat,nhstepm,agec,hstepm,p,             nlstate,stepm,oldm,savm, k,nres); */
         /* Then we print p3mat for h corresponding to the right agec+h*stepms=yearp */          /* Then we print p3mat for h corresponding to the right agec+h*stepms=yearp */

Removed from v.1.270  
changed lines
  Added in v.1.271


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