/* $Id$
$State$
$Log$
+ Revision 1.251 2016/09/15 15:01:13 brouard
+ Summary: not working
+
Revision 1.250 2016/09/08 16:07:27 brouard
Summary: continue
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
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 */
;
}
/* fprintf(ficlog,"%12.7f )", param[i][jj][k]); */
jk++;
} /* end jj */
- printf("\n");
- fprintf(ficlog,"\n");
} /* end k!= i */
} /* end k */
} /* end i, jk */
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);
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);