version 1.239, 2016/08/26 15:51:03
|
version 1.240, 2016/08/29 07:53:18
|
Line 1
|
Line 1
|
/* $Id$ |
/* $Id$ |
$State$ |
$State$ |
$Log$ |
$Log$ |
|
Revision 1.240 2016/08/29 07:53:18 brouard |
|
Summary: Better |
|
|
Revision 1.239 2016/08/26 15:51:03 brouard |
Revision 1.239 2016/08/26 15:51:03 brouard |
Summary: Improvement in Powell output in order to copy and paste |
Summary: Improvement in Powell output in order to copy and paste |
|
|
Line 1037 double dval;
|
Line 1040 double dval;
|
#define FTOL 1.0e-10 |
#define FTOL 1.0e-10 |
|
|
#define NRANSI |
#define NRANSI |
#define ITMAX 200 |
#define ITMAX 200 |
|
#define ITPOWMAX 20 /* This is now multiplied by the number of parameters */ |
|
|
#define TOL 2.0e-4 |
#define TOL 2.0e-4 |
|
|
Line 2131 void powell(double p[], double **xi, int
|
Line 2135 void powell(double p[], double **xi, int
|
if (k != i) { |
if (k != i) { |
printf("%d%d ",i,k); |
printf("%d%d ",i,k); |
fprintf(ficlog,"%d%d ",i,k); |
fprintf(ficlog,"%d%d ",i,k); |
fprintf(ficres,"%1d%1d ",i,k); |
|
for(j=1; j <=ncovmodel; j++){ |
for(j=1; j <=ncovmodel; j++){ |
printf("%12.7f ",p[jk]); |
printf("%12.7f ",p[jk]); |
fprintf(ficlog,"%12.7f ",p[jk]); |
fprintf(ficlog,"%12.7f ",p[jk]); |
fprintf(ficres,"%12.7f ",p[jk]); |
|
jk++; |
jk++; |
} |
} |
printf("\n"); |
printf("\n"); |
fprintf(ficlog,"\n"); |
fprintf(ficlog,"\n"); |
fprintf(ficres,"\n"); |
|
} |
} |
} |
} |
} |
} |
Line 2261 void powell(double p[], double **xi, int
|
Line 2262 void powell(double p[], double **xi, int
|
free_vector(pt,1,n); |
free_vector(pt,1,n); |
return; |
return; |
} /* enough precision */ |
} /* enough precision */ |
if (*iter == ITMAX) nrerror("powell exceeding maximum iterations."); |
if (*iter == ITMAX*n) nrerror("powell exceeding maximum iterations."); |
for (j=1;j<=n;j++) { /* Computes the extrapolated point P_0 + 2 (P_n-P_0) */ |
for (j=1;j<=n;j++) { /* Computes the extrapolated point P_0 + 2 (P_n-P_0) */ |
ptt[j]=2.0*p[j]-pt[j]; |
ptt[j]=2.0*p[j]-pt[j]; |
xit[j]=p[j]-pt[j]; |
xit[j]=p[j]-pt[j]; |
Line 4135 void freqsummary(char fileres[], int ia
|
Line 4136 void freqsummary(char fileres[], int ia
|
fprintf(ficlog,"Problem with prevalence resultfile: %s\n", fileresp); |
fprintf(ficlog,"Problem with prevalence resultfile: %s\n", fileresp); |
exit(0); |
exit(0); |
} |
} |
|
|
strcpy(fileresphtm,subdirfext(optionfilefiname,"PHTM_",".htm")); |
strcpy(fileresphtm,subdirfext(optionfilefiname,"PHTM_",".htm")); |
if((ficresphtm=fopen(fileresphtm,"w"))==NULL) { |
if((ficresphtm=fopen(fileresphtm,"w"))==NULL) { |
printf("Problem with prevalence HTM resultfile '%s' with errno='%s'\n",fileresphtm,strerror(errno)); |
printf("Problem with prevalence HTM resultfile '%s' with errno='%s'\n",fileresphtm,strerror(errno)); |
Line 4145 void freqsummary(char fileres[], int ia
|
Line 4146 void freqsummary(char fileres[], int ia
|
} |
} |
else{ |
else{ |
fprintf(ficresphtm,"<html><head>\n<title>IMaCh PHTM_ %s</title></head>\n <body><font size=\"2\">%s <br> %s</font> \ |
fprintf(ficresphtm,"<html><head>\n<title>IMaCh PHTM_ %s</title></head>\n <body><font size=\"2\">%s <br> %s</font> \ |
<hr size=\"2\" color=\"#EC5E5E\"> \n\ |
<hr size=\"2\" color=\"#EC5E5E\"> \n \ |
Title=%s <br>Datafile=%s Firstpass=%d Lastpass=%d Stepm=%d Weight=%d Model=1+age+%s<br>\n",\ |
Title=%s <br>Datafile=%s Firstpass=%d Lastpass=%d Stepm=%d Weight=%d Model=1+age+%s<br>\n",\ |
fileresphtm,version,fullversion,title,datafile,firstpass,lastpass,stepm, weightopt, model); |
fileresphtm,version,fullversion,title,datafile,firstpass,lastpass,stepm, weightopt, model); |
} |
} |
fprintf(ficresphtm,"Current page is file <a href=\"%s\">%s</a><br>\n\n<h4>Frequencies and prevalence by age at begin of transition and dummy covariate value at beginning of transition</h4>\n",fileresphtm, fileresphtm); |
fprintf(ficresphtm,"Current page is file <a href=\"%s\">%s</a><br>\n\n<h4>Frequencies and prevalence by age at begin of transition and dummy covariate value at beginning of transition</h4>\n",fileresphtm, fileresphtm); |
|
|
strcpy(fileresphtmfr,subdirfext(optionfilefiname,"PHTMFR_",".htm")); |
strcpy(fileresphtmfr,subdirfext(optionfilefiname,"PHTMFR_",".htm")); |
if((ficresphtmfr=fopen(fileresphtmfr,"w"))==NULL) { |
if((ficresphtmfr=fopen(fileresphtmfr,"w"))==NULL) { |
printf("Problem with frequency table HTM resultfile '%s' with errno='%s'\n",fileresphtmfr,strerror(errno)); |
printf("Problem with frequency table HTM resultfile '%s' with errno='%s'\n",fileresphtmfr,strerror(errno)); |
fprintf(ficlog,"Problem with frequency table HTM resultfile '%s' with errno='%s'\n",fileresphtmfr,strerror(errno)); |
fprintf(ficlog,"Problem with frequency table HTM resultfile '%s' with errno='%s'\n",fileresphtmfr,strerror(errno)); |
fflush(ficlog); |
fflush(ficlog); |
exit(70); |
exit(70); |
} |
} else{ |
else{ |
|
fprintf(ficresphtmfr,"<html><head>\n<title>IMaCh PHTM_Frequency table %s</title></head>\n <body><font size=\"2\">%s <br> %s</font> \ |
fprintf(ficresphtmfr,"<html><head>\n<title>IMaCh PHTM_Frequency table %s</title></head>\n <body><font size=\"2\">%s <br> %s</font> \ |
<hr size=\"2\" color=\"#EC5E5E\"> \n\ |
<hr size=\"2\" color=\"#EC5E5E\"> \n \ |
Title=%s <br>Datafile=%s Firstpass=%d Lastpass=%d Stepm=%d Weight=%d Model=1+age+%s<br>\n",\ |
Title=%s <br>Datafile=%s Firstpass=%d Lastpass=%d Stepm=%d Weight=%d Model=1+age+%s<br>\n",\ |
fileresphtmfr,version,fullversion,title,datafile,firstpass,lastpass,stepm, weightopt, model); |
fileresphtmfr,version,fullversion,title,datafile,firstpass,lastpass,stepm, weightopt, model); |
} |
} |
fprintf(ficresphtmfr,"Current page is file <a href=\"%s\">%s</a><br>\n\n<h4>Frequencies of all effective transitions by age at begin of transition </h4>Unknown status is -1<br/>\n",fileresphtmfr, fileresphtmfr); |
fprintf(ficresphtmfr,"Current page is file <a href=\"%s\">%s</a><br>\n\n<h4>Frequencies of all effective transitions of the model, by age at begin of transition, and covariate value at the begin of transition (if the covariate is a varying covariate) </h4>Unknown status is -1<br/>\n",fileresphtmfr, fileresphtmfr); |
|
|
freq= ma3x(-5,nlstate+ndeath,-5,nlstate+ndeath,iagemin-AGEMARGE,iagemax+3+AGEMARGE); |
freq= ma3x(-5,nlstate+ndeath,-5,nlstate+ndeath,iagemin-AGEMARGE,iagemax+3+AGEMARGE); |
j1=0; |
j1=0; |
|
|
/* j=ncoveff; /\* Only fixed dummy covariates *\/ */ |
/* j=ncoveff; /\* Only fixed dummy covariates *\/ */ |
j=cptcoveff; /* Only dummy covariates of the model */ |
j=cptcoveff; /* Only dummy covariates of the model */ |
if (cptcovn<1) {j=1;ncodemax[1]=1;} |
if (cptcovn<1) {j=1;ncodemax[1]=1;} |
|
|
first=1; |
first=1; |
|
|
/* Detects if a combination j1 is empty: for a multinomial variable like 3 education levels: |
/* Detects if a combination j1 is empty: for a multinomial variable like 3 education levels: |
reference=low_education V1=0,V2=0 |
reference=low_education V1=0,V2=0 |
med_educ V1=1 V2=0, |
med_educ V1=1 V2=0, |
high_educ V1=0 V2=1 |
high_educ V1=0 V2=1 |
Then V1=1 and V2=1 is a noisy combination that we want to exclude for the list 2**cptcoveff |
Then V1=1 and V2=1 is a noisy combination that we want to exclude for the list 2**cptcoveff |
*/ |
*/ |
|
|
for (j1 = 1; j1 <= (int) pow(2,j); j1++){ /* Loop on covariates combination in order of model, excluding quantitatives V4=0, V3=0 for example, fixed or varying covariates */ |
for (j1 = 1; j1 <= (int) pow(2,j); j1++){ /* Loop on covariates combination in order of model, excluding quantitatives V4=0, V3=0 for example, fixed or varying covariates */ |
posproptt=0.; |
posproptt=0.; |
/*printf("cptcoveff=%d Tvaraff=%d", cptcoveff,Tvaraff[1]); |
/*printf("cptcoveff=%d Tvaraff=%d", cptcoveff,Tvaraff[1]); |
scanf("%d", i);*/ |
scanf("%d", i);*/ |
for (i=-5; i<=nlstate+ndeath; i++) |
for (i=-5; i<=nlstate+ndeath; i++) |
for (jk=-5; jk<=nlstate+ndeath; jk++) |
for (jk=-5; jk<=nlstate+ndeath; jk++) |
for(m=iagemin; m <= iagemax+3; m++) |
for(m=iagemin; m <= iagemax+3; m++) |
freq[i][jk][m]=0; |
freq[i][jk][m]=0; |
|
|
for (i=1; i<=nlstate; i++) { |
for (i=1; i<=nlstate; i++) { |
for(m=iagemin; m <= iagemax+3; m++) |
for(m=iagemin; m <= iagemax+3; m++) |
prop[i][m]=0; |
prop[i][m]=0; |
posprop[i]=0; |
posprop[i]=0; |
pospropt[i]=0; |
pospropt[i]=0; |
} |
} |
Line 4203 Title=%s <br>Datafile=%s Firstpass=%d La
|
Line 4203 Title=%s <br>Datafile=%s Firstpass=%d La
|
/* meanqt[m][z1]=0.; */ |
/* meanqt[m][z1]=0.; */ |
/* } */ |
/* } */ |
/* } */ |
/* } */ |
|
|
dateintsum=0; |
dateintsum=0; |
k2cpt=0; |
k2cpt=0; |
/* For that combination of covariate j1, we count and print the frequencies in one pass */ |
/* For that combination of covariate j1, we count and print the frequencies in one pass */ |
Line 4282 Title=%s <br>Datafile=%s Firstpass=%d La
|
Line 4282 Title=%s <br>Datafile=%s Firstpass=%d La
|
} /* end iind = 1 to imx */ |
} /* end iind = 1 to imx */ |
/* prop[s][age] is feeded for any initial and valid live state as well as |
/* prop[s][age] is feeded for any initial and valid live state as well as |
freq[s1][s2][age] at single age of beginning the transition, for a combination j1 */ |
freq[s1][s2][age] at single age of beginning the transition, for a combination j1 */ |
|
|
|
|
/* fprintf(ficresp, "#Count between %.lf/%.lf/%.lf and %.lf/%.lf/%.lf\n",jprev1, mprev1,anprev1,jprev2, mprev2,anprev2);*/ |
/* fprintf(ficresp, "#Count between %.lf/%.lf/%.lf and %.lf/%.lf/%.lf\n",jprev1, mprev1,anprev1,jprev2, mprev2,anprev2);*/ |
pstamp(ficresp); |
pstamp(ficresp); |
/* if (ncoveff>0) { */ |
if (cptcoveff>0){ |
if (cptcoveff>0) { |
|
fprintf(ficresp, "\n#********** Variable "); |
fprintf(ficresp, "\n#********** Variable "); |
fprintf(ficresphtm, "\n<br/><br/><h3>********** Variable "); |
fprintf(ficresphtm, "\n<br/><br/><h3>********** Variable "); |
fprintf(ficresphtmfr, "\n<br/><br/><h3>********** Variable "); |
fprintf(ficresphtmfr, "\n<br/><br/><h3>********** Variable "); |
|
fprintf(ficlog, "\n#********** Variable "); |
for (z1=1; z1<=cptcoveff; z1++){ |
for (z1=1; z1<=cptcoveff; z1++){ |
fprintf(ficresp, "V%d=%d ",Tvaraff[z1],nbcode[Tvaraff[z1]][codtabm(j1,z1)]); |
if(DummyV[z1]){ |
fprintf(ficresphtm, "V%d=%d ",Tvaraff[z1],nbcode[Tvaraff[z1]][codtabm(j1,z1)]); |
fprintf(ficresp, "V%d (fixed)=%d ",Tvaraff[z1],nbcode[Tvaraff[z1]][codtabm(j1,z1)]); |
fprintf(ficresphtmfr, "V%d=%d ",Tvaraff[z1],nbcode[Tvaraff[z1]][codtabm(j1,z1)]); |
fprintf(ficresphtm, "V%d (fixed)=%d ",Tvaraff[z1],nbcode[Tvaraff[z1]][codtabm(j1,z1)]); |
|
fprintf(ficresphtmfr, "V%d (fixed)=%d ",Tvaraff[z1],nbcode[Tvaraff[z1]][codtabm(j1,z1)]); |
|
fprintf(ficlog, "V%d (fixed)=%d ",Tvaraff[z1],nbcode[Tvaraff[z1]][codtabm(j1,z1)]); |
|
}else{ |
|
fprintf(ficresp, "V%d(varying)=%d ",Tvaraff[z1],nbcode[Tvaraff[z1]][codtabm(j1,z1)]); |
|
fprintf(ficresphtm, "V%d(varying)=%d ",Tvaraff[z1],nbcode[Tvaraff[z1]][codtabm(j1,z1)]); |
|
fprintf(ficresphtmfr, "V%d(varying)=%d ",Tvaraff[z1],nbcode[Tvaraff[z1]][codtabm(j1,z1)]); |
|
fprintf(ficlog, "V%d(varying)=%d ",Tvaraff[z1],nbcode[Tvaraff[z1]][codtabm(j1,z1)]); |
|
} |
} |
} |
fprintf(ficresp, "**********\n#"); |
fprintf(ficresp, "**********\n#"); |
fprintf(ficresphtm, "**********</h3>\n"); |
fprintf(ficresphtm, "**********</h3>\n"); |
fprintf(ficresphtmfr, "**********</h3>\n"); |
fprintf(ficresphtmfr, "**********</h3>\n"); |
fprintf(ficlog, "\n#********** Variable "); |
|
for (z1=1; z1<=cptcoveff; z1++) fprintf(ficlog, "V%d=%d ",Tvaraff[z1],nbcode[Tvaraff[z1]][codtabm(j1,z1)]); |
|
fprintf(ficlog, "**********\n"); |
fprintf(ficlog, "**********\n"); |
} |
} |
fprintf(ficresphtm,"<table style=\"text-align:center; border: 1px solid\">"); |
fprintf(ficresphtm,"<table style=\"text-align:center; border: 1px solid\">"); |
for(i=1; i<=nlstate;i++) { |
for(i=1; i<=nlstate;i++) { |
fprintf(ficresp, " Age Prev(%d) N(%d) N",i,i); |
fprintf(ficresp, " Age Prev(%d) N(%d) N ",i,i); |
fprintf(ficresphtm, "<th>Age</th><th>Prev(%d)</th><th>N(%d)</th><th>N</th>",i,i); |
fprintf(ficresphtm, "<th>Age</th><th>Prev(%d)</th><th>N(%d)</th><th>N</th>",i,i); |
} |
} |
fprintf(ficresp, "\n"); |
fprintf(ficresp, "\n"); |
fprintf(ficresphtm, "\n"); |
fprintf(ficresphtm, "\n"); |
|
|
/* Header of frequency table by age */ |
/* Header of frequency table by age */ |
fprintf(ficresphtmfr,"<table style=\"text-align:center; border: 1px solid\">"); |
fprintf(ficresphtmfr,"<table style=\"text-align:center; border: 1px solid\">"); |
fprintf(ficresphtmfr,"<th>Age</th> "); |
fprintf(ficresphtmfr,"<th>Age</th> "); |
Line 4321 Title=%s <br>Datafile=%s Firstpass=%d La
|
Line 4327 Title=%s <br>Datafile=%s Firstpass=%d La
|
} |
} |
} |
} |
fprintf(ficresphtmfr, "\n"); |
fprintf(ficresphtmfr, "\n"); |
|
|
/* For each age */ |
/* For each age */ |
for(iage=iagemin; iage <= iagemax+3; iage++){ |
for(iage=iagemin; iage <= iagemax+3; iage++){ |
fprintf(ficresphtm,"<tr>"); |
fprintf(ficresphtm,"<tr>"); |
if(iage==iagemax+1){ |
if(iage==iagemax+1){ |
fprintf(ficlog,"1"); |
fprintf(ficlog,"1"); |
fprintf(ficresphtmfr,"<tr><th>0</th> "); |
fprintf(ficresphtmfr,"<tr><th>0</th> "); |
}else if(iage==iagemax+2){ |
}else if(iage==iagemax+2){ |
fprintf(ficlog,"0"); |
fprintf(ficlog,"0"); |
fprintf(ficresphtmfr,"<tr><th>Unknown</th> "); |
fprintf(ficresphtmfr,"<tr><th>Unknown</th> "); |
}else if(iage==iagemax+3){ |
}else if(iage==iagemax+3){ |
fprintf(ficlog,"Total"); |
fprintf(ficlog,"Total"); |
fprintf(ficresphtmfr,"<tr><th>Total</th> "); |
fprintf(ficresphtmfr,"<tr><th>Total</th> "); |
}else{ |
}else{ |
if(first==1){ |
if(first==1){ |
first=0; |
first=0; |
printf("See log file for details...\n"); |
printf("See log file for details...\n"); |
} |
} |
fprintf(ficresphtmfr,"<tr><th>%d</th> ",iage); |
fprintf(ficresphtmfr,"<tr><th>%d</th> ",iage); |
fprintf(ficlog,"Age %d", iage); |
fprintf(ficlog,"Age %d", iage); |
} |
} |
for(jk=1; jk <=nlstate ; jk++){ |
for(jk=1; jk <=nlstate ; jk++){ |
for(m=-1, pp[jk]=0; m <=nlstate+ndeath ; m++) |
for(m=-1, pp[jk]=0; m <=nlstate+ndeath ; m++) |
pp[jk] += freq[jk][m][iage]; |
pp[jk] += freq[jk][m][iage]; |
} |
} |
for(jk=1; jk <=nlstate ; jk++){ |
for(jk=1; jk <=nlstate ; jk++){ |
for(m=-1, pos=0; m <=0 ; m++) |
for(m=-1, pos=0; m <=0 ; m++) |
pos += freq[jk][m][iage]; |
pos += freq[jk][m][iage]; |
if(pp[jk]>=1.e-10){ |
if(pp[jk]>=1.e-10){ |
if(first==1){ |
if(first==1){ |
printf(" %d.=%.0f loss[%d]=%.1f%%",jk,pp[jk],jk,100*pos/pp[jk]); |
printf(" %d.=%.0f loss[%d]=%.1f%%",jk,pp[jk],jk,100*pos/pp[jk]); |
} |
} |
fprintf(ficlog," %d.=%.0f loss[%d]=%.1f%%",jk,pp[jk],jk,100*pos/pp[jk]); |
fprintf(ficlog," %d.=%.0f loss[%d]=%.1f%%",jk,pp[jk],jk,100*pos/pp[jk]); |
}else{ |
}else{ |
if(first==1) |
if(first==1) |
printf(" %d.=%.0f loss[%d]=NaNQ%%",jk,pp[jk],jk); |
printf(" %d.=%.0f loss[%d]=NaNQ%%",jk,pp[jk],jk); |
fprintf(ficlog," %d.=%.0f loss[%d]=NaNQ%%",jk,pp[jk],jk); |
fprintf(ficlog," %d.=%.0f loss[%d]=NaNQ%%",jk,pp[jk],jk); |
} |
} |
} |
} |
|
|
for(jk=1; jk <=nlstate ; jk++){ |
for(jk=1; jk <=nlstate ; jk++){ |
/* posprop[jk]=0; */ |
/* posprop[jk]=0; */ |
for(m=0, pp[jk]=0; m <=nlstate+ndeath; m++)/* Summing on all ages */ |
for(m=0, pp[jk]=0; m <=nlstate+ndeath; m++)/* Summing on all ages */ |
pp[jk] += freq[jk][m][iage]; |
pp[jk] += freq[jk][m][iage]; |
} /* pp[jk] is the total number of transitions starting from state jk and any ending status until this age */ |
} /* pp[jk] is the total number of transitions starting from state jk and any ending status until this age */ |
|
|
for(jk=1,pos=0, pospropta=0.; jk <=nlstate ; jk++){ |
for(jk=1,pos=0, pospropta=0.; jk <=nlstate ; jk++){ |
pos += pp[jk]; /* pos is the total number of transitions until this age */ |
pos += pp[jk]; /* pos is the total number of transitions until this age */ |
posprop[jk] += prop[jk][iage]; /* prop is the number of transitions from a live state |
posprop[jk] += prop[jk][iage]; /* prop is the number of transitions from a live state |
from jk at age iage prop[s[m][iind]][(int)agev[m][iind]] += weight[iind] */ |
from jk at age iage prop[s[m][iind]][(int)agev[m][iind]] += weight[iind] */ |
pospropta += prop[jk][iage]; /* prop is the number of transitions from a live state |
pospropta += prop[jk][iage]; /* prop is the number of transitions from a live state |
from jk at age iage prop[s[m][iind]][(int)agev[m][iind]] += weight[iind] */ |
from jk at age iage prop[s[m][iind]][(int)agev[m][iind]] += weight[iind] */ |
} |
} |
for(jk=1; jk <=nlstate ; jk++){ |
for(jk=1; jk <=nlstate ; jk++){ |
if(pos>=1.e-5){ |
if(pos>=1.e-5){ |
if(first==1) |
if(first==1) |
printf(" %d.=%.0f prev[%d]=%.1f%%",jk,pp[jk],jk,100*pp[jk]/pos); |
printf(" %d.=%.0f prev[%d]=%.1f%%",jk,pp[jk],jk,100*pp[jk]/pos); |
fprintf(ficlog," %d.=%.0f prev[%d]=%.1f%%",jk,pp[jk],jk,100*pp[jk]/pos); |
fprintf(ficlog," %d.=%.0f prev[%d]=%.1f%%",jk,pp[jk],jk,100*pp[jk]/pos); |
}else{ |
}else{ |
if(first==1) |
if(first==1) |
printf(" %d.=%.0f prev[%d]=NaNQ%%",jk,pp[jk],jk); |
printf(" %d.=%.0f prev[%d]=NaNQ%%",jk,pp[jk],jk); |
fprintf(ficlog," %d.=%.0f prev[%d]=NaNQ%%",jk,pp[jk],jk); |
fprintf(ficlog," %d.=%.0f prev[%d]=NaNQ%%",jk,pp[jk],jk); |
} |
} |
if( iage <= iagemax){ |
if( iage <= iagemax){ |
if(pos>=1.e-5){ |
if(pos>=1.e-5){ |
fprintf(ficresp," %d %.5f %.0f %.0f",iage,prop[jk][iage]/pospropta, prop[jk][iage],pospropta); |
fprintf(ficresp," %d %.5f %.0f %.0f",iage,prop[jk][iage]/pospropta, prop[jk][iage],pospropta); |
fprintf(ficresphtm,"<th>%d</th><td>%.5f</td><td>%.0f</td><td>%.0f</td>",iage,prop[jk][iage]/pospropta, prop[jk][iage],pospropta); |
fprintf(ficresphtm,"<th>%d</th><td>%.5f</td><td>%.0f</td><td>%.0f</td>",iage,prop[jk][iage]/pospropta, prop[jk][iage],pospropta); |
/*probs[iage][jk][j1]= pp[jk]/pos;*/ |
/*probs[iage][jk][j1]= pp[jk]/pos;*/ |
/*printf("\niage=%d jk=%d j1=%d %.5f %.0f %.0f %f",iage,jk,j1,pp[jk]/pos, pp[jk],pos,probs[iage][jk][j1]);*/ |
/*printf("\niage=%d jk=%d j1=%d %.5f %.0f %.0f %f",iage,jk,j1,pp[jk]/pos, pp[jk],pos,probs[iage][jk][j1]);*/ |
} |
} |
else{ |
else{ |
fprintf(ficresp," %d NaNq %.0f %.0f",iage,prop[jk][iage],pospropta); |
fprintf(ficresp," %d NaNq %.0f %.0f",iage,prop[jk][iage],pospropta); |
fprintf(ficresphtm,"<th>%d</th><td>NaNq</td><td>%.0f</td><td>%.0f</td>",iage, prop[jk][iage],pospropta); |
fprintf(ficresphtm,"<th>%d</th><td>NaNq</td><td>%.0f</td><td>%.0f</td>",iage, prop[jk][iage],pospropta); |
} |
} |
} |
} |
pospropt[jk] +=posprop[jk]; |
pospropt[jk] +=posprop[jk]; |
} /* end loop jk */ |
} /* end loop jk */ |
/* pospropt=0.; */ |
/* pospropt=0.; */ |
for(jk=-1; jk <=nlstate+ndeath; jk++){ |
for(jk=-1; jk <=nlstate+ndeath; jk++){ |
for(m=-1; m <=nlstate+ndeath; m++){ |
for(m=-1; m <=nlstate+ndeath; m++){ |
if(freq[jk][m][iage] !=0 ) { /* minimizing output */ |
if(freq[jk][m][iage] !=0 ) { /* minimizing output */ |
if(first==1){ |
if(first==1){ |
printf(" %d%d=%.0f",jk,m,freq[jk][m][iage]); |
printf(" %d%d=%.0f",jk,m,freq[jk][m][iage]); |
} |
} |
fprintf(ficlog," %d%d=%.0f",jk,m,freq[jk][m][iage]); |
fprintf(ficlog," %d%d=%.0f",jk,m,freq[jk][m][iage]); |
} |
} |
if(jk!=0 && m!=0) |
if(jk!=0 && m!=0) |
fprintf(ficresphtmfr,"<td>%.0f</td> ",freq[jk][m][iage]); |
fprintf(ficresphtmfr,"<td>%.0f</td> ",freq[jk][m][iage]); |
} |
} |
} /* end loop jk */ |
} /* end loop jk */ |
posproptt=0.; |
posproptt=0.; |
for(jk=1; jk <=nlstate; jk++){ |
for(jk=1; jk <=nlstate; jk++){ |
posproptt += pospropt[jk]; |
posproptt += pospropt[jk]; |
} |
} |
fprintf(ficresphtmfr,"</tr>\n "); |
fprintf(ficresphtmfr,"</tr>\n "); |
if(iage <= iagemax){ |
if(iage <= iagemax){ |
fprintf(ficresp,"\n"); |
fprintf(ficresp,"\n"); |
fprintf(ficresphtm,"</tr>\n"); |
fprintf(ficresphtm,"</tr>\n"); |
} |
} |
if(first==1) |
if(first==1) |
printf("Others in log...\n"); |
printf("Others in log...\n"); |
fprintf(ficlog,"\n"); |
fprintf(ficlog,"\n"); |
} /* end loop age iage */ |
} /* end loop age iage */ |
fprintf(ficresphtm,"<tr><th>Tot</th>"); |
fprintf(ficresphtm,"<tr><th>Tot</th>"); |
for(jk=1; jk <=nlstate ; jk++){ |
for(jk=1; jk <=nlstate ; jk++){ |
if(posproptt < 1.e-5){ |
if(posproptt < 1.e-5){ |
fprintf(ficresphtm,"<td>Nanq</td><td>%.0f</td><td>%.0f</td>",pospropt[jk],posproptt); |
fprintf(ficresphtm,"<td>Nanq</td><td>%.0f</td><td>%.0f</td>",pospropt[jk],posproptt); |
}else{ |
}else{ |
fprintf(ficresphtm,"<td>%.5f</td><td>%.0f</td><td>%.0f</td>",pospropt[jk]/posproptt,pospropt[jk],posproptt); |
fprintf(ficresphtm,"<td>%.5f</td><td>%.0f</td><td>%.0f</td>",pospropt[jk]/posproptt,pospropt[jk],posproptt); |
} |
} |
} |
} |
fprintf(ficresphtm,"</tr>\n"); |
fprintf(ficresphtm,"</tr>\n"); |
Line 4447 Title=%s <br>Datafile=%s Firstpass=%d La
|
Line 4453 Title=%s <br>Datafile=%s Firstpass=%d La
|
fprintf(ficresphtmfr,"</table>\n"); |
fprintf(ficresphtmfr,"</table>\n"); |
} /* end selected combination of covariate j1 */ |
} /* end selected combination of covariate j1 */ |
dateintmean=dateintsum/k2cpt; |
dateintmean=dateintsum/k2cpt; |
|
|
fclose(ficresp); |
fclose(ficresp); |
fclose(ficresphtm); |
fclose(ficresphtm); |
fclose(ficresphtmfr); |
fclose(ficresphtmfr); |
Line 6355 void printinggnuplot(char fileresu[], ch
|
Line 6361 void printinggnuplot(char fileresu[], ch
|
|
|
fprintf(ficgp,"\nset out \"%s_%d-%d.svg\" \n",subdirf2(optionfilefiname,"V_"),cpt,k1); |
fprintf(ficgp,"\nset out \"%s_%d-%d.svg\" \n",subdirf2(optionfilefiname,"V_"),cpt,k1); |
fprintf(ficgp,"\n#set out \"V_%s_%d-%d.svg\" \n",optionfilefiname,cpt,k1); |
fprintf(ficgp,"\n#set out \"V_%s_%d-%d.svg\" \n",optionfilefiname,cpt,k1); |
fprintf(ficgp,"set xlabel \"Age\" \n\ |
fprintf(ficgp,"set xlabel \"Age\" \nset ylabel \"Probability\" \nset ter svg size 640, 480\nplot [%.f:%.f] \"%s\" every :::%d::%d u 1:2 \"%%lf",ageminpar,fage,subdirf2(fileresu,"VPL_"),k1-1,k1-1); |
set ylabel \"Probability\" \n \ |
|
set ter svg size 640, 480\n \ |
|
plot [%.f:%.f] \"%s\" every :::%d::%d u 1:2 \"%%lf",ageminpar,fage,subdirf2(fileresu,"VPL_"),k1-1,k1-1); |
|
|
|
for (i=1; i<= nlstate ; i ++) { |
for (i=1; i<= nlstate ; i ++) { |
if (i==cpt) fprintf(ficgp," %%lf (%%lf)"); |
if (i==cpt) fprintf(ficgp," %%lf (%%lf)"); |
Line 6472 plot [%.f:%.f] \"%s\" every :::%d::%d u
|
Line 6475 plot [%.f:%.f] \"%s\" every :::%d::%d u
|
/*3eme*/ |
/*3eme*/ |
for (k1=1; k1<= m ; k1 ++){ |
for (k1=1; k1<= m ; k1 ++){ |
for(nres=1; nres <= nresult; nres++){ /* For each resultline */ |
for(nres=1; nres <= nresult; nres++){ /* For each resultline */ |
if(TKresult[nres]!= k) |
if(TKresult[nres]!= k1) |
continue; |
continue; |
|
|
for (cpt=1; cpt<= nlstate ; cpt ++) { |
for (cpt=1; cpt<= nlstate ; cpt ++) { |
Line 7832 int readdata(char datafile[], int firsto
|
Line 7835 int readdata(char datafile[], int firsto
|
/*-------- data file ----------*/ |
/*-------- data file ----------*/ |
FILE *fic; |
FILE *fic; |
char dummy[]=" "; |
char dummy[]=" "; |
int i=0, j=0, n=0, iv=0; |
int i=0, j=0, n=0, iv=0, v; |
int lstra; |
int lstra; |
int linei, month, year,iout; |
int linei, month, year,iout; |
char line[MAXLINE], linetmp[MAXLINE]; |
char line[MAXLINE], linetmp[MAXLINE]; |
char stra[MAXLINE], strb[MAXLINE]; |
char stra[MAXLINE], strb[MAXLINE]; |
char *stratrunc; |
char *stratrunc; |
|
|
|
DummyV=ivector(1,NCOVMAX); /* 1 to 3 */ |
|
FixedV=ivector(1,NCOVMAX); /* 1 to 3 */ |
|
|
|
for(v=1; v <=ncovcol;v++){ |
|
DummyV[v]=0; |
|
FixedV[v]=0; |
|
} |
|
for(v=ncovcol+1; v <=ncovcol+nqv;v++){ |
|
DummyV[v]=1; |
|
FixedV[v]=0; |
|
} |
|
for(v=ncovcol+nqv+1; v <=ncovcol+nqv+ntv;v++){ |
|
DummyV[v]=0; |
|
FixedV[v]=1; |
|
} |
|
for(v=ncovcol+nqv+ntv+1; v <=ncovcol+nqv+ntv+nqtv;v++){ |
|
DummyV[v]=1; |
|
FixedV[v]=1; |
|
} |
|
for(v=1; v <=ncovcol+nqv+ntv+nqtv;v++){ |
|
printf("Covariate type in the data: V%d, DummyV(V%d)=%d, FixedV(V%d)=%d\n",v,v,DummyV[v],v,FixedV[v]); |
|
fprintf(ficlog,"Covariate type in the data: V%d, DummyV(V%d)=%d, FixedV(V%d)=%d\n",v,v,DummyV[v],v,FixedV[v]); |
|
} |
|
|
if((fic=fopen(datafile,"r"))==NULL) { |
if((fic=fopen(datafile,"r"))==NULL) { |
printf("Problem while opening datafile: %s with errno='%s'\n", datafile,strerror(errno));fflush(stdout); |
printf("Problem while opening datafile: %s with errno='%s'\n", datafile,strerror(errno));fflush(stdout); |
Line 8460 Dummy[k] 0=dummy (0 1), 1 quantitative (
|
Line 8485 Dummy[k] 0=dummy (0 1), 1 quantitative (
|
Typevar: 0 for simple covariate (dummy, quantitative, fixed or varying), 1 for age product, 2 for product \n\ |
Typevar: 0 for simple covariate (dummy, quantitative, fixed or varying), 1 for age product, 2 for product \n\ |
Fixed[k] 0=fixed (product or simple), 1 varying, 2 fixed with age product, 3 varying with age product \n\ |
Fixed[k] 0=fixed (product or simple), 1 varying, 2 fixed with age product, 3 varying with age product \n\ |
Dummy[k] 0=dummy (0 1), 1 quantitative (single or product without age), 2 dummy with age product, 3 quant with age product\n",model); |
Dummy[k] 0=dummy (0 1), 1 quantitative (single or product without age), 2 dummy with age product, 3 quant with age product\n",model); |
|
for(k=1;k<=cptcovt; k++){ Fixed[k]=0; Dummy[k]=0;} |
for(v=1; v <=ncovcol;v++){ |
|
DummyV[v]=0; |
|
FixedV[v]=0; |
|
} |
|
for(v=ncovcol+1; v <=ncovcol+nqv;v++){ |
|
DummyV[v]=1; |
|
FixedV[v]=0; |
|
} |
|
for(v=ncovcol+nqv+1; v <=ncovcol+nqv+ntv;v++){ |
|
DummyV[v]=0; |
|
FixedV[v]=1; |
|
} |
|
for(v=ncovcol+nqv+ntv+1; v <=ncovcol+nqv+ntv+nqtv;v++){ |
|
DummyV[v]=1; |
|
FixedV[v]=1; |
|
} |
|
for(v=1; v <=ncovcol+nqv+ntv+nqtv;v++){ |
|
printf("Decodemodel: V%d, Dummy(V%d)=%d, FixedV(V%d)=%d\n",v,v,DummyV[v],v,FixedV[v]); |
|
fprintf(ficlog,"Decodemodel: V%d, Dummy(V%d)=%d, FixedV(V%d)=%d\n",v,v,DummyV[v],v,FixedV[v]); |
|
} |
|
for(k=1, ncovf=0, nsd=0, nsq=0, ncovv=0, ncova=0, ncoveff=0, nqfveff=0, ntveff=0, nqtveff=0;k<=cptcovt; k++){ /* or cptocvt */ |
for(k=1, ncovf=0, nsd=0, nsq=0, ncovv=0, ncova=0, ncoveff=0, nqfveff=0, ntveff=0, nqtveff=0;k<=cptcovt; k++){ /* or cptocvt */ |
if (Tvar[k] <=ncovcol && Typevar[k]==0 ){ /* Simple fixed dummy (<=ncovcol) covariates */ |
if (Tvar[k] <=ncovcol && Typevar[k]==0 ){ /* Simple fixed dummy (<=ncovcol) covariates */ |
Fixed[k]= 0; |
Fixed[k]= 0; |
Line 8505 Dummy[k] 0=dummy (0 1), 1 quantitative (
|
Line 8510 Dummy[k] 0=dummy (0 1), 1 quantitative (
|
TvarFind[ncovf]=k; |
TvarFind[ncovf]=k; |
TvarFD[ncoveff]=Tvar[k]; /* TvarFD[1]=V1 in V5+V4+V3+V4*V3+V5*age+V2+V1*V2+V1*age+V1 */ |
TvarFD[ncoveff]=Tvar[k]; /* TvarFD[1]=V1 in V5+V4+V3+V4*V3+V5*age+V2+V1*V2+V1*age+V1 */ |
TvarFDind[ncoveff]=k; /* TvarFDind[1]=9 in V5+V4+V3+V4*V3+V5*age+V2+V1*V2+V1*age+V1 */ |
TvarFDind[ncoveff]=k; /* TvarFDind[1]=9 in V5+V4+V3+V4*V3+V5*age+V2+V1*V2+V1*age+V1 */ |
}else if( Tvar[k] <=ncovcol+nqv && Typevar[k]==0){ /* Remind that product Vn*Vm are added in k*/ /* Only simple fixed quantitative variable */ |
}else if( Tvar[k] <=ncovcol+nqv && Typevar[k]==0){/* Remind that product Vn*Vm are added in k Only simple fixed quantitative variable */ |
Fixed[k]= 0; |
Fixed[k]= 0; |
Dummy[k]= 1; |
Dummy[k]= 1; |
nqfveff++; |
nqfveff++; |
Line 8558 Dummy[k] 0=dummy (0 1), 1 quantitative (
|
Line 8563 Dummy[k] 0=dummy (0 1), 1 quantitative (
|
TvarA[ncova]=Tvar[k]; |
TvarA[ncova]=Tvar[k]; |
TvarAind[ncova]=k; |
TvarAind[ncova]=k; |
if (Tvar[k] <=ncovcol ){ /* Product age with fixed dummy covariatee */ |
if (Tvar[k] <=ncovcol ){ /* Product age with fixed dummy covariatee */ |
Fixed[k]= 2; |
Fixed[k]= 2; |
Dummy[k]= 2; |
Dummy[k]= 2; |
modell[k].maintype= ATYPE; |
modell[k].maintype= ATYPE; |
modell[k].subtype= APFD; |
modell[k].subtype= APFD; |
/* ncoveff++; */ |
/* ncoveff++; */ |
}else if( Tvar[k] <=ncovcol+nqv) { /* Remind that product Vn*Vm are added in k*/ |
}else if( Tvar[k] <=ncovcol+nqv) { /* Remind that product Vn*Vm are added in k*/ |
Fixed[k]= 2; |
Fixed[k]= 2; |
Dummy[k]= 3; |
Dummy[k]= 3; |
modell[k].maintype= ATYPE; |
modell[k].maintype= ATYPE; |
modell[k].subtype= APFQ; /* Product age * fixed quantitative */ |
modell[k].subtype= APFQ; /* Product age * fixed quantitative */ |
/* nqfveff++; /\* Only simple fixed quantitative variable *\/ */ |
/* nqfveff++; /\* Only simple fixed quantitative variable *\/ */ |
}else if( Tvar[k] <=ncovcol+nqv+ntv ){ |
}else if( Tvar[k] <=ncovcol+nqv+ntv ){ |
Fixed[k]= 3; |
Fixed[k]= 3; |
Dummy[k]= 2; |
Dummy[k]= 2; |
modell[k].maintype= ATYPE; |
modell[k].maintype= ATYPE; |
modell[k].subtype= APVD; /* Product age * varying dummy */ |
modell[k].subtype= APVD; /* Product age * varying dummy */ |
/* ntveff++; /\* Only simple time varying dummy variable *\/ */ |
/* ntveff++; /\* Only simple time varying dummy variable *\/ */ |
}else if( Tvar[k] <=ncovcol+nqv+ntv+nqtv){ |
}else if( Tvar[k] <=ncovcol+nqv+ntv+nqtv){ |
Fixed[k]= 3; |
Fixed[k]= 3; |
Dummy[k]= 3; |
Dummy[k]= 3; |
modell[k].maintype= ATYPE; |
modell[k].maintype= ATYPE; |
modell[k].subtype= APVQ; /* Product age * varying quantitative */ |
modell[k].subtype= APVQ; /* Product age * varying quantitative */ |
/* nqtveff++;/\* Only simple time varying quantitative variable *\/ */ |
/* nqtveff++;/\* Only simple time varying quantitative variable *\/ */ |
} |
} |
}else if (Typevar[k] == 2) { /* product without age */ |
}else if (Typevar[k] == 2) { /* product without age */ |
k1=Tposprod[k]; |
k1=Tposprod[k]; |
if(Tvard[k1][1] <=ncovcol){ |
if(Tvard[k1][1] <=ncovcol){ |
if(Tvard[k1][2] <=ncovcol){ |
if(Tvard[k1][2] <=ncovcol){ |
Fixed[k]= 1; |
Fixed[k]= 1; |
Dummy[k]= 0; |
Dummy[k]= 0; |
modell[k].maintype= FTYPE; |
modell[k].maintype= FTYPE; |
modell[k].subtype= FPDD; /* Product fixed dummy * fixed dummy */ |
modell[k].subtype= FPDD; /* Product fixed dummy * fixed dummy */ |
ncovf++; /* Fixed variables without age */ |
ncovf++; /* Fixed variables without age */ |
TvarF[ncovf]=Tvar[k]; |
TvarF[ncovf]=Tvar[k]; |
TvarFind[ncovf]=k; |
TvarFind[ncovf]=k; |
}else if(Tvard[k1][2] <=ncovcol+nqv){ |
}else if(Tvard[k1][2] <=ncovcol+nqv){ |
Fixed[k]= 0; /* or 2 ?*/ |
Fixed[k]= 0; /* or 2 ?*/ |
Dummy[k]= 1; |
Dummy[k]= 1; |
modell[k].maintype= FTYPE; |
modell[k].maintype= FTYPE; |
modell[k].subtype= FPDQ; /* Product fixed dummy * fixed quantitative */ |
modell[k].subtype= FPDQ; /* Product fixed dummy * fixed quantitative */ |
ncovf++; /* Varying variables without age */ |
ncovf++; /* Varying variables without age */ |
TvarF[ncovf]=Tvar[k]; |
TvarF[ncovf]=Tvar[k]; |
TvarFind[ncovf]=k; |
TvarFind[ncovf]=k; |
}else if(Tvard[k1][2] <=ncovcol+nqv+ntv){ |
}else if(Tvard[k1][2] <=ncovcol+nqv+ntv){ |
Fixed[k]= 1; |
Fixed[k]= 1; |
Dummy[k]= 0; |
Dummy[k]= 0; |
modell[k].maintype= VTYPE; |
modell[k].maintype= VTYPE; |
modell[k].subtype= VPDD; /* Product fixed dummy * varying dummy */ |
modell[k].subtype= VPDD; /* Product fixed dummy * varying dummy */ |
ncovv++; /* Varying variables without age */ |
ncovv++; /* Varying variables without age */ |
TvarV[ncovv]=Tvar[k]; |
TvarV[ncovv]=Tvar[k]; |
TvarVind[ncovv]=k; |
TvarVind[ncovv]=k; |
}else if(Tvard[k1][2] <=ncovcol+nqv+ntv+nqtv){ |
}else if(Tvard[k1][2] <=ncovcol+nqv+ntv+nqtv){ |
Fixed[k]= 1; |
Fixed[k]= 1; |
Dummy[k]= 1; |
Dummy[k]= 1; |
modell[k].maintype= VTYPE; |
modell[k].maintype= VTYPE; |
modell[k].subtype= VPDQ; /* Product fixed dummy * varying quantitative */ |
modell[k].subtype= VPDQ; /* Product fixed dummy * varying quantitative */ |
ncovv++; /* Varying variables without age */ |
ncovv++; /* Varying variables without age */ |
TvarV[ncovv]=Tvar[k]; |
TvarV[ncovv]=Tvar[k]; |
TvarVind[ncovv]=k; |
TvarVind[ncovv]=k; |
} |
} |
}else if(Tvard[k1][1] <=ncovcol+nqv){ |
}else if(Tvard[k1][1] <=ncovcol+nqv){ |
if(Tvard[k1][2] <=ncovcol){ |
if(Tvard[k1][2] <=ncovcol){ |
Fixed[k]= 0; /* or 2 ?*/ |
Fixed[k]= 0; /* or 2 ?*/ |
Dummy[k]= 1; |
Dummy[k]= 1; |
modell[k].maintype= FTYPE; |
modell[k].maintype= FTYPE; |
modell[k].subtype= FPDQ; /* Product fixed quantitative * fixed dummy */ |
modell[k].subtype= FPDQ; /* Product fixed quantitative * fixed dummy */ |
ncovf++; /* Fixed variables without age */ |
ncovf++; /* Fixed variables without age */ |
TvarF[ncovf]=Tvar[k]; |
TvarF[ncovf]=Tvar[k]; |
TvarFind[ncovf]=k; |
TvarFind[ncovf]=k; |
}else if(Tvard[k1][2] <=ncovcol+nqv+ntv){ |
}else if(Tvard[k1][2] <=ncovcol+nqv+ntv){ |
Fixed[k]= 1; |
Fixed[k]= 1; |
Dummy[k]= 1; |
Dummy[k]= 1; |
modell[k].maintype= VTYPE; |
modell[k].maintype= VTYPE; |
modell[k].subtype= VPDQ; /* Product fixed quantitative * varying dummy */ |
modell[k].subtype= VPDQ; /* Product fixed quantitative * varying dummy */ |
ncovv++; /* Varying variables without age */ |
ncovv++; /* Varying variables without age */ |
TvarV[ncovv]=Tvar[k]; |
TvarV[ncovv]=Tvar[k]; |
TvarVind[ncovv]=k; |
TvarVind[ncovv]=k; |
}else if(Tvard[k1][2] <=ncovcol+nqv+ntv+nqtv){ |
}else if(Tvard[k1][2] <=ncovcol+nqv+ntv+nqtv){ |
Fixed[k]= 1; |
Fixed[k]= 1; |
Dummy[k]= 1; |
Dummy[k]= 1; |
modell[k].maintype= VTYPE; |
modell[k].maintype= VTYPE; |
modell[k].subtype= VPQQ; /* Product fixed quantitative * varying quantitative */ |
modell[k].subtype= VPQQ; /* Product fixed quantitative * varying quantitative */ |
ncovv++; /* Varying variables without age */ |
ncovv++; /* Varying variables without age */ |
TvarV[ncovv]=Tvar[k]; |
TvarV[ncovv]=Tvar[k]; |
TvarVind[ncovv]=k; |
TvarVind[ncovv]=k; |
ncovv++; /* Varying variables without age */ |
ncovv++; /* Varying variables without age */ |
TvarV[ncovv]=Tvar[k]; |
TvarV[ncovv]=Tvar[k]; |
TvarVind[ncovv]=k; |
TvarVind[ncovv]=k; |
} |
} |
}else if(Tvard[k1][1] <=ncovcol+nqv+ntv){ |
}else if(Tvard[k1][1] <=ncovcol+nqv+ntv){ |
if(Tvard[k1][2] <=ncovcol){ |
if(Tvard[k1][2] <=ncovcol){ |
Fixed[k]= 1; |
Fixed[k]= 1; |
Dummy[k]= 1; |
Dummy[k]= 1; |
modell[k].maintype= VTYPE; |
modell[k].maintype= VTYPE; |
modell[k].subtype= VPDD; /* Product time varying dummy * fixed dummy */ |
modell[k].subtype= VPDD; /* Product time varying dummy * fixed dummy */ |
ncovv++; /* Varying variables without age */ |
ncovv++; /* Varying variables without age */ |
TvarV[ncovv]=Tvar[k]; |
TvarV[ncovv]=Tvar[k]; |
TvarVind[ncovv]=k; |
TvarVind[ncovv]=k; |
}else if(Tvard[k1][2] <=ncovcol+nqv){ |
}else if(Tvard[k1][2] <=ncovcol+nqv){ |
Fixed[k]= 1; |
Fixed[k]= 1; |
Dummy[k]= 1; |
Dummy[k]= 1; |
modell[k].maintype= VTYPE; |
modell[k].maintype= VTYPE; |
modell[k].subtype= VPDQ; /* Product time varying dummy * fixed quantitative */ |
modell[k].subtype= VPDQ; /* Product time varying dummy * fixed quantitative */ |
ncovv++; /* Varying variables without age */ |
ncovv++; /* Varying variables without age */ |
TvarV[ncovv]=Tvar[k]; |
TvarV[ncovv]=Tvar[k]; |
TvarVind[ncovv]=k; |
TvarVind[ncovv]=k; |
}else if(Tvard[k1][2] <=ncovcol+nqv+ntv){ |
}else if(Tvard[k1][2] <=ncovcol+nqv+ntv){ |
Fixed[k]= 1; |
Fixed[k]= 1; |
Dummy[k]= 0; |
Dummy[k]= 0; |
modell[k].maintype= VTYPE; |
modell[k].maintype= VTYPE; |
modell[k].subtype= VPDD; /* Product time varying dummy * time varying dummy */ |
modell[k].subtype= VPDD; /* Product time varying dummy * time varying dummy */ |
ncovv++; /* Varying variables without age */ |
ncovv++; /* Varying variables without age */ |
TvarV[ncovv]=Tvar[k]; |
TvarV[ncovv]=Tvar[k]; |
TvarVind[ncovv]=k; |
TvarVind[ncovv]=k; |
}else if(Tvard[k1][2] <=ncovcol+nqv+ntv+nqtv){ |
}else if(Tvard[k1][2] <=ncovcol+nqv+ntv+nqtv){ |
Fixed[k]= 1; |
Fixed[k]= 1; |
Dummy[k]= 1; |
Dummy[k]= 1; |
modell[k].maintype= VTYPE; |
modell[k].maintype= VTYPE; |
modell[k].subtype= VPDQ; /* Product time varying dummy * time varying quantitative */ |
modell[k].subtype= VPDQ; /* Product time varying dummy * time varying quantitative */ |
ncovv++; /* Varying variables without age */ |
ncovv++; /* Varying variables without age */ |
TvarV[ncovv]=Tvar[k]; |
TvarV[ncovv]=Tvar[k]; |
TvarVind[ncovv]=k; |
TvarVind[ncovv]=k; |
} |
} |
}else if(Tvard[k1][1] <=ncovcol+nqv+ntv+nqtv){ |
}else if(Tvard[k1][1] <=ncovcol+nqv+ntv+nqtv){ |
if(Tvard[k1][2] <=ncovcol){ |
if(Tvard[k1][2] <=ncovcol){ |
Fixed[k]= 1; |
Fixed[k]= 1; |
Dummy[k]= 1; |
Dummy[k]= 1; |
modell[k].maintype= VTYPE; |
modell[k].maintype= VTYPE; |
modell[k].subtype= VPDQ; /* Product time varying quantitative * fixed dummy */ |
modell[k].subtype= VPDQ; /* Product time varying quantitative * fixed dummy */ |
ncovv++; /* Varying variables without age */ |
ncovv++; /* Varying variables without age */ |
TvarV[ncovv]=Tvar[k]; |
TvarV[ncovv]=Tvar[k]; |
TvarVind[ncovv]=k; |
TvarVind[ncovv]=k; |
}else if(Tvard[k1][2] <=ncovcol+nqv){ |
}else if(Tvard[k1][2] <=ncovcol+nqv){ |
Fixed[k]= 1; |
Fixed[k]= 1; |
Dummy[k]= 1; |
Dummy[k]= 1; |
modell[k].maintype= VTYPE; |
modell[k].maintype= VTYPE; |
modell[k].subtype= VPQQ; /* Product time varying quantitative * fixed quantitative */ |
modell[k].subtype= VPQQ; /* Product time varying quantitative * fixed quantitative */ |
ncovv++; /* Varying variables without age */ |
ncovv++; /* Varying variables without age */ |
TvarV[ncovv]=Tvar[k]; |
TvarV[ncovv]=Tvar[k]; |
TvarVind[ncovv]=k; |
TvarVind[ncovv]=k; |
}else if(Tvard[k1][2] <=ncovcol+nqv+ntv){ |
}else if(Tvard[k1][2] <=ncovcol+nqv+ntv){ |
Fixed[k]= 1; |
Fixed[k]= 1; |
Dummy[k]= 1; |
Dummy[k]= 1; |
modell[k].maintype= VTYPE; |
modell[k].maintype= VTYPE; |
modell[k].subtype= VPDQ; /* Product time varying quantitative * time varying dummy */ |
modell[k].subtype= VPDQ; /* Product time varying quantitative * time varying dummy */ |
ncovv++; /* Varying variables without age */ |
ncovv++; /* Varying variables without age */ |
TvarV[ncovv]=Tvar[k]; |
TvarV[ncovv]=Tvar[k]; |
TvarVind[ncovv]=k; |
TvarVind[ncovv]=k; |
}else if(Tvard[k1][2] <=ncovcol+nqv+ntv+nqtv){ |
}else if(Tvard[k1][2] <=ncovcol+nqv+ntv+nqtv){ |
Fixed[k]= 1; |
Fixed[k]= 1; |
Dummy[k]= 1; |
Dummy[k]= 1; |
modell[k].maintype= VTYPE; |
modell[k].maintype= VTYPE; |
modell[k].subtype= VPQQ; /* Product time varying quantitative * time varying quantitative */ |
modell[k].subtype= VPQQ; /* Product time varying quantitative * time varying quantitative */ |
ncovv++; /* Varying variables without age */ |
ncovv++; /* Varying variables without age */ |
TvarV[ncovv]=Tvar[k]; |
TvarV[ncovv]=Tvar[k]; |
TvarVind[ncovv]=k; |
TvarVind[ncovv]=k; |
} |
} |
}else{ |
}else{ |
printf("Error unknown type of covariate: Tvard[%d][1]=%d,Tvard[%d][2]=%d\n",k1,Tvard[k1][1],k1,Tvard[k1][2]); |
printf("Error unknown type of covariate: Tvard[%d][1]=%d,Tvard[%d][2]=%d\n",k1,Tvard[k1][1],k1,Tvard[k1][2]); |
fprintf(ficlog,"Error unknown type of covariate: Tvard[%d][1]=%d,Tvard[%d][2]=%d\n",k1,Tvard[k1][1],k1,Tvard[k1][2]); |
fprintf(ficlog,"Error unknown type of covariate: Tvard[%d][1]=%d,Tvard[%d][2]=%d\n",k1,Tvard[k1][1],k1,Tvard[k1][2]); |
} /* end k1 */ |
} /*end k1*/ |
}else{ |
}else{ |
printf("Error, current version can't treat for performance reasons, Tvar[%d]=%d, Typevar[%d]=%d\n", k, Tvar[k], k, Typevar[k]); |
printf("Error, current version can't treat for performance reasons, Tvar[%d]=%d, Typevar[%d]=%d\n", k, Tvar[k], k, Typevar[k]); |
fprintf(ficlog,"Error, current version can't treat for performance reasons, Tvar[%d]=%d, Typevar[%d]=%d\n", k, Tvar[k], k, Typevar[k]); |
fprintf(ficlog,"Error, current version can't treat for performance reasons, Tvar[%d]=%d, Typevar[%d]=%d\n", k, Tvar[k], k, Typevar[k]); |
Line 10050 Please run with mle=-1 to get a correct
|
Line 10055 Please run with mle=-1 to get a correct
|
Typevar=ivector(-1,NCOVMAX); /* -1 to 2 */ |
Typevar=ivector(-1,NCOVMAX); /* -1 to 2 */ |
Fixed=ivector(-1,NCOVMAX); /* -1 to 3 */ |
Fixed=ivector(-1,NCOVMAX); /* -1 to 3 */ |
Dummy=ivector(-1,NCOVMAX); /* -1 to 3 */ |
Dummy=ivector(-1,NCOVMAX); /* -1 to 3 */ |
DummyV=ivector(1,NCOVMAX); /* 1 to 3 */ |
|
FixedV=ivector(1,NCOVMAX); /* 1 to 3 */ |
|
/* V2+V1+V4+age*V3 is a model with 4 covariates (3 plus signs). |
/* V2+V1+V4+age*V3 is a model with 4 covariates (3 plus signs). |
For each model-covariate stores the data-covariate id. Tvar[1]=2, Tvar[2]=1, Tvar[3]=4, |
For each model-covariate stores the data-covariate id. Tvar[1]=2, Tvar[2]=1, Tvar[3]=4, |
Tvar[4=age*V3] is 3 and 'age' is recorded in Tage. |
Tvar[4=age*V3] is 3 and 'age' is recorded in Tage. |
Line 10869 Please run with mle=-1 to get a correct
|
Line 10872 Please run with mle=-1 to get a correct
|
}else |
}else |
break; |
break; |
} |
} |
|
if (!feof(ficpar)) |
while((num_filled=sscanf(line,"result:%[^\n]\n",resultline)) !=EOF){ |
while((num_filled=sscanf(line,"result:%[^\n]\n",resultline)) !=EOF){ |
if (num_filled == 0) |
if (num_filled == 0){ |
resultline[0]='\0'; |
resultline[0]='\0'; |
else if (num_filled != 1){ |
break; |
|
} else if (num_filled != 1){ |
printf("ERROR %d: result line should be at minimum 'result=' %s\n",num_filled, line); |
printf("ERROR %d: result line should be at minimum 'result=' %s\n",num_filled, line); |
} |
} |
nresult++; /* Sum of resultlines */ |
nresult++; /* Sum of resultlines */ |
Line 10902 Please run with mle=-1 to get a correct
|
Line 10907 Please run with mle=-1 to get a correct
|
break; |
break; |
else{ /* Processess output results for this combination of covariate values */ |
else{ /* Processess output results for this combination of covariate values */ |
} |
} |
} |
} /* end while */ |
|
|
|
|
|
|