]> henry.ined.fr Git - .git/commitdiff
I changed some comments
authorN. Brouard <brouard@ined.fr>
Tue, 28 Jan 2003 17:23:35 +0000 (17:23 +0000)
committerN. Brouard <brouard@ined.fr>
Tue, 28 Jan 2003 17:23:35 +0000 (17:23 +0000)
src/imach.c

index 75d59e872c886c58f22e31553ef2f7e91b4df770..c86c3feadd84c334060427abb4da7aa8f12d28e8 100644 (file)
@@ -32,8 +32,8 @@
   hPijx is the probability to be observed in state i at age x+h
   conditional to the observed state i at age x. The delay 'h' can be
   split into an exact number (nh*stepm) of unobserved intermediate
-  states. This elementary transition (by month or quarter trimester,
-  semester or year) is model as a multinomial logistic.  The hPx
+  states. This elementary transition (by month, quarter,
+  semester or year) is modelled as a multinomial logistic.  The hPx
   matrix is simply the matrix product of nh*stepm elementary matrices
   and the contribution of each individual to the likelihood is simply
   hPijx.
@@ -83,7 +83,7 @@
 #define ODIRSEPARATOR '\\'
 #endif
 
-char version[80]="Imach version 0.9, November 2002, INED-EUROREVES ";
+char version[80]="Imach version 0.91, November 2002, INED-EUROREVES ";
 int erreur; /* Error number */
 int nvar;
 int cptcovn=0, cptcovage=0, cptcoveff=0,cptcov;
