|
|
| version 1.246, 2016/09/02 08:49:22 | version 1.248, 2016/09/07 14:10:18 |
|---|---|
| Line 1 | Line 1 |
| /* $Id$ | /* $Id$ |
| $State$ | $State$ |
| $Log$ | $Log$ |
| 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 2590 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 2716 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 3608 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 8833 Dummy[k] 0=dummy (0 1), 1 quantitative ( | Line 8846 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 9890 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 9904 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 10232 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 10411 Interval (in months) between two waves: | Line 10435 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 10673 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 */ |