Diff for /imach/src/imach.c between versions 1.246 and 1.250

version 1.246, 2016/09/02 08:49:22 version 1.250, 2016/09/08 16:07:27
Line 1 Line 1
 /* $Id$  /* $Id$
   $State$    $State$
   $Log$    $Log$
     Revision 1.250  2016/09/08 16:07:27  brouard
     Summary: continue
   
     Revision 1.249  2016/09/07 17:14:18  brouard
     Summary: Starting values from frequencies
   
     Revision 1.248  2016/09/07 14:10:18  brouard
     *** empty log message ***
   
     Revision 1.247  2016/09/02 11:11:21  brouard
     *** empty log message ***
   
   Revision 1.246  2016/09/02 08:49:22  brouard    Revision 1.246  2016/09/02 08:49:22  brouard
   *** empty log message ***    *** empty log message ***
   
Line 2584  Earliest age to start was %d-%d=%d, ncvl Line 2596  Earliest age to start was %d-%d=%d, ncvl
   /* If we start from prlim again, prlim tends to a constant matrix */    /* If we start from prlim again, prlim tends to a constant matrix */
   
   int i, ii,j,k;    int i, ii,j,k;
     int first=0;
   double *min, *max, *meandiff, maxmax,sumnew=0.;    double *min, *max, *meandiff, maxmax,sumnew=0.;
   /* double **matprod2(); */ /* test */    /* double **matprod2(); */ /* test */
   double **out, cov[NCOVMAX+1], **bmij();    double **out, cov[NCOVMAX+1], **bmij();
Line 2709  Earliest age to start was %d-%d=%d, ncvl Line 2722  Earliest age to start was %d-%d=%d, ncvl
     }      }
   } /* age loop */    } /* age loop */
     /* After some age loop it doesn't converge */      /* After some age loop it doesn't converge */
   printf("Warning: the back stable prevalence at age %d did not converge with the required precision (%g > ftolpl=%g) within %.0f years. Try to lower 'ftolpl'. \n\    if(first){
       first=1;
       printf("Warning: the back stable prevalence at age %d did not converge with the required precision (%g > ftolpl=%g) within %.0f years. Try to lower 'ftolpl'. Others in log file only...\n\
   Oldest age to start was %d-%d=%d, ncvloop=%d, ncvyear=%d\n", (int)age, maxmax, ftolpl, delaymax, (int)age, (int)delaymax, (int)agefin, ncvloop, *ncvyear);
     }
     fprintf(ficlog,"Warning: the back stable prevalence at age %d did not converge with the required precision (%g > ftolpl=%g) within %.0f years. Try to lower 'ftolpl'. \n\
 Oldest age to start was %d-%d=%d, ncvloop=%d, ncvyear=%d\n", (int)age, maxmax, ftolpl, delaymax, (int)age, (int)delaymax, (int)agefin, ncvloop, *ncvyear);  Oldest age to start was %d-%d=%d, ncvloop=%d, ncvyear=%d\n", (int)age, maxmax, ftolpl, delaymax, (int)age, (int)delaymax, (int)agefin, ncvloop, *ncvyear);
   /* Try to lower 'ftol', for example from 1.e-8 to 6.e-9.\n", ftolpl, (int)age, (int)delaymax, (int)agefin, ncvloop, (int)age-(int)agefin); */    /* Try to lower 'ftol', for example from 1.e-8 to 6.e-9.\n", ftolpl, (int)age, (int)delaymax, (int)agefin, ncvloop, (int)age-(int)agefin); */
   free_vector(min,1,nlstate);    free_vector(min,1,nlstate);