@@ -856,11 +856,13 @@ double **matprod2(double **out, double **in,long nrl, long nrh, long ncl, long n
 
 double ***hpxij(double ***po, int nhstepm, double age, int hstepm, double *x, int nlstate, int stepm, double **oldm, double **savm, int ij )
 {
-  /* Computes the transition matrix starting at age 'age' over 'nhstepm*hstepm*stepm' month 
-     duration (i.e. until
-     age (in years)  age+nhstepm*stepm/12) by multiplying nhstepm*hstepm matrices. 
+  /* Computes the transition matrix starting at age 'age' over 
+     'nhstepm*hstepm*stepm' months (i.e. until
+     age (in years)  age+nhstepm*hstepm*stepm/12) by multiplying 
+     nhstepm*hstepm matrices. 
      Output is stored in matrix po[i][j][h] for h every 'hstepm' step 
-     (typically every 2 years instead of every month which is too big).
+     (typically every 2 years instead of every month which is too big 
+     for the memory).
      Model is determined by parameters x and covariates have to be 
      included manually here. 
 
@@ -1844,7 +1846,7 @@ void evsij(char fileres[], double ***eij, double x[], int nlstate, int stepm, in
    * This is mainly to measure the difference between two models: for example
    * if stepm=24 months pijx are given only every 2 years and by summing them
    * we are calculating an estimate of the Life Expectancy assuming a linear 
-   * progression inbetween and thus overestimating or underestimating according
+   * progression in between and thus overestimating or underestimating according
    * to the curvature of the survival function. If, for the same date, we 
    * estimate the model with stepm=1 month, we can keep estepm to 24 months
    * to compare the new estimate of Life expectancy with the same linear 
@@ -2034,7 +2036,7 @@ void varevsij(char optionfilefiname[], double ***vareij, double **matcov, double
   }
   printf("Computing total mortality p.j=w1*p1j+w2*p2j+..: result on file '%s' \n",fileresprobmorprev);
   fprintf(ficlog,"Computing total mortality p.j=w1*p1j+w2*p2j+..: result on file '%s' \n",fileresprobmorprev);
-  fprintf(ficresprobmorprev,"# probabilities of dying during a year and weighted mean w1*p1j+w2*p2j+... stand dev in()\n");
+  fprintf(ficresprobmorprev,"# probabilities of dying before estepm=%d months for people of exact age and weighted probabilities w1*p1j+w2*p2j+... stand dev in()\n",estepm);
   fprintf(ficresprobmorprev,"# Age cov=%-d",ij);
   for(j=nlstate+1; j<=(nlstate+ndeath);j++){
     fprintf(ficresprobmorprev," p.%-d SE",j);
@@ -2091,7 +2093,7 @@ void varevsij(char optionfilefiname[], double ***vareij, double **matcov, double
      and note for a fixed period like k years */
   /* We decided (b) to get a life expectancy respecting the most precise curvature of the
      survival function given by stepm (the optimization length). Unfortunately it
-     means that if the survival funtion is printed only each two years of age and if
+     means that if the survival funtion is printed every two years of age and if
      you sum them up and add 1 year (area under the trapezoids) you won't get the same 
      results. So we changed our mind and took the option of the best precision.
   */
@@ -2107,7 +2109,7 @@ void varevsij(char optionfilefiname[], double ***vareij, double **matcov, double
 
 
     for(theta=1; theta <=npar; theta++){
-      for(i=1; i<=npar; i++){ /* Computes gradient */
+      for(i=1; i<=npar; i++){ /* Computes gradient x + delta*/
        xp[i] = x[i] + (i==theta ?delti[theta]:0);
       }
       hpxij(p3mat,nhstepm,age,hstepm,xp,nlstate,stepm,oldm,savm, ij);  
@@ -2129,14 +2131,17 @@ void varevsij(char optionfilefiname[], double ***vareij, double **matcov, double
            gp[h][j] += prlim[i][i]*p3mat[i][j][h];
        }
       }
-      /* This for computing forces of mortality (h=1)as a weighted average */
+      /* This for computing probability of death (h=1 means
+         computed over hstepm matrices product = hstepm*stepm months) 
+         as a weighted average of prlim.
+      */
       for(j=nlstate+1,gpp[j]=0.;j<=nlstate+ndeath;j++){
        for(i=1; i<= nlstate; i++)
          gpp[j] += prlim[i][i]*p3mat[i][j][1];
       }    
-      /* end force of mortality */
+      /* end probability of death */
 
-      for(i=1; i<=npar; i++) /* Computes gradient */
+      for(i=1; i<=npar; i++) /* Computes gradient x - delta */
        xp[i] = x[i] - (i==theta ?delti[theta]:0);
       hpxij(p3mat,nhstepm,age,hstepm,xp,nlstate,stepm,oldm,savm, ij);  
       prevalim(prlim,nlstate,xp,age,oldm,savm,ftolpl,ij);
@@ -2157,12 +2162,15 @@ void varevsij(char optionfilefiname[], double ***vareij, double **matcov, double
            gm[h][j] += prlim[i][i]*p3mat[i][j][h];
        }
       }
-      /* This for computing force of mortality (h=1)as a weighted average */
+      /* This for computing probability of death (h=1 means
+         computed over hstepm matrices product = hstepm*stepm months) 
+         as a weighted average of prlim.
+      */
       for(j=nlstate+1,gmp[j]=0.;j<=nlstate+ndeath;j++){
        for(i=1; i<= nlstate; i++)
          gmp[j] += prlim[i][i]*p3mat[i][j][1];
       }    
-      /* end force of mortality */
+      /* end probability of death */
 
       for(j=1; j<= nlstate; j++) /* vareij */
        for(h=0; h<=nhstepm; h++){
@@ -2207,6 +2215,7 @@ void varevsij(char optionfilefiname[], double ***vareij, double **matcov, double
       for(i=nlstate+1;i<=nlstate+ndeath;i++)
        varppt[j][i]=doldmp[j][i];
     /* end ppptj */
+    /*  x centered again */
     hpxij(p3mat,nhstepm,age,hstepm,x,nlstate,stepm,oldm,savm, ij);  
     prevalim(prlim,nlstate,x,age,oldm,savm,ftolpl,ij);
  
@@ -2220,12 +2229,15 @@ void varevsij(char optionfilefiname[], double ***vareij, double **matcov, double
       }
     }
     
-    /* This for computing force of mortality (h=1)as a weighted average */
+    /* This for computing probability of death (h=1 means
+       computed over hstepm (estepm) matrices product = hstepm*stepm months) 
+       as a weighted average of prlim.
+    */
     for(j=nlstate+1,gmp[j]=0.;j<=nlstate+ndeath;j++){
       for(i=1; i<= nlstate; i++)
        gmp[j] += prlim[i][i]*p3mat[i][j][1]; 
     }    
-    /* end force of mortality */
+    /* end probability of death */
 
     fprintf(ficresprobmorprev,"%3d %d ",(int) age, ij);
     for(j=nlstate+1; j<=(nlstate+ndeath);j++){
@@ -2259,7 +2271,7 @@ void varevsij(char optionfilefiname[], double ***vareij, double **matcov, double
   fprintf(ficgp,"\n replot \"%s\"  u 1:(($3+1.96*$4)*%6.3f) t \"95\%% interval\" w l 2 ",fileresprobmorprev,YEARM/estepm);
   fprintf(ficgp,"\n replot \"%s\"  u 1:(($3-1.96*$4)*%6.3f) not w l 2 ",fileresprobmorprev,YEARM/estepm);
   fprintf(fichtm,"\n<br> File (multiple files are possible if covariates are present): <A href=\"%s\">%s</a>\n",fileresprobmorprev,fileresprobmorprev);
-  fprintf(fichtm,"\n<br> Probability is computed over estepm=%d months. <br> <img src=\"varmuptjgr%s%s.png\"> <br>\n", stepm,digitp,digit);
+  fprintf(fichtm,"\n<br> Probability is computed over estepm=%d months. <br> <img src=\"varmuptjgr%s%s.png\"> <br>\n", estepm,digitp,digit);
   /*  fprintf(fichtm,"\n<br> Probability is computed over estepm=%d months and then divided by estepm and multiplied by %.0f in order to have the probability to die over a year <br> <img src=\"varmuptjgr%s%s.png\"> <br>\n", stepm,YEARM,digitp,digit);
 */
   fprintf(ficgp,"\nset out \"varmuptjgr%s%s.png\";replot;",digitp,digit);