From 378aea6f59d66fc35bc80d087cff4a63bbe7aed7 Mon Sep 17 00:00:00 2001 From: "N. Brouard" Date: Sat, 5 Jun 2004 08:57:40 +0000 Subject: [PATCH] *** empty log message *** --- src/ChangeLog | 15 +++++ src/imach.c | 155 +++++++++++++++++++++++++++++++------------------- 2 files changed, 110 insertions(+), 60 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 26c36d7..72f8071 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,18 @@ +2004-05-20 Brouard Nicolas + + * imach.c (Repository): + Agnes added a direct estimation of mortality (without the need of + computing period prevalence and differential mortality). Thus here + is version 0.97a which has been distributed to some people at + REVES 16 in Brugge using an Inno setup.exe for PCs. Estimates of + mortality using covariates is not done today. Estimating direct + mortality is a very different process because it doesn't need + interpolation because it is easy to get the lx from the force of + the mortality mux in the simplest case as for a Gompertz (log mux + = a + b*x . But we have been able to incorporate the new code + within former imach program (0.96d) without deteriorating too much + the understanding of the program. + 2003-06-25 * imach.c (Module): On windows (cygwin) function asctime_r doesn't diff --git a/src/imach.c b/src/imach.c index 303c80b..cb7b1dd 100644 --- a/src/imach.c +++ b/src/imach.c @@ -1,6 +1,28 @@ /* $Id$ $State$ $Log$ + Revision 1.98 2004/05/16 15:05:56 brouard + New version 0.97 . First attempt to estimate force of mortality + directly from the data i.e. without the need of knowing the health + state at each age, but using a Gompertz model: log u =a + b*age . + This is the basic analysis of mortality and should be done before any + other analysis, in order to test if the mortality estimated from the + cross-longitudinal survey is different from the mortality estimated + from other sources like vital statistic data. + + The same imach parameter file can be used but the option for mle should be -3. + + Agnès, who wrote this part of the code, tried to keep most of the + former routines in order to include the new code within the former code. + + The output is very simple: only an estimate of the intercept and of + the slope with 95% confident intervals. + + Current limitations: + A) Even if you enter covariates, i.e. with the + model= V1+V2 equation for example, the programm does only estimate a unique global model without covariates. + B) There is no computation of Life Expectancy nor Life Table. + Revision 1.97 2004/02/20 13:25:42 lievre Version 0.96d. Population forecasting command line is (temporarily) suppressed. @@ -174,7 +196,7 @@ #include #include -#include +/* #include */ #include #include "timeval.h" @@ -213,7 +235,7 @@ /* $Id$ */ /* $State$ */ -char version[]="Imach version 0.70, May 2004, INED-EUROREVES "; +char version[]="Imach version 0.97b, May 2004, INED-EUROREVES "; char fullversion[]="$Revision$ $Date$"; int erreur, nberr=0, nbwarn=0; /* Error number, number of errors number of warnings */ int nvar; @@ -334,6 +356,9 @@ double ftolhess; /* Tolerance for computing hessian */ /**************** split *************************/ static int split( char *path, char *dirc, char *name, char *ext, char *finame ) { + /* From a file name with full path (either Unix or Windows) we extract the directory (dirc) + the name of the file (name), its extension only (ext) and its first part of the name (finame) + */ char *ss; /* pointer */ int l1, l2; /* length counters */ @@ -365,12 +390,14 @@ static int split( char *path, char *dirc, char *name, char *ext, char *finame ) #endif */ ss = strrchr( name, '.' ); /* find last / */ - ss++; - strcpy(ext,ss); /* save extension */ - l1= strlen( name); - l2= strlen(ss)+1; - strncpy( finame, name, l1-l2); - finame[l1-l2]= 0; + if (ss >0){ + ss++; + strcpy(ext,ss); /* save extension */ + l1= strlen( name); + l2= strlen(ss)+1; + strncpy( finame, name, l1-l2); + finame[l1-l2]= 0; + } return( 0 ); /* we're done */ } @@ -1028,57 +1055,57 @@ double **pmij(double **ps, double *cov, int ncovmodel, double *x, int nlstate ) int i,j,j1, nc, ii, jj; for(i=1; i<= nlstate; i++){ - for(j=1; ji s1=%.17e, s2=%.17e %lx %lx\n",s1,s2,s1,s2);*/ + for(j=i+1; j<=nlstate+ndeath;j++){ + for (nc=1, s2=0.;nc <=ncovmodel; nc++){ + s2 += x[(i-1)*nlstate*ncovmodel+(j-2)*ncovmodel+nc+(i-1)*(ndeath-1)*ncovmodel]*cov[nc]; +/* printf("Int j>i s1=%.17e, s2=%.17e %lx %lx\n",s1,s2,s1,s2); */ + } + ps[i][j]=s2; } - ps[i][j]=s2; } - } /*ps[3][2]=1;*/ - - for(i=1; i<= nlstate; i++){ - s1=0; - for(j=1; j\n",\ /*------ End -----------*/ chdir(path); - strcpy(plotcmd,GNUPLOTPROGRAM); + strcpy(plotcmd,"\""); + strcat(plotcmd,pathimach); + strcat(plotcmd,GNUPLOTPROGRAM); + strcat(plotcmd,"\""); strcat(plotcmd," "); strcat(plotcmd,optionfilegnuplot); printf("Starting graphs with: %s",plotcmd);fflush(stdout); @@ -5402,7 +5434,10 @@ Interval (in months) between two waves: Min=%d Max=%d Mean=%.2lf
\n",\ printf("\nType e to edit output files, g to graph again and q for exiting: "); scanf("%s",z); /* if (z[0] == 'c') system("./imach"); */ - if (z[0] == 'e') system(optionfilehtm); + if (z[0] == 'e') { + printf("Starting browser with: %s",optionfilehtm);fflush(stdout); + system(optionfilehtm); + } else if (z[0] == 'g') system(plotcmd); else if (z[0] == 'q') exit(0); } -- 2.43.0