From: NBrouard Date: Sat, 23 Nov 2024 17:51:12 +0000 (+0100) Subject: Minor change: clarifying when agemin and agemax are not big X-Git-Url: https://henry.ined.fr/git/?a=commitdiff_plain;h=HEAD;p=.git Minor change: clarifying when agemin and agemax are not big When agemin and agemax are not englobing extreme ages of persons in the sample, there was an error, but not fully documented. These extreme ages are often errors in the data (which are now revealed). But if not, you can enlarge the range agemin:agemax. --- diff --git a/CMakeLists.txt b/CMakeLists.txt index b30785d..b12f763 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,7 +9,7 @@ CMAKE_MINIMUM_REQUIRED(VERSION 3.13..3.26.3) set(PACKAGE_NAME "imach") SET(IMACH_VERSION_MAJOR 0) -SET(IMACH_VERSION_MINOR 99s12) +SET(IMACH_VERSION_MINOR 99s13) SET(IMACH_VERSION_PATCH 0) SET(IMACH_VERSION_NOTE "") SET(IMACH_VERSION ${IMACH_VERSION_MAJOR}.${IMACH_VERSION_MINOR}) diff --git a/src/imach.c b/src/imach.c index 654bae1..ee5b88f 100644 --- a/src/imach.c +++ b/src/imach.c @@ -2770,7 +2770,6 @@ void linmin(double p[], double xi[], int n, double *fret,double (*func)(double [ #include /* for DBL_EPSILON */ /* #include "machine.h" */ - /* extern void minfit(int n, double eps, double tol, double **ab, double q[]); */ /* extern void minfit(int n, double eps, double tol, double ab[N][N], double q[]); */ /* control parameters */ @@ -3568,7 +3567,7 @@ TestFconvergence: if (l == k) goto Convergence; /* shift from bottom 2x2 minor */ - /* x = q[l]; y = q[k-l]; g = e[k-1]; h = e[k]; */ /* Error */ + /* x = q[l]; y = q[k-l]; g = e[k-1]; h = e[k]; */ /* Gegenfurtner Error */ x = q[l]; y = q[k-1]; g = e[k-1]; h = e[k]; f = ((y-z)*(y+z) + (g-h)*(g+h)) / (2.0*h*y); g = sqrt(f*f+1.0); @@ -3666,7 +3665,7 @@ double praxis(double tol, double macheps, double h0, int _n, int _prin, double * int seed; /* added */ - int biter=0; + int biter=0; /* added */ double r; double randbrent( int (*)); double s, sf; @@ -4098,6 +4097,7 @@ mloop: } } for (i=1; i<=n; i++) + /* Transposing v before golub */ /* for (j=0; j<=i-1; j++) { */ /* for (j=1; j<=i; j++) { */ for (j=1; j<=i-1; j++) { @@ -4151,6 +4151,7 @@ mloop: } /* for (i=0; i large) @@ -7848,7 +7849,7 @@ void prevalence(double ***probs, double agemin, double agemax, int **s, double * printf("Prevalence combination of varying and fixed dummies %d\n",j1); /* fprintf(ficlog," V%d=%d ",Tvaraff[j1],nbcode[Tvaraff[j1]][codtabm(k,j1)]); */ fprintf(ficlog,"Prevalence combination of varying and fixed dummies %d\n",j1); - + int ierroragemin=0;int ierroragemax=0; for (i=1; i<=imx; i++) { /* Each individual */ bool=1; /* for(m=firstpass; m<=lastpass; m++){/\* Other selection (we can limit to certain interviews*\/ */ @@ -7874,9 +7875,13 @@ void prevalence(double ***probs, double agemin, double agemax, int **s, double * if ((y2>=dateprev1) && (y2<=dateprev2)) { /* Here is the main selection (fractional years) */ if(agev[m][i]==0) agev[m][i]=iagemax+1; if(agev[m][i]==1) agev[m][i]=iagemax+2; - if((int)agev[m][i] iagemax+4+AGEMARGE){ - printf("Error on individual # %d agev[m][i]=%f <%d-%d or > %d+3+%d m=%d; either change agemin or agemax or fix data\n",i, agev[m][i],iagemin,AGEMARGE, iagemax,AGEMARGE,m); - exit(1); + if((int)agev[m][i] iagemax+4+AGEMARGE){ + ierroragemax++; + printf("Error on individual # ...%09ld around line %d agev[m][i]=%f > %d+3+%d=%d m=%d;increase 'agemax' or fix data\n",num[i],i, agev[m][i],iagemax,AGEMARGE, iagemax+AGEMARGE,m); } if (s[m][i]>0 && s[m][i]<=nlstate) { /*if(i>4620) printf(" i=%d m=%d s[m][i]=%d (int)agev[m][i]=%d weight[i]=%f prop=%f\n",i,m,s[m][i],(int)agev[m][m],weight[i],prop[s[m][i]][(int)agev[m][i]]);*/ @@ -7888,6 +7893,13 @@ void prevalence(double ***probs, double agemin, double agemax, int **s, double * } /* end bool */ } /* end wave */ } /* end individual */ + if(ierroragemin>=1 || ierroragemax>=1){ + if(ierroragemin>=1) + printf("%d error(s) on extreme joung age(s) of persons, check data or decrease agemin=%d\n",ierroragemin,iagemin); + if(ierroragemax>=1) + printf("%d error(s) on extreme old age(s) of persons, check data or increase agemax=%d\n",ierroragemax,iagemax); + exit(1); + } for(i=iagemin; i <= iagemax+3; i++){ for(jk=1,posprop=0; jk <=nlstate ; jk++) { posprop += prop[jk][i]; diff --git a/src/version.h b/src/version.h index bb0755c..ec41754 100644 --- a/src/version.h +++ b/src/version.h @@ -1,5 +1,5 @@ #define __IMACH_VERSION_MAJOR__ 0 -#define __IMACH_VERSION_MINOR__ 99s12 +#define __IMACH_VERSION_MINOR__ 99s13 #define __IMACH_VERSION_PATCH__ 0 -#define __IMACH_VERSION__ "0.99s12" +#define __IMACH_VERSION__ "0.99s13"