--- imach096d/src/imach.c 2002/03/12 22:13:38 1.33
+++ imach096d/src/imach.c 2002/03/13 17:19:16 1.34
@@ -1,4 +1,4 @@
-/* $Id: imach.c,v 1.33 2002/03/12 22:13:38 brouard Exp $
+/* $Id: imach.c,v 1.34 2002/03/13 17:19:16 brouard Exp $
Interpolated Markov Chain
Short summary of the programme:
@@ -82,7 +82,7 @@ int cptcovn, cptcovage=0, cptcoveff=0,cp
int npar=NPARMAX;
int nlstate=2; /* Number of live states */
int ndeath=1; /* Number of dead states */
-int ncovmodel, ncov; /* Total number of covariables including constant a12*1 +b12*x ncovmodel=2 */
+int ncovmodel, ncovcol; /* Total number of covariables including constant a12*1 +b12*x ncovmodel=2 */
int popbased=0;
int *wav; /* Number of waves for this individuual 0 is possible */
@@ -1513,7 +1513,7 @@ void tricode(int *Tvar, int **nbcode, in
ij=1;
for (i=1; i<=10; i++) {
- if((Ndum[i]!=0) && (i<=ncov)){
+ if((Ndum[i]!=0) && (i<=ncovcol)){
Tvaraff[ij]=i;
ij++;
}
@@ -1903,7 +1903,7 @@ void printinghtml(char fileres[], char t
printf("Problem with %s \n",optionfilehtm), exit(0);
}
- fprintf(fichtm,"
Imach, Version 0.71e
+ fprintf(fichtm," Imach, Version 0.8
Title=%s
Datafile=%s Firstpass=%d Lastpass=%d Stepm=%d Weight=%d Model=%s
Total number of observations=%d
@@ -2466,7 +2466,7 @@ int main(int argc, char *argv[])
double dateprev1, dateprev2,jproj1,mproj1,anproj1,jproj2,mproj2,anproj2;
- char version[80]="Imach version 0.71e, March 2002, INED-EUROREVES ";
+ char version[80]="Imach version 0.8, March 2002, INED-EUROREVES ";
char *alph[]={"a","a","b","c","d","e"}, str[4];
@@ -2527,9 +2527,9 @@ int main(int argc, char *argv[])
}
ungetc(c,ficpar);
- fscanf(ficpar,"title=%s datafile=%s lastobs=%d firstpass=%d lastpass=%d\nftol=%lf stepm=%d ncov=%d nlstate=%d ndeath=%d maxwav=%d mle=%d weight=%d\nmodel=%s\n",title, datafile, &lastobs, &firstpass,&lastpass,&ftol, &stepm, &ncov, &nlstate,&ndeath, &maxwav, &mle, &weightopt,model);
- printf("title=%s datafile=%s lastobs=%d firstpass=%d lastpass=%d\nftol=%e stepm=%d ncov=%d nlstate=%d ndeath=%d maxwav=%d mle=%d weight=%d\nmodel=%s\n", title, datafile, lastobs, firstpass,lastpass,ftol, stepm, ncov, nlstate,ndeath, maxwav, mle, weightopt,model);
- fprintf(ficparo,"title=%s datafile=%s lastobs=%d firstpass=%d lastpass=%d\nftol=%e stepm=%d ncov=%d nlstate=%d ndeath=%d maxwav=%d mle=%d weight=%d\nmodel=%s\n", title, datafile, lastobs, firstpass,lastpass,ftol,stepm,ncov,nlstate,ndeath,maxwav, mle, weightopt,model);
+ fscanf(ficpar,"title=%s datafile=%s lastobs=%d firstpass=%d lastpass=%d\nftol=%lf stepm=%d ncovcol=%d nlstate=%d ndeath=%d maxwav=%d mle=%d weight=%d\nmodel=%s\n",title, datafile, &lastobs, &firstpass,&lastpass,&ftol, &stepm, &ncovcol, &nlstate,&ndeath, &maxwav, &mle, &weightopt,model);
+ printf("title=%s datafile=%s lastobs=%d firstpass=%d lastpass=%d\nftol=%e stepm=%d ncovcol=%d nlstate=%d ndeath=%d maxwav=%d mle=%d weight=%d\nmodel=%s\n", title, datafile, lastobs, firstpass,lastpass,ftol, stepm, ncovcol, nlstate,ndeath, maxwav, mle, weightopt,model);
+ fprintf(ficparo,"title=%s datafile=%s lastobs=%d firstpass=%d lastpass=%d\nftol=%e stepm=%d ncovcol=%d nlstate=%d ndeath=%d maxwav=%d mle=%d weight=%d\nmodel=%s\n", title, datafile, lastobs, firstpass,lastpass,ftol,stepm,ncovcol,nlstate,ndeath,maxwav, mle, weightopt,model);
while((c=getc(ficpar))=='#' && c!= EOF){
ungetc(c,ficpar);
fgets(line, MAXLINE, ficpar);
@@ -2686,7 +2686,7 @@ while((c=getc(ficpar))=='#' && c!= EOF){
cutv(stra, strb,line,' '); moisnais[i]=(double)(atoi(strb)); strcpy(line,stra);
cutv(stra, strb,line,' '); weight[i]=(double)(atoi(strb)); strcpy(line,stra);
- for (j=ncov;j>=1;j--){
+ for (j=ncovcol;j>=1;j--){
cutv(stra, strb,line,' '); covar[j][i]=(double)(atoi(strb)); strcpy(line,stra);
}
num[i]=atol(stra);
@@ -2755,7 +2755,7 @@ while((c=getc(ficpar))=='#' && c!= EOF){
}
else {
cutv(strb,stre,strc,'V');
- Tvar[i]=ncov+k1;
+ Tvar[i]=ncovcol+k1;
cutv(strb,strc,strd,'V');
Tprod[k1]=i;
Tvard[k1][1]=atoi(strc);
@@ -2763,7 +2763,7 @@ while((c=getc(ficpar))=='#' && c!= EOF){
Tvar[cptcovn+k2]=Tvard[k1][1];
Tvar[cptcovn+k2+1]=Tvard[k1][2];
for (k=1; k<=lastobs;k++)
- covar[ncov+k1][k]=covar[atoi(stre)][k]*covar[atoi(strc)][k];
+ covar[ncovcol+k1][k]=covar[atoi(stre)][k]*covar[atoi(strc)][k];
k1++;
k2=k2+2;
}
@@ -2917,12 +2917,12 @@ printf("Total number of individuals= %d,
}
/*--------- results files --------------*/
- fprintf(ficres,"title=%s datafile=%s lastobs=%d firstpass=%d lastpass=%d\nftol=%e stepm=%d ncov=%d nlstate=%d ndeath=%d maxwav=%d mle= 0 weight=%d\nmodel=%s\n", title, datafile, lastobs, firstpass,lastpass,ftol, stepm, ncov, nlstate, ndeath, maxwav, weightopt,model);
+ fprintf(ficres,"title=%s datafile=%s lastobs=%d firstpass=%d lastpass=%d\nftol=%e stepm=%d ncovcol=%d nlstate=%d ndeath=%d maxwav=%d mle= 0 weight=%d\nmodel=%s\n", title, datafile, lastobs, firstpass,lastpass,ftol, stepm, ncovcol, nlstate, ndeath, maxwav, weightopt,model);
jk=1;
- fprintf(ficres,"# Parameters\n");
- printf("# Parameters\n");
+ fprintf(ficres,"# Parameters nlstate*nlstate*ncov a12*1 + b12 * age + ...\n");
+ printf("# Parameters nlstate*nlstate*ncov a12*1 + b12 * age + ...\n");
for(i=1,jk=1; i <=nlstate; i++){
for(k=1; k <=(nlstate+ndeath); k++){
if (k != i)
@@ -2944,8 +2944,8 @@ printf("Total number of individuals= %d,
ftolhess=ftol; /* Usually correct */
hesscov(matcov, p, npar, delti, ftolhess, func);
}
- fprintf(ficres,"# Scales\n");
- printf("# Scales\n");
+ fprintf(ficres,"# Scales (for hessian or gradient estimation)\n");
+ printf("# Scales (for hessian or gradient estimation)\n");
for(i=1,jk=1; i <=nlstate; i++){
for(j=1; j <=nlstate+ndeath; j++){
if (j!=i) {
@@ -2963,8 +2963,8 @@ printf("Total number of individuals= %d,
}
k=1;
- fprintf(ficres,"# Covariance\n");
- printf("# Covariance\n");
+ fprintf(ficres,"# Covariance matrix \n# 121 Var(a12)\n# 122 Cov(b12,a12) Var(b12)\n# ...\n# 232 Cov(b23,a12) Cov(b23,b12) ... Var (b23)\n");
+ printf("# Covariance matrix \n# 121 Var(a12)\n# 122 Cov(b12,a12) Var(b12)\n# ...\n# 232 Cov(b23,a12) Cov(b23,b12) ... Var (b23)\n");
for(i=1;i<=npar;i++){
/* if (k>nlstate) k=1;
i1=(i-1)/(ncovmodel*nlstate)+1;
@@ -3321,7 +3321,7 @@ while((c=getc(ficpar))=='#' && c!= EOF){
free_ma3x(param,1,nlstate,1, nlstate+ndeath-1,1,ncovmodel);
if(erreur >0)
- printf("End of Imach with error %d\n",erreur);
+ printf("End of Imach with error or warning %d\n",erreur);
else printf("End of Imach\n");
/* gettimeofday(&end_time, (struct timezone*)0);*/ /* after time */