version 1.296, 2019/05/20 13:03:18
|
version 1.298, 2019/05/22 18:19:56
|
Line 1
|
Line 1
|
/* $Id$ |
/* $Id$ |
$State$ |
$State$ |
$Log$ |
$Log$ |
|
Revision 1.298 2019/05/22 18:19:56 brouard |
|
*** empty log message *** |
|
|
|
Revision 1.297 2019/05/22 17:56:10 brouard |
|
Summary: Fix bug by moving date2dmy and nhstepm which gaefin=-1 |
|
|
Revision 1.296 2019/05/20 13:03:18 brouard |
Revision 1.296 2019/05/20 13:03:18 brouard |
Summary: Projection syntax simplified |
Summary: Projection syntax simplified |
|
|
Line 3046 double **pmij(double **ps, double *cov,
|
Line 3052 double **pmij(double **ps, double *cov,
|
sumnew=0.; |
sumnew=0.; |
/*for (ii=1;ii<=nlstate+ndeath;ii++){*/ |
/*for (ii=1;ii<=nlstate+ndeath;ii++){*/ |
for (ii=1;ii<=nlstate;ii++){ /* Only on live states */ |
for (ii=1;ii<=nlstate;ii++){ /* Only on live states */ |
/* printf(" agefin=%d, ii=%d, ij=%d, prev=%f\n",(int)agefin,ii, ij, prevacurrent[(int)agefin][ii][ij]); */ |
/* printf(" agefin=%d, ii=%d, ij=%d, prev=%f\n",(int)agefin,ii, ij, prevacurrent[(int)agefin][ii][ij]); */ |
sumnew+=prevacurrent[(int)agefin][ii][ij]; |
sumnew+=prevacurrent[(int)agefin][ii][ij]; |
} |
} |
if(sumnew >0.01){ /* At least some value in the prevalence */ |
if(sumnew >0.01){ /* At least some value in the prevalence */ |
Line 4421 void pstamp(FILE *fichier)
|
Line 4427 void pstamp(FILE *fichier)
|
fprintf(fichier,"# %s.%s\n#IMaCh version %s, %s\n#%s\n# %s", optionfilefiname,optionfilext,version,copyright, fullversion, strstart); |
fprintf(fichier,"# %s.%s\n#IMaCh version %s, %s\n#%s\n# %s", optionfilefiname,optionfilext,version,copyright, fullversion, strstart); |
} |
} |
|
|
|
void date2dmy(double date,double *day, double *month, double *year){ |
|
double yp=0., yp1=0., yp2=0.; |
|
|
|
yp1=modf(date,&yp);/* extracts integral of date in yp and |
|
fractional in yp1 */ |
|
*year=yp; |
|
yp2=modf((yp1*12),&yp); |
|
*month=yp; |
|
yp1=modf((yp2*30.5),&yp); |
|
*day=yp; |
|
if(*day==0) *day=1; |
|
if(*month==0) *month=1; |
|
} |
|
|
|
|
|
|
/************ Frequencies ********************/ |
/************ Frequencies ********************/ |
Line 5189 void prevalence(double ***probs, double
|
Line 5209 void prevalence(double ***probs, double
|
|
|
void concatwav(int wav[], int **dh, int **bh, int **mw, int **s, double *agedc, double **agev, int firstpass, int lastpass, int imx, int nlstate, int stepm) |
void concatwav(int wav[], int **dh, int **bh, int **mw, int **s, double *agedc, double **agev, int firstpass, int lastpass, int imx, int nlstate, int stepm) |
{ |
{ |
/* Concatenates waves: wav[i] is the number of effective (useful waves) of individual i. |
/* Concatenates waves: wav[i] is the number of effective (useful waves in the sense that a non interview is useless) of individual i. |
Death is a valid wave (if date is known). |
Death is a valid wave (if date is known). |
mw[mi][i] is the mi (mi=1 to wav[i]) effective wave of individual i |
mw[mi][i] is the mi (mi=1 to wav[i]) effective wave of individual i |
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. s[m][i] exists for any wave from firstpass to lastpass |
*/ |
*/ |
|
|
int i=0, mi=0, m=0, mli=0; |
int i=0, mi=0, m=0, mli=0; |
Line 8321 set ter svg size 640, 480\nunset log y\n
|
Line 8341 set ter svg size 640, 480\nunset log y\n
|
}/* End movingaverage */ |
}/* End movingaverage */ |
|
|
|
|
int date2dmy(double date,double *day, double *month, double *year){ |
|
double yp=0., yp1=0., yp2=0.; |
|
|
|
yp1=modf(date,&yp);/* extracts integral of date in yp and |
|
fractional in yp1 */ |
|
*year=yp; |
|
yp2=modf((yp1*12),&yp); |
|
*month=yp; |
|
yp1=modf((yp2*30.5),&yp); |
|
*day=yp; |
|
if(*day==0) *day=1; |
|
if(*month==0) *month=1; |
|
return; |
|
} |
|
|
|
/************** Forecasting ******************/ |
/************** Forecasting ******************/ |
/* void prevforecast(char fileres[], double dateintmean, double anprojd, double mprojd, double jprojd, double ageminpar, double agemax, double dateprev1, double dateprev2, int mobilav, double ***prev, double bage, double fage, int firstpass, int lastpass, double anprojf, double p[], int cptcoveff)*/ |
/* void prevforecast(char fileres[], double dateintmean, double anprojd, double mprojd, double jprojd, double ageminpar, double agemax, double dateprev1, double dateprev2, int mobilav, double ***prev, double bage, double fage, int firstpass, int lastpass, double anprojf, double p[], int cptcoveff)*/ |
Line 10748 int hPijx(double *p, int bage, int fage)
|
Line 10754 int hPijx(double *p, int bage, int fage)
|
/* for (agedeb=fage; agedeb>=bage; agedeb--){ /\* If stepm=6 months *\/ */ |
/* for (agedeb=fage; agedeb>=bage; agedeb--){ /\* If stepm=6 months *\/ */ |
for (agedeb=bage; agedeb<=fage; agedeb++){ /* If stepm=6 months and estepm=24 (2 years) */ |
for (agedeb=bage; agedeb<=fage; agedeb++){ /* If stepm=6 months and estepm=24 (2 years) */ |
/* nhstepm=(int) rint((agelim-agedeb)*YEARM/stepm); /\* Typically 20 years = 20*12/6=40 *\/ */ |
/* nhstepm=(int) rint((agelim-agedeb)*YEARM/stepm); /\* Typically 20 years = 20*12/6=40 *\/ */ |
nhstepm=(int) rint((agedeb-ageminl)*YEARM/stepm); /* Typically 20 years = 20*12/6=40 */ |
nhstepm=(int) rint((agedeb-ageminl)*YEARM/stepm+0.1)-1; /* Typically 20 years = 20*12/6=40 or 55*12/24=27.5-1.1=>27 */ |
nhstepm = nhstepm/hstepm; /* Typically 40/4=10, because estepm=24 stepm=6 => hstepm=24/6=4 */ |
nhstepm = nhstepm/hstepm; /* Typically 40/4=10, because estepm=24 stepm=6 => hstepm=24/6=4 or 28*/ |
|
|
/* nhstepm=nhstepm*YEARM; aff par mois*/ |
/* nhstepm=nhstepm*YEARM; aff par mois*/ |
|
|