version 1.251, 2016/09/15 15:01:13
|
version 1.252, 2016/09/15 21:15:37
|
Line 1
|
Line 1
|
/* $Id$ |
/* $Id$ |
$State$ |
$State$ |
$Log$ |
$Log$ |
|
Revision 1.252 2016/09/15 21:15:37 brouard |
|
*** empty log message *** |
|
|
Revision 1.251 2016/09/15 15:01:13 brouard |
Revision 1.251 2016/09/15 15:01:13 brouard |
Summary: not working |
Summary: not working |
|
|
Line 128
|
Line 131
|
Author: Nicolas Brouard |
Author: Nicolas Brouard |
|
|
Revision 1.210 2015/11/18 17:41:20 brouard |
Revision 1.210 2015/11/18 17:41:20 brouard |
Summary: Start working on projected prevalences |
Summary: Start working on projected prevalences Revision 1.209 2015/11/17 22:12:03 brouard |
|
|
Revision 1.209 2015/11/17 22:12:03 brouard |
|
Summary: Adding ftolpl parameter |
Summary: Adding ftolpl parameter |
Author: N Brouard |
Author: N Brouard |
|
|
Line 4560 Title=%s <br>Datafile=%s Firstpass=%d La
|
Line 4561 Title=%s <br>Datafile=%s Firstpass=%d La
|
for(i=1,jk=1; i <=nlstate; i++){ |
for(i=1,jk=1; i <=nlstate; i++){ |
for(k=1; k <=(nlstate+ndeath); k++){ |
for(k=1; k <=(nlstate+ndeath); k++){ |
if (k != i) { |
if (k != i) { |
printf("%d%d ",i,k); |
|
fprintf(ficlog,"%d%d ",i,k); |
|
for(jj=1; jj <=ncovmodel; jj++){ /* For counting jk */ |
for(jj=1; jj <=ncovmodel; jj++){ /* For counting jk */ |
if(jj==1){ /* Constant case */ |
if(jj==1){ /* Constant case */ |
if(j1==1){ /* All dummy covariates to zero */ |
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][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 */ |
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(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 */ |
}else{ /* Other cases, like quantitative fixed or varying covariates */ |
; |
; |
} |
} |
Line 4583 Title=%s <br>Datafile=%s Firstpass=%d La
|
Line 4588 Title=%s <br>Datafile=%s Firstpass=%d La
|
/* fprintf(ficlog,"%12.7f )", param[i][jj][k]); */ |
/* fprintf(ficlog,"%12.7f )", param[i][jj][k]); */ |
jk++; |
jk++; |
} /* end jj */ |
} /* end jj */ |
printf("\n"); |
|
fprintf(ficlog,"\n"); |
|
} /* end k!= i */ |
} /* end k!= i */ |
} /* end k */ |
} /* end k */ |
} /* end i, jk */ |
} /* end i, jk */ |
Line 4630 Title=%s <br>Datafile=%s Firstpass=%d La
|
Line 4633 Title=%s <br>Datafile=%s Firstpass=%d La
|
fprintf(ficlog,"\n"); |
fprintf(ficlog,"\n"); |
} /* end j=0 */ |
} /* end j=0 */ |
} /* end j */ |
} /* 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; |
dateintmean=dateintsum/k2cpt; |
|
|
fclose(ficresp); |
fclose(ficresp); |
Line 10007 int main(int argc, char *argv[])
|
Line 10032 int main(int argc, char *argv[])
|
fclose (ficlog); |
fclose (ficlog); |
goto end; |
goto end; |
exit(0); |
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 */ |
} else if(mle==-5) { /* Main Wizard */ |
prwizard(ncovmodel, nlstate, ndeath, model, ficparo); |
prwizard(ncovmodel, nlstate, ndeath, model, ficparo); |
printf(" You chose mle=-3, look at file %s for a template of covariance matrix \n",filereso); |
printf(" You chose mle=-3, look at file %s for a template of covariance matrix \n",filereso); |