--- imach/src/imach.c 2016/09/15 15:01:13 1.251
+++ imach/src/imach.c 2016/09/15 21:15:37 1.252
@@ -1,6 +1,9 @@
-/* $Id: imach.c,v 1.251 2016/09/15 15:01:13 brouard Exp $
+/* $Id: imach.c,v 1.252 2016/09/15 21:15:37 brouard Exp $
$State: Exp $
$Log: imach.c,v $
+ Revision 1.252 2016/09/15 21:15:37 brouard
+ *** empty log message ***
+
Revision 1.251 2016/09/15 15:01:13 brouard
Summary: not working
@@ -128,9 +131,7 @@
Author: Nicolas Brouard
Revision 1.210 2015/11/18 17:41:20 brouard
- Summary: Start working on projected prevalences
-
- Revision 1.209 2015/11/17 22:12:03 brouard
+ Summary: Start working on projected prevalences Revision 1.209 2015/11/17 22:12:03 brouard
Summary: Adding ftolpl parameter
Author: N Brouard
@@ -955,12 +956,12 @@ typedef struct {
#define ODIRSEPARATOR '\\'
#endif
-/* $Id: imach.c,v 1.251 2016/09/15 15:01:13 brouard Exp $ */
+/* $Id: imach.c,v 1.252 2016/09/15 21:15:37 brouard Exp $ */
/* $State: Exp $ */
#include "version.h"
char version[]=__IMACH_VERSION__;
char copyright[]="February 2016,INED-EUROREVES-Institut de longevite-Japan Society for the Promotion of Science (Grant-in-Aid for Scientific Research 25293121), Intel Software 2015-2018";
-char fullversion[]="$Revision: 1.251 $ $Date: 2016/09/15 15:01:13 $";
+char fullversion[]="$Revision: 1.252 $ $Date: 2016/09/15 21:15:37 $";
char strstart[80];
char optionfilext[10], optionfilefiname[FILENAMELENGTH];
int erreur=0, nberr=0, nbwarn=0; /* Error number, number of errors number of warnings */
@@ -4560,22 +4561,26 @@ Title=%s
Datafile=%s Firstpass=%d La
for(i=1,jk=1; i <=nlstate; i++){
for(k=1; k <=(nlstate+ndeath); k++){
if (k != i) {
- printf("%d%d ",i,k);
- fprintf(ficlog,"%d%d ",i,k);
for(jj=1; jj <=ncovmodel; jj++){ /* For counting jk */
if(jj==1){ /* Constant case */
if(j1==1){ /* All dummy covariates to zero */
freq[i][k][iagemax+4]=freq[i][k][iagemax+3]; /* Stores case 0 0 0 */
freq[i][i][iagemax+4]=freq[i][i][iagemax+3]; /* Stores case 0 0 0 */
+ printf("%d%d ",i,k);
+ fprintf(ficlog,"%d%d ",i,k);
+ printf("%12.7f ln(%.0f/%.0f)= %f, OR=%f sd=%f \n",p[jk],freq[i][k][iagemax+3],freq[i][i][iagemax+3], log(freq[i][k][iagemax+3]/freq[i][i][iagemax+3]),freq[i][k][iagemax+3]/freq[i][i][iagemax+3], sqrt(1/freq[i][k][iagemax+3]+1/freq[i][i][iagemax+3]));
+ fprintf(ficlog,"%12.7f ln(%.0f/%.0f)= %12.7f \n",p[jk],freq[i][k][iagemax+3],freq[i][i][iagemax+3], log(freq[i][k][iagemax+3]/freq[i][i][iagemax+3]));
+ pstart[jk]= log(freq[i][k][iagemax+3]/freq[i][i][iagemax+3]);
}
- printf("%12.7f ln(%.0f/%.0f)= %f, OR=%f sd=%f \n",p[jk],freq[i][k][iagemax+3],freq[i][i][iagemax+3], log(freq[i][k][iagemax+3]/freq[i][i][iagemax+3]),freq[i][k][iagemax+3]/freq[i][i][iagemax+3], sqrt(1/freq[i][k][iagemax+3]+1/freq[i][i][iagemax+3]));
- fprintf(ficlog,"%12.7f ln(%.0f/%.0f)= %12.7f \n",p[jk],freq[i][k][iagemax+3],freq[i][i][iagemax+3], log(freq[i][k][iagemax+3]/freq[i][i][iagemax+3]));
- pstart[jk]= log(freq[i][k][iagemax+3]/freq[i][i][iagemax+3]);
- }else if( (log(j1-1)/log(2)+1 == jj -2 -nagesqr) && Dummy[jj-2-nagesqr]==0){ /* We want only if the position, jj, in model corresponds to unique covariate equal to 1 in j1 combination */
- pstart[jk]= log((freq[i][k][iagemax+3]/freq[i][i][iagemax+3])/(freq[i][k][iagemax+4]/freq[i][i][iagemax+4]));
- printf("jk=%d,i=%d,k=%d,p[%d]=%12.7f ln((%.0f/%.0f)/(%.0f/%.0f))= %f, OR=%f sd=%f \n",jk,i,k,jk,p[jk],freq[i][k][iagemax+3],freq[i][i][iagemax+3],freq[i][k][iagemax+4],freq[i][i][iagemax+4], log((freq[i][k][iagemax+3]/freq[i][i][iagemax+3])/(freq[i][k][iagemax+4]/freq[i][i][iagemax+4])),(freq[i][k][iagemax+3]/freq[i][i][iagemax+3])/(freq[i][k][iagemax+4]/freq[i][i][iagemax+4]), sqrt(1/freq[i][k][iagemax+3]+1/freq[i][i][iagemax+3]+1/freq[i][k][iagemax+4]+1/freq[i][i][iagemax+4]));
}else if(jj==2 || nagesqr==1){ /* age or age*age parameter */
;
+ }else if( j1!=1 && (j1==2 || (log(j1-1.)/log(2.)-(int)(log(j1-1.)/log(2.))) <0.010) && ( TvarsDind[(int)(log(j1-1.)/log(2.))+1]+2+nagesqr == jj) && Dummy[jj-2-nagesqr]==0){ /* We want only if the position, jj, in model corresponds to unique covariate equal to 1 in j1 combination */
+ printf("j1=%d, jj=%d, (int)(log(j1-1.)/log(2.))+1=%d, TvarsDind[(int)(log(j1-1.)/log(2.))+1]=%d\n",j1, jj,(int)(log(j1-1.)/log(2.))+1,TvarsDind[(int)(log(j1-1.)/log(2.))+1]);
+ printf("j1=%d, jj=%d, (log(j1-1.)/log(2.))+1=%f, TvarsDind[(int)(log(j1-1.)/log(2.))+1]=%d\n",j1, jj,(log(j1-1.)/log(2.))+1,TvarsDind[(int)(log(j1-1.)/log(2.))+1]);
+ pstart[jk]= log((freq[i][k][iagemax+3]/freq[i][i][iagemax+3])/(freq[i][k][iagemax+4]/freq[i][i][iagemax+4]));
+ printf("%d%d ",i,k);
+ fprintf(ficlog,"%d%d ",i,k);
+ printf("jk=%d,i=%d,k=%d,p[%d]=%12.7f ln((%.0f/%.0f)/(%.0f/%.0f))= %f, OR=%f sd=%f \n",jk,i,k,jk,p[jk],freq[i][k][iagemax+3],freq[i][i][iagemax+3],freq[i][k][iagemax+4],freq[i][i][iagemax+4], log((freq[i][k][iagemax+3]/freq[i][i][iagemax+3])/(freq[i][k][iagemax+4]/freq[i][i][iagemax+4])),(freq[i][k][iagemax+3]/freq[i][i][iagemax+3])/(freq[i][k][iagemax+4]/freq[i][i][iagemax+4]), sqrt(1/freq[i][k][iagemax+3]+1/freq[i][i][iagemax+3]+1/freq[i][k][iagemax+4]+1/freq[i][i][iagemax+4]));
}else{ /* Other cases, like quantitative fixed or varying covariates */
;
}
@@ -4583,8 +4588,6 @@ Title=%s
Datafile=%s Firstpass=%d La
/* fprintf(ficlog,"%12.7f )", param[i][jj][k]); */
jk++;
} /* end jj */
- printf("\n");
- fprintf(ficlog,"\n");
} /* end k!= i */
} /* end k */
} /* end i, jk */
@@ -4630,6 +4633,28 @@ Title=%s
Datafile=%s Firstpass=%d La
fprintf(ficlog,"\n");
} /* end j=0 */
} /* end j */
+
+ if(mle == -2){
+ for(i=1, jk=1; i <=nlstate; i++){
+ for(j=1; j <=nlstate+ndeath; j++){
+ if(j!=i){
+ /*ca[0]= k+'a'-1;ca[1]='\0';*/
+ printf("%1d%1d",i,j);
+ fprintf(ficparo,"%1d%1d",i,j);
+ for(k=1; k<=ncovmodel;k++){
+ /* printf(" %lf",param[i][j][k]); */
+ /* fprintf(ficparo," %lf",param[i][j][k]); */
+ p[jk]=pstart[jk];
+ printf(" %f ",pstart[jk]);
+ fprintf(ficparo," %f ",pstart[jk]);
+ jk++;
+ }
+ printf("\n");
+ fprintf(ficparo,"\n");
+ }
+ }
+ }
+ } /* end mle=-2 */
dateintmean=dateintsum/k2cpt;
fclose(ficresp);
@@ -10007,11 +10032,6 @@ int main(int argc, char *argv[])
fclose (ficlog);
goto end;
exit(0);
- } else if(mle==-2) { /* Guessing from means */
- prwizard(ncovmodel, nlstate, ndeath, model, ficparo);
- printf(" You chose mle=-2, look at file %s for a template of covariance matrix \n",filereso);
- fprintf(ficlog," You chose mle=-2, look at file %s for a template of covariance matrix \n",filereso);
-
} else if(mle==-5) { /* Main Wizard */
prwizard(ncovmodel, nlstate, ndeath, model, ficparo);
printf(" You chose mle=-3, look at file %s for a template of covariance matrix \n",filereso);