/* $Id$
$State$
$Log$
+ Revision 1.316 2022/05/11 15:11:31 brouard
+ Summary: r27
+
Revision 1.315 2022/05/11 15:06:32 brouard
*** empty log message ***
#endif
#ifdef LINMINORIGINAL
#else
- if(fb == fx){ /* Flat function in the direction */
- xmin=xx;
+ if(fb == fx){ /* Flat function in the direction */
+ xmin=xx;
*flat=1;
- }else{
+ }else{
*flat=0;
#endif
/*Flat mnbrak2 shift (*ax=0.000000000000, *fa=51626.272983130431), (*bx=-1.618034000000, *fb=51590.149499362531), (*cx=-4.236068025156, *fc=51590.149499362531) */
/*************** powell ************************/
/*
-Minimization of a function func of n variables. Input consists of an initial starting point
-p[1..n] ; an initial matrix xi[1..n][1..n] , whose columns contain the initial set of di-
-rections (usually the n unit vectors); and ftol , the fractional tolerance in the function value
-such that failure to decrease by more than this amount on one iteration signals doneness. On
+Minimization of a function func of n variables. Input consists in an initial starting point
+p[1..n] ; an initial matrix xi[1..n][1..n] whose columns contain the initial set of di-
+rections (usually the n unit vectors); and ftol, the fractional tolerance in the function value
+such that failure to decrease by more than this amount in one iteration signals doneness. On
output, p is set to the best point found, xi is the then-current direction set, fret is the returned
function value at p , and iter is the number of iterations taken. The routine linmin is used.
*/
if(!first){
first=1;
printf("Warning: the stable prevalence at age %d did not converge with the required precision (%g > ftolpl=%g) within %.d years and %d loops. Try to lower 'ftolpl'. Youngest age to start was %d=(%d-%d). Others in log file only...\n", (int)age, maxmax, ftolpl, *ncvyear, ncvloop, (int)(agefin+stepm/YEARM), (int)(age-stepm/YEARM), (int)delaymax);
+ fprintf(ficlog, "Warning: the stable prevalence at age %d did not converge with the required precision (%g > ftolpl=%g) within %.d years and %d loops. Try to lower 'ftolpl'. Youngest age to start was %d=(%d-%d).\n", (int)age, maxmax, ftolpl, *ncvyear, ncvloop, (int)(agefin+stepm/YEARM), (int)(age-stepm/YEARM), (int)delaymax);
+ }else if (first >=1 && first <10){
+ fprintf(ficlog, "Warning: the stable prevalence at age %d did not converge with the required precision (%g > ftolpl=%g) within %.d years and %d loops. Try to lower 'ftolpl'. Youngest age to start was %d=(%d-%d).\n", (int)age, maxmax, ftolpl, *ncvyear, ncvloop, (int)(agefin+stepm/YEARM), (int)(age-stepm/YEARM), (int)delaymax);
+ first++;
+ }else if (first ==10){
+ fprintf(ficlog, "Warning: the stable prevalence at age %d did not converge with the required precision (%g > ftolpl=%g) within %.d years and %d loops. Try to lower 'ftolpl'. Youngest age to start was %d=(%d-%d).\n", (int)age, maxmax, ftolpl, *ncvyear, ncvloop, (int)(agefin+stepm/YEARM), (int)(age-stepm/YEARM), (int)delaymax);
+ printf("Warning: the stable prevalence dit not converge. This warning came too often, IMaCh will stop notifying, even in its log file. Look at the graphs to appreciate the non convergence.\n");
+ fprintf(ficlog,"Warning: the stable prevalence no convergence; too many cases, giving up noticing, even in log file\n");
+ first++;
}
- fprintf(ficlog, "Warning: the stable prevalence at age %d did not converge with the required precision (%g > ftolpl=%g) within %.d years and %d loops. Try to lower 'ftolpl'. Youngest age to start was %d=(%d-%d).\n", (int)age, maxmax, ftolpl, *ncvyear, ncvloop, (int)(agefin+stepm/YEARM), (int)(age-stepm/YEARM), (int)delaymax);
/* 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);
#ifdef UNKNOWNSTATUSNOTCONTRIBUTING
break;
#else
- if(s[m][i]==-1 && (int) andc[i] == 9999 && (int)anint[m][i] != 9999){ /* case -2 (vital status unknown is warned later */
+ if(s[m][i]==-1 && (int) andc[i] == 9999 && (int)anint[m][i] != 9999){ /* no death date and known date of interview, case -2 (vital status unknown is warned later */
if(firsthree == 0){
printf("Information! Unknown status for individual %ld line=%d occurred at last wave %d at known date %d/%d. Please, check if your unknown date of death %d/%d means a live state %d at wave %d. This case(%d)/wave(%d) contributes to the likelihood as 1-p_{%d%d} .\nOthers in log file only\n",num[i],i,lastpass,(int)mint[m][i],(int)anint[m][i], (int) moisdc[i], (int) andc[i], s[m][i], m, i, m, s[m][i], nlstate+ndeath);
firsthree=1;
+ }else if(firsthree >=1 && firsthree < 10){
+ fprintf(ficlog,"Information! Unknown status for individual %ld line=%d occurred at last wave %d at known date %d/%d. Please, check if your unknown date of death %d/%d means a live state %d at wave %d. This case(%d)/wave(%d) contributes to the likelihood as 1-p_{%d%d} .\n",num[i],i,lastpass,(int)mint[m][i],(int)anint[m][i], (int) moisdc[i], (int) andc[i], s[m][i], m, i, m, s[m][i], nlstate+ndeath);
+ firsthree++;
+ }else if(firsthree == 10){
+ printf("Information, too many Information flags: no more reported to log either\n");
+ fprintf(ficlog,"Information, too many Information flags: no more reported to log either\n");
+ firsthree++;
+ }else{
+ firsthree++;
}
- fprintf(ficlog,"Information! Unknown status for individual %ld line=%d occurred at last wave %d at known date %d/%d. Please, check if your unknown date of death %d/%d means a live state %d at wave %d. This case(%d)/wave(%d) contributes to the likelihood as 1-p_{%d%d} .\n",num[i],i,lastpass,(int)mint[m][i],(int)anint[m][i], (int) moisdc[i], (int) andc[i], s[m][i], m, i, m, s[m][i], nlstate+ndeath);
mw[++mi][i]=m; /* Valid transition with unknown status */
mli=m;
}
} /* End individuals */
/* wav and mw are no more changed */
-
+ printf("Information, you have to check %d informations which haven't been logged!\n",firsthree);
+ fprintf(ficlog,"Information, you have to check %d informations which haven't been logged!\n",firsthree);
+
+
for(i=1; i<=imx; i++){
for(mi=1; mi<wav[i];mi++){
if (stepm <=0)
m=pow(2,cptcoveff);
if (cptcovn < 1) {m=1;ncodemax[1]=1;}
- fprintf(fichtm," \n<ul><li><b>Graphs</b></li><p>");
+ fprintf(fichtm," \n<ul><li><b>Graphs (first order)</b></li><p>");
jj1=0;
fprintf(fichtm,"</a></li>");
} /* cptcovn >0 */
}
- fprintf(fichtm," \n</ul>");
+ fprintf(fichtm," \n</ul>");
jj1=0;
/* else */
/* fprintf(fichtm,"\n No population forecast: popforecast = %d (instead of 1) or stepm = %d (instead of 1) or model=%s (instead of .)<br><br></li>\n",popforecast, stepm, model); */
fflush(fichtm);
- fprintf(fichtm," <ul><li><b>Graphs</b></li><p>");
m=pow(2,cptcoveff);
if (cptcovn < 1) {m=1;ncodemax[1]=1;}
+ fprintf(fichtm," <ul><li><b>Graphs (second order)</b></li><p>");
+
+ jj1=0;
+
+ fprintf(fichtm," \n<ul>");
+ for(nres=1; nres <= nresult; nres++) /* For each resultline */
+ for(k1=1; k1<=m;k1++){ /* For each combination of covariate */
+ if(m != 1 && TKresult[nres]!= k1)
+ continue;
+ jj1++;
+ if (cptcovn > 0) {
+ fprintf(fichtm,"\n<li><a size=\"1\" color=\"#EC5E5E\" href=\"#rescovsecond");
+ for (cpt=1; cpt<=cptcoveff;cpt++){
+ fprintf(fichtm,"_V%d=%d_",Tvresult[nres][cpt],(int)Tresult[nres][cpt]);
+ }
+ for (k4=1; k4<= nsq; k4++){ /* For each selected (single) quantitative value */
+ fprintf(fichtm,"_V%d=%f_",Tvqresult[nres][k4],Tqresult[nres][k4]);
+ }
+ fprintf(fichtm,"\">");
+
+ /* if(nqfveff+nqtveff 0) */ /* Test to be done */
+ fprintf(fichtm,"************ Results for covariates");
+ for (cpt=1; cpt<=cptcoveff;cpt++){
+ fprintf(fichtm," V%d=%d ",Tvresult[nres][cpt],(int)Tresult[nres][cpt]);
+ }
+ for (k4=1; k4<= nsq; k4++){ /* For each selected (single) quantitative value */
+ fprintf(fichtm," V%d=%f ",Tvqresult[nres][k4],Tqresult[nres][k4]);
+ }
+ if(invalidvarcomb[k1]){
+ fprintf(fichtm," Warning Combination (%d) ignored because no cases ",k1);
+ continue;
+ }
+ fprintf(fichtm,"</a></li>");
+ } /* cptcovn >0 */
+ }
+ fprintf(fichtm," \n</ul>");
+
jj1=0;
for(nres=1; nres <= nresult; nres++){ /* For each resultline */
/* for(i1=1; i1<=ncodemax[k1];i1++){ */
jj1++;
if (cptcovn > 0) {
+ fprintf(fichtm,"\n<p><a name=\"rescovsecond");
+ for (cpt=1; cpt<=cptcoveff;cpt++){
+ fprintf(fichtm,"_V%d=%d_",Tvresult[nres][cpt],(int)Tresult[nres][cpt]);
+ }
+ for (k4=1; k4<= nsq; k4++){ /* For each selected (single) quantitative value */
+ fprintf(fichtm,"_V%d=%f_",Tvqresult[nres][k4],Tqresult[nres][k4]);
+ }
+ fprintf(fichtm,"\"</a>");
+
fprintf(fichtm,"<hr size=\"2\" color=\"#EC5E5E\">************ Results for covariates");
- for (cpt=1; cpt<=cptcoveff;cpt++) /**< cptcoveff number of variables */
+ for (cpt=1; cpt<=cptcoveff;cpt++){ /**< cptcoveff number of variables */
fprintf(fichtm," V%d=%d ",Tvresult[nres][cpt],Tresult[nres][cpt]);
+ printf(" V%d=%d ",Tvresult[nres][cpt],Tresult[nres][cpt]);fflush(stdout);
/* fprintf(fichtm," V%d=%d ",Tvaraff[cpt],nbcode[Tvaraff[cpt]][codtabm(jj1,cpt)]); */
+ }
for (k4=1; k4<= nsq; k4++){ /* For each selected (single) quantitative value */
fprintf(fichtm," V%d=%f ",Tvqresult[nres][k4],Tqresult[nres][k4]);
}
double ftolpl=FTOL;
double **prlim;
double **bprlim;
- double ***param; /* Matrix of parameters */
+ double ***param; /* Matrix of parameters, param[i][j][k] param=ma3x(1,nlstate,1,nlstate+ndeath-1,1,ncovmodel)
+ state of origin, state of destination including death, for each covariate: constante, age, and V1 V2 etc. */
double ***paramstart; /* Matrix of starting parameter values */
double *p, *pstart; /* p=param[1][1] pstart is for starting values guessed by freqsummary */
double **matcov; /* Matrix of covariance */
<img src=\"%s_.svg\">", subdirf2(optionfilefiname,"D_"),subdirf2(optionfilefiname,"D_"),subdirf2(optionfilefiname,"D_"));
- fprintf(fichtm,"\n<h4>Some descriptive statistics </h4>\n<br>Total number of observations=%d <br>\n\
+ fprintf(fichtm,"\n<h4>Some descriptive statistics </h4>\n<br>Number of (used) observations=%d <br>\n\
Youngest age at first (selected) pass %.2f, oldest age %.2f<br>\n\
Interval (in months) between two waves: Min=%d Max=%d Mean=%.2lf<br>\n",\
imx,agemin,agemax,jmin,jmax,jmean);