Line 3596  double funcone( double *x) Line 3614  double funcone( double *x)
       agebegin=agev[mw[mi][i]][i]; /* Age at beginning of effective wave */        agebegin=agev[mw[mi][i]][i]; /* Age at beginning of effective wave */
       ageend=agev[mw[mi][i]][i] + (dh[mi][i])*stepm/YEARM; /* Age at end of effective wave and at the end of transition */        ageend=agev[mw[mi][i]][i] + (dh[mi][i])*stepm/YEARM; /* Age at end of effective wave and at the end of transition */
       for(d=0; d<dh[mi][i]; d++){  /* Delay between two effective waves */        for(d=0; d<dh[mi][i]; d++){  /* Delay between two effective waves */
         /* for(d=0; d<=0; d++){  /\* Delay between two effective waves Only one matrix to speed up*\/ */
         /*dh[m][i] or dh[mw[mi][i]][i] is the delay between two effective waves m=mw[mi][i]          /*dh[m][i] or dh[mw[mi][i]][i] is the delay between two effective waves m=mw[mi][i]
           and mw[mi+1][i]. dh depends on stepm.*/            and mw[mi+1][i]. dh depends on stepm.*/
         newm=savm;          newm=savm;
         agexact=agev[mw[mi][i]][i]+d*stepm/YEARM;          agexact=agev[mw[mi][i]][i]+d*stepm/YEARM;  /* Here d is needed */
         cov[2]=agexact;          cov[2]=agexact;
         if(nagesqr==1)          if(nagesqr==1)
           cov[3]= agexact*agexact;            cov[3]= agexact*agexact;
Line 4167  void pstamp(FILE *fichier) Line 4186  void pstamp(FILE *fichier)
 }  }
   
 /************ Frequencies ********************/  /************ Frequencies ********************/
 void  freqsummary(char fileres[], int iagemin, int iagemax, int **s, double **agev, int nlstate, int imx, \  void  freqsummary(char fileres[], double p[], int iagemin, int iagemax, int **s, double **agev, int nlstate, int imx, \
                   int *Tvaraff, int *invalidvarcomb, int **nbcode, int *ncodemax,double **mint,double **anint, char strstart[], \                    int *Tvaraff, int *invalidvarcomb, int **nbcode, int *ncodemax,double **mint,double **anint, char strstart[], \
                   int firstpass,  int lastpass, int stepm, int weightopt, char model[])                    int firstpass,  int lastpass, int stepm, int weightopt, char model[])
 {  /* Some frequencies */  {  /* Some frequencies as well as proposing some starting values */
       
   int i, m, jk, j1, bool, z1,j, k, iv;    int i, m, jk, j1, bool, z1,j, k, iv, jj=0;
   int iind=0, iage=0;    int iind=0, iage=0;
   int mi; /* Effective wave */    int mi; /* Effective wave */
   int first;    int first;
Line 4236  Title=%s <br>Datafile=%s Firstpass=%d La Line 4255  Title=%s <br>Datafile=%s Firstpass=%d La
   j=cptcoveff;  /* Only dummy covariates of the model */    j=cptcoveff;  /* Only dummy covariates of the model */
   if (cptcovn<1) {j=1;ncodemax[1]=1;}    if (cptcovn<1) {j=1;ncodemax[1]=1;}
       
   first=1;  
       
   /* Detects if a combination j1 is empty: for a multinomial variable like 3 education levels:    /* Detects if a combination j1 is empty: for a multinomial variable like 3 education levels:
      reference=low_education V1=0,V2=0       reference=low_education V1=0,V2=0
Line 4244  Title=%s <br>Datafile=%s Firstpass=%d La Line 4262  Title=%s <br>Datafile=%s Firstpass=%d La
      high_educ               V1=0 V2=1       high_educ               V1=0 V2=1
      Then V1=1 and V2=1 is a noisy combination that we want to exclude for the list 2**cptcoveff        Then V1=1 and V2=1 is a noisy combination that we want to exclude for the list 2**cptcoveff 
   */    */
       dateintsum=0;
     k2cpt=0;
   
     for (j = 0; j <= cptcoveff; j+=cptcoveff){   
     first=1;
   for (j1 = 1; j1 <= (int) pow(2,j); j1++){ /* Loop on covariates combination in order of model, excluding quantitatives V4=0, V3=0 for example, fixed or varying covariates */    for (j1 = 1; j1 <= (int) pow(2,j); j1++){ /* Loop on covariates combination in order of model, excluding quantitatives V4=0, V3=0 for example, fixed or varying covariates */
     posproptt=0.;      posproptt=0.;
     /*printf("cptcoveff=%d Tvaraff=%d", cptcoveff,Tvaraff[1]);      /*printf("cptcoveff=%d Tvaraff=%d", cptcoveff,Tvaraff[1]);
Line 4267  Title=%s <br>Datafile=%s Firstpass=%d La Line 4289  Title=%s <br>Datafile=%s Firstpass=%d La
     /*   } */      /*   } */
     /* } */      /* } */
           
     dateintsum=0;      /* dateintsum=0; */
     k2cpt=0;      /* k2cpt=0; */
   
     /* For that combination of covariate j1, we count and print the frequencies in one pass */      /* For that combination of covariate j1, we count and print the frequencies in one pass */
     for (iind=1; iind<=imx; iind++) { /* For each individual iind */      for (iind=1; iind<=imx; iind++) { /* For each individual iind */
       bool=1;        bool=1;
         if(j !=0){
       if(anyvaryingduminmodel==0){ /* If All fixed covariates */        if(anyvaryingduminmodel==0){ /* If All fixed covariates */
         if (cptcoveff >0) { /* Filter is here: Must be looked at for model=V1+V2+V3+V4 */          if (cptcoveff >0) { /* Filter is here: Must be looked at for model=V1+V2+V3+V4 */
           /* for (z1=1; z1<= nqfveff; z1++) {   */            /* for (z1=1; z1<= nqfveff; z1++) {   */
           /*   meanq[z1]+=coqvar[Tvar[z1]][iind];  /\* Computes mean of quantitative with selected filter *\/ */            /*   meanq[z1]+=coqvar[Tvar[z1]][iind];  /\* Computes mean of quantitative with selected filter *\/ */
           /* } */            /* } */
           for (z1=1; z1<=cptcoveff; z1++) {              for (z1=1; z1<=cptcoveff; z1++) { /* loops on covariates in the model */
             /* if(Tvaraff[z1] ==-20){ */              /* if(Tvaraff[z1] ==-20){ */
             /*   /\* sumnew+=cotvar[mw[mi][iind]][z1][iind]; *\/ */              /*   /\* sumnew+=cotvar[mw[mi][iind]][z1][iind]; *\/ */
             /* }else  if(Tvaraff[z1] ==-10){ */              /* }else  if(Tvaraff[z1] ==-10){ */
             /*   /\* sumnew+=coqvar[z1][iind]; *\/ */              /*   /\* sumnew+=coqvar[z1][iind]; *\/ */
             /* }else  */              /* }else  */
             if (covar[Tvaraff[z1]][iind]!= nbcode[Tvaraff[z1]][codtabm(j1,z1)]){              if (covar[Tvaraff[z1]][iind]!= nbcode[Tvaraff[z1]][codtabm(j1,z1)]){ /* for combination j1 of covariates */
               /* Tests if this individual iind responded to j1 (V4=1 V3=0) */                /* Tests if this individual iind responded to combination j1 (V4=1 V3=0) */
               bool=0;                bool=0; /* bool should be equal to 1 to be selected, one covariate value failed */
               /* printf("bool=%d i=%d, z1=%d, Tvaraff[%d]=%d, covar[Tvarff][%d]=%2f, codtabm(%d,%d)=%d, nbcode[Tvaraff][codtabm(%d,%d)=%d, j1=%d\n",                 /* printf("bool=%d i=%d, z1=%d, Tvaraff[%d]=%d, covar[Tvarff][%d]=%2f, codtabm(%d,%d)=%d, nbcode[Tvaraff][codtabm(%d,%d)=%d, j1=%d\n", 
                  bool,i,z1, z1, Tvaraff[z1],i,covar[Tvaraff[z1]][i],j1,z1,codtabm(j1,z1),                   bool,i,z1, z1, Tvaraff[z1],i,covar[Tvaraff[z1]][i],j1,z1,codtabm(j1,z1),
                  j1,z1,nbcode[Tvaraff[z1]][codtabm(j1,z1)],j1);*/                   j1,z1,nbcode[Tvaraff[z1]][codtabm(j1,z1)],j1);*/
Line 4294  Title=%s <br>Datafile=%s Firstpass=%d La Line 4318  Title=%s <br>Datafile=%s Firstpass=%d La
           } /* end z1 */            } /* end z1 */
         } /* cptcovn > 0 */          } /* cptcovn > 0 */
       } /* end any */        } /* end any */
         }/* end j==0 */
       if (bool==1){ /* We selected an individual iind satisfying combination j1 or all fixed */        if (bool==1){ /* We selected an individual iind satisfying combination j1 or all fixed */
         /* for(m=firstpass; m<=lastpass; m++){ */          /* for(m=firstpass; m<=lastpass; m++){ */
         for(mi=1; mi<wav[iind];mi++){ /* For that wave */          for(mi=1; mi<wav[iind];mi++){ /* For that wave */
           m=mw[mi][iind];            m=mw[mi][iind];
             if(j!=0){
           if(anyvaryingduminmodel==1){ /* Some are varying covariates */            if(anyvaryingduminmodel==1){ /* Some are varying covariates */
             for (z1=1; z1<=cptcoveff; z1++) {              for (z1=1; z1<=cptcoveff; z1++) {
               if( Fixed[Tmodelind[z1]]==1){                if( Fixed[Tmodelind[z1]]==1){
                 iv= Tvar[Tmodelind[z1]]-ncovcol-nqv;                  iv= Tvar[Tmodelind[z1]]-ncovcol-nqv;
                 if (cotvar[m][iv][iind]!= nbcode[Tvaraff[z1]][codtabm(j1,z1)]) /* iv=1 to ntv, right modality */                  if (cotvar[m][iv][iind]!= nbcode[Tvaraff[z1]][codtabm(j1,z1)]) /* iv=1 to ntv, right modality. If covariate's 
                   bool=0;                                                                                    value is -1, we don't select. It differs from the 
                                                                                     constant and age model which counts them. */
                     bool=0; /* not selected */
               }else if( Fixed[Tmodelind[z1]]== 0) { /* fixed */                }else if( Fixed[Tmodelind[z1]]== 0) { /* fixed */
                 if (covar[Tvaraff[z1]][iind]!= nbcode[Tvaraff[z1]][codtabm(j1,z1)]) {                  if (covar[Tvaraff[z1]][iind]!= nbcode[Tvaraff[z1]][codtabm(j1,z1)]) {
                   bool=0;                    bool=0;
Line 4311  Title=%s <br>Datafile=%s Firstpass=%d La Line 4339  Title=%s <br>Datafile=%s Firstpass=%d La
               }                }
             }              }
           }/* Some are varying covariates, we tried to speed up if all fixed covariates in the model, avoiding waves loop  */            }/* Some are varying covariates, we tried to speed up if all fixed covariates in the model, avoiding waves loop  */
             } /* end j==0 */
           /* bool =0 we keep that guy which corresponds to the combination of dummy values */            /* bool =0 we keep that guy which corresponds to the combination of dummy values */
           if(bool==1){            if(bool==1){
             /* dh[m][iind] or dh[mw[mi][iind]][iind] is the delay between two effective (mi) waves m=mw[mi][iind]              /* dh[m][iind] or dh[mw[mi][iind]][iind] is the delay between two effective (mi) waves m=mw[mi][iind]
Line 4330  Title=%s <br>Datafile=%s Firstpass=%d La Line 4359  Title=%s <br>Datafile=%s Firstpass=%d La
                 if(s[m][iind]==-1)                  if(s[m][iind]==-1)
                   printf(" num=%ld m=%d, iind=%d s1=%d s2=%d agev at m=%d agebegin=%.2f ageend=%.2f, agemed=%d\n", num[iind], m, iind,s[m][iind],s[m+1][iind], (int)agev[m][iind],agebegin, ageend, (int)((agebegin+ageend)/2.));                    printf(" num=%ld m=%d, iind=%d s1=%d s2=%d agev at m=%d agebegin=%.2f ageend=%.2f, agemed=%d\n", num[iind], m, iind,s[m][iind],s[m+1][iind], (int)agev[m][iind],agebegin, ageend, (int)((agebegin+ageend)/2.));
                 freq[s[m][iind]][s[m+1][iind]][(int)agev[m][iind]] += weight[iind]; /* At age of beginning of transition, where status is known */                  freq[s[m][iind]][s[m+1][iind]][(int)agev[m][iind]] += weight[iind]; /* At age of beginning of transition, where status is known */
                   /* if((int)agev[m][iind] == 55) */
                   /*   printf("j=%d, j1=%d Age %d, iind=%d, num=%09ld m=%d\n",j,j1,(int)agev[m][iind],iind, num[iind],m); */
                 /* freq[s[m][iind]][s[m+1][iind]][(int)((agebegin+ageend)/2.)] += weight[iind]; */                  /* freq[s[m][iind]][s[m+1][iind]][(int)((agebegin+ageend)/2.)] += weight[iind]; */
                 freq[s[m][iind]][s[m+1][iind]][iagemax+3] += weight[iind]; /* Total is in iagemax+3 *//* At age of beginning of transition, where status is known */                  freq[s[m][iind]][s[m+1][iind]][iagemax+3] += weight[iind]; /* Total is in iagemax+3 *//* At age of beginning of transition, where status is known */
               }                }
             } /* end if between passes */                } /* end if between passes */  
             if ((agev[m][iind]>1) && (agev[m][iind]< (iagemax+3)) && (anint[m][iind]!=9999) && (mint[m][iind]!=99)) {              if ((agev[m][iind]>1) && (agev[m][iind]< (iagemax+3)) && (anint[m][iind]!=9999) && (mint[m][iind]!=99) && (j==0)) {
               dateintsum=dateintsum+k2;                dateintsum=dateintsum+k2; /* on all covariates ?*/
               k2cpt++;                k2cpt++;
               /* printf("iind=%ld dateintmean = %lf dateintsum=%lf k2cpt=%lf k2=%lf\n",iind, dateintsum/k2cpt, dateintsum,k2cpt, k2); */                /* printf("iind=%ld dateintmean = %lf dateintsum=%lf k2cpt=%lf k2=%lf\n",iind, dateintsum/k2cpt, dateintsum,k2cpt, k2); */
             }              }
           } /* end bool 2 */            }else{
               bool=1;
             }/* end bool 2 */
         } /* end m */          } /* end m */
       } /* end bool */        } /* end bool */
     } /* end iind = 1 to imx */      } /* end iind = 1 to imx */
Line 4349  Title=%s <br>Datafile=%s Firstpass=%d La Line 4382  Title=%s <br>Datafile=%s Firstpass=%d La
           
     /*      fprintf(ficresp, "#Count between %.lf/%.lf/%.lf and %.lf/%.lf/%.lf\n",jprev1, mprev1,anprev1,jprev2, mprev2,anprev2);*/      /*      fprintf(ficresp, "#Count between %.lf/%.lf/%.lf and %.lf/%.lf/%.lf\n",jprev1, mprev1,anprev1,jprev2, mprev2,anprev2);*/
     pstamp(ficresp);      pstamp(ficresp);
     if  (cptcoveff>0){      if  (cptcoveff>0 && j!=0){
       fprintf(ficresp, "\n#********** Variable ");         fprintf(ficresp, "\n#********** Variable "); 
       fprintf(ficresphtm, "\n<br/><br/><h3>********** Variable ");         fprintf(ficresphtm, "\n<br/><br/><h3>********** Variable "); 
       fprintf(ficresphtmfr, "\n<br/><br/><h3>********** Variable ");         fprintf(ficresphtmfr, "\n<br/><br/><h3>********** Variable "); 
Line 4515  Title=%s <br>Datafile=%s Firstpass=%d La Line 4548  Title=%s <br>Datafile=%s Firstpass=%d La
     }      }
     fprintf(ficresphtmfr,"</table>\n");      fprintf(ficresphtmfr,"</table>\n");
   } /* end selected combination of covariate j1 */    } /* end selected combination of covariate j1 */
     if(j==0){ /* We can estimate starting values from the occurences in each case */
       printf("#Freqsummary\n");
       fprintf(ficlog,"\n");
       for(i=1,jk=1; i <=nlstate; i++){
         for(k=1; k <=(nlstate+ndeath); k++){
           if (k != i) {
             printf("%d%d ",i,k);
             fprintf(ficlog,"%d%d ",i,k);
             for(jj=1; jj <=ncovmodel; jj++){
               if(jj==1){
                 printf("%12.7f ln(%12.1f/%12.1f)= %12.7f ",p[jk],freq[i][k][iagemax+3],freq[i][i][iagemax+3], log(freq[i][k][iagemax+3]/freq[i][i][iagemax+3]));
                 fprintf(ficlog,"%12.7f ln(%12.1f/%12.1f)= %12.7f ",p[jk],freq[i][k][iagemax+3],freq[i][i][iagemax+3], log(freq[i][k][iagemax+3]/freq[i][i][iagemax+3]));
               }
               /* printf("%12.7f )", param[i][jj][k]); */
               /* fprintf(ficlog,"%12.7f )", param[i][jj][k]); */
               jk++; 
             }
             printf("\n");
             fprintf(ficlog,"\n");
           }
         }
       }
       printf("#Freqsummary\n");
       fprintf(ficlog,"\n");
       for(jk=-1; jk <=nlstate+ndeath; jk++){
         for(m=-1; m <=nlstate+ndeath; m++){
           /* param[i]|j][k]= freq[jk][m][iagemax+3] */
             printf(" %d%d=%.0f",jk,m,freq[jk][m][iagemax+3]);
             fprintf(ficlog," %d%d=%.0f",jk,m,freq[jk][m][iagemax+3]);
           /* if(freq[jk][m][iage] !=0 ) { /\* minimizing output *\/ */
           /*   printf(" %d%d=%.0f",jk,m,freq[jk][m][iagemax+3]); */
           /*   fprintf(ficlog," %d%d=%.0f",jk,m,freq[jk][m][iagemax+3]); */
           /* } */
         }
       } /* end loop jk */
       printf("\n");
       fprintf(ficlog,"\n");
     } /* if j=0 */
     } /* end j */
   dateintmean=dateintsum/k2cpt;     dateintmean=dateintsum/k2cpt; 
       
   fclose(ficresp);    fclose(ficresp);
Line 8833  Dummy[k] 0=dummy (0 1), 1 quantitative ( Line 8905  Dummy[k] 0=dummy (0 1), 1 quantitative (
 }  }
   
 int calandcheckages(int imx, int maxwav, double *agemin, double *agemax, int *nberr, int *nbwarn )  int calandcheckages(int imx, int maxwav, double *agemin, double *agemax, int *nberr, int *nbwarn )
 {  {/* Check ages at death */
   int i, m;    int i, m;
   int firstone=0;    int firstone=0;
       
Line 9877  int main(int argc, char *argv[]) Line 9949  int main(int argc, char *argv[])
   delti=delti3[1][1];    delti=delti3[1][1];
   /*delti=vector(1,npar); *//* Scale of each paramater (output from hesscov)*/    /*delti=vector(1,npar); *//* Scale of each paramater (output from hesscov)*/
   if(mle==-1){ /* Print a wizard for help writing covariance matrix */    if(mle==-1){ /* Print a wizard for help writing covariance matrix */
   /* We could also provide initial parameters values giving by simple logistic regression 
    * only one way, that is without matrix product. We will have nlstate maximizations */
         /* for(i=1;i<nlstate;i++){ */
         /*        /\*reducing xi for 1 to npar to 1 to ncovmodel; *\/ */
         /*    mlikeli(ficres,p, ncovmodel, ncovmodel, nlstate, ftol, funcnoprod); */
         /* } */
     prwizard(ncovmodel, nlstate, ndeath, model, ficparo);      prwizard(ncovmodel, nlstate, ndeath, model, ficparo);
     printf(" You chose mle=-1, look at file %s for a template of covariance matrix \n",filereso);      printf(" You chose mle=-1, look at file %s for a template of covariance matrix \n",filereso);
     fprintf(ficlog," You chose mle=-1, look at file %s for a template of covariance matrix \n",filereso);      fprintf(ficlog," You chose mle=-1, look at file %s for a template of covariance matrix \n",filereso);
Line 9885  int main(int argc, char *argv[]) Line 9963  int main(int argc, char *argv[])
     fclose (ficlog);      fclose (ficlog);
     goto end;      goto end;
     exit(0);      exit(0);
     } else if(mle==-2) { /* Guessing from means */
       prwizard(ncovmodel, nlstate, ndeath, model, ficparo);
       printf(" You chose mle=-2, look at file %s for a template of covariance matrix \n",filereso);
       fprintf(ficlog," You chose mle=-2, look at file %s for a template of covariance matrix \n",filereso);
      
   }  else if(mle==-5) { /* Main Wizard */    }  else if(mle==-5) { /* Main Wizard */
     prwizard(ncovmodel, nlstate, ndeath, model, ficparo);      prwizard(ncovmodel, nlstate, ndeath, model, ficparo);
     printf(" You chose mle=-3, look at file %s for a template of covariance matrix \n",filereso);      printf(" You chose mle=-3, look at file %s for a template of covariance matrix \n",filereso);
Line 10208  Please run with mle=-1 to get a correct Line 10291  Please run with mle=-1 to get a correct
   */    */
   
   concatwav(wav, dh, bh, mw, s, agedc, agev,  firstpass, lastpass, imx, nlstate, stepm);    concatwav(wav, dh, bh, mw, s, agedc, agev,  firstpass, lastpass, imx, nlstate, stepm);
   /* */    /* Concatenates waves */
     
   free_vector(moisdc,1,n);    free_vector(moisdc,1,n);
   free_vector(andc,1,n);    free_vector(andc,1,n);
Line 10389  Title=%s <br>Datafile=%s Firstpass=%d La Line 10472  Title=%s <br>Datafile=%s Firstpass=%d La
   /* Calculates basic frequencies. Computes observed prevalence at single age     /* Calculates basic frequencies. Computes observed prevalence at single age 
                  and for any valid combination of covariates                   and for any valid combination of covariates
      and prints on file fileres'p'. */       and prints on file fileres'p'. */
   freqsummary(fileres, agemin, agemax, s, agev, nlstate, imx, Tvaraff, invalidvarcomb, nbcode, ncodemax,mint,anint,strstart, \    freqsummary(fileres, p, agemin, agemax, s, agev, nlstate, imx, Tvaraff, invalidvarcomb, nbcode, ncodemax,mint,anint,strstart, \
               firstpass, lastpass,  stepm,  weightopt, model);                firstpass, lastpass,  stepm,  weightopt, model);
   
   fprintf(fichtm,"\n");    fprintf(fichtm,"\n");
Line 10411  Interval (in months) between two waves: Line 10494  Interval (in months) between two waves:
   /* For mortality only */    /* For mortality only */
   if (mle==-3){    if (mle==-3){
     ximort=matrix(1,NDIM,1,NDIM);       ximort=matrix(1,NDIM,1,NDIM); 
                 for(i=1;i<=NDIM;i++)      for(i=1;i<=NDIM;i++)
                         for(j=1;j<=NDIM;j++)        for(j=1;j<=NDIM;j++)
                                 ximort[i][j]=0.;          ximort[i][j]=0.;
     /*     ximort=gsl_matrix_alloc(1,NDIM,1,NDIM); */      /*     ximort=gsl_matrix_alloc(1,NDIM,1,NDIM); */
     cens=ivector(1,n);      cens=ivector(1,n);
     ageexmed=vector(1,n);      ageexmed=vector(1,n);
Line 10649  Please run with mle=-1 to get a correct Line 10732  Please run with mle=-1 to get a correct
     printf("\n");      printf("\n");
     if(mle>=1){ /* Could be 1 or 2, Real Maximization */      if(mle>=1){ /* Could be 1 or 2, Real Maximization */
       /* mlikeli uses func not funcone */        /* mlikeli uses func not funcone */
         /* for(i=1;i<nlstate;i++){ */
         /*        /\*reducing xi for 1 to npar to 1 to ncovmodel; *\/ */
         /*    mlikeli(ficres,p, ncovmodel, ncovmodel, nlstate, ftol, funcnoprod); */
         /* } */
       mlikeli(ficres,p, npar, ncovmodel, nlstate, ftol, func);        mlikeli(ficres,p, npar, ncovmodel, nlstate, ftol, func);
     }      }
     if(mle==0) {/* No optimization, will print the likelihoods for the datafile */      if(mle==0) {/* No optimization, will print the likelihoods for the datafile */

Removed from v.1.246  
changed lines
  Added in v.1.250


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