/* $Id$
$State$
$Log$
+ Revision 1.330 2022/08/06 07:18:25 brouard
+ Summary: last 0.99r31
+
+ * imach.c (Module): Version of imach using partly decoderesult to rebuild xpxij function
+
Revision 1.329 2022/08/03 17:29:54 brouard
* imach.c (Module): Many errors in graphs fixed with Vn*age covariates.
/*Tvar[k]= 5 4 3 6 5 2 7 1 1 */
/*cptcovage=2 1 2 */
/*Tage[k]= 5 8 */
- }else if( Dummy[k1]==2 ){ /* For quant with age product */
+ }else if( Dummy[k1]==3 ){ /* For quant with age product */
cov[2+nagesqr+k1]=Tresult[nres][resultmodel[nres][k1]];
printf("QhPxij Quant with age k1=%d resultmodel[nres][%d]=%d,Tqresult[%d][%d]=%f\n",k1,k1,resultmodel[nres][k1],nres,resultmodel[nres][k1],Tqresult[nres][resultmodel[nres][k1]]);
/* if(Dummy[Tage[k]]== 2){ /\* dummy with age *\/ */
/* V5*age V5 known which value for nres? */
/* Tqinvresult[2]=8 Tqinvresult[1]=25.1 */
for(k1=1, k=0, k4=0, k4q=0; k1 <=cptcovt;k1++){ /* loop k1 on position in the model line (excluding product) */
- if( Dummy[k1]==0 && Typevar[k1]==0 ){ /* Single dummy */
- /* k4+1= position in the resultline V(Tvarsel)=Tvalsel=Tresult[nres][pos](value); V(Tvresult[nres][pos] (variable): V(variable)=value) */
+ /* k counting number of combination of single dummies in the equation model */
+ /* k4 counting single dummies in the equation model */
+ /* k4q counting single quantitatives in the equation model */
+ if( Dummy[k1]==0 && Typevar[k1]==0 ){ /* Dummy and Single */
+ /* k4+1= position in the resultline V(Tvarsel)=Tvalsel=Tresult[nres][pos](value); V(Tvresult[nres][pos] (variable): V(variable)=value) */
/* modelresult[k3]=k1: k3th position in the result line correspond to the k1 position in the model line */
/* Value in the (current nres) resultline of the variable at the k1th position in the model equation resultmodel[nres][k1]= k3 */
/* resultmodel[nres][k1]=k3: k1th position in the model correspond to the k3 position in the resultline */
/* k3 is the position in the nres result line of the k1th variable of the model equation */
- /* Tvarsel: Name of the variable at the k3th position in the result line Tvarsel[k3]. */
- /* Tvalsel: Value of the variable at the k3th position in the result line Tvarsel[k3]. */
+ /* Tvarsel[k3]: Name of the variable at the k3th position in the result line. */
+ /* Tvalsel[k3]: Value of the variable at the k3th position in the result line. */
/* Tresult[nres][result_position]= value of the dummy variable at the result_position in the nres resultline */
/* Tvresult[nres][result_position]= id of the dummy variable at the result_position in the nres resultline */
/* Tinvresult[nres][Name of a dummy variable]= value of the variable in the result line */
k3= resultmodel[nres][k1]; /* nres=1 k1=2 resultmodel[2(V4)] = 1=k3 ; k1=3 resultmodel[3(V3)] = 2=k3*/
k2=(int)Tvarsel[k3]; /* nres=1 k1=2=>k3=1 Tvarsel[resultmodel[2]]= Tvarsel[1] = 4=k2 (V4); k1=3=>k3=2 Tvarsel[2]=3 (V3)*/
k+=Tvalsel[k3]*pow(2,k4); /* nres=1 k1=2 Tvalsel[1]=1 (V4=1); k1=3 k3=2 Tvalsel[2]=0 (V3=0) */
+ TinvDoQresult[nres][(int)Tvarsel[k3]]=Tvalsel[k3]; /* Tinvresult[nres][4]=1 */
Tresult[nres][k4+1]=Tvalsel[k3];/* Tresult[nres=2][1]=1(V4=1) Tresult[nres=2][2]=0(V3=0) */
Tvresult[nres][k4+1]=(int)Tvarsel[k3];/* Tvresult[nres][1]=4 Tvresult[nres][3]=1 */
Tinvresult[nres][(int)Tvarsel[k3]]=Tvalsel[k3]; /* Tinvresult[nres][4]=1 */
- TinvDoQresult[nres][(int)Tvarsel[k3]]=Tvalsel[k3]; /* Tinvresult[nres][4]=1 */
printf("Decoderesult Dummy k=%d, V(k2=V%d)= Tvalsel[%d]=%d, 2**(%d)\n",k, k2, k3, (int)Tvalsel[k3], k4);
k4++;;
- } else if( Dummy[k1]==1 && Typevar[k1]==0 ){ /* Single quantitative */
+ }else if( Dummy[k1]==1 && Typevar[k1]==0 ){ /* Quantitative and single */
/* Tqresult[nres][result_position]= value of the variable at the result_position in the nres resultline */
/* Tqvresult[nres][result_position]= id of the variable at the result_position in the nres resultline */
/* Tqinvresult[nres][Name of a quantitative variable]= value of the variable in the result line */
TinvDoQresult[nres][(int)Tvarsel[k3q]]=Tvalsel[k3q]; /* Tqinvresult[nres][5]=25.1 */
printf("Decoderesult Quantitative nres=%d, V(k2q=V%d)= Tvalsel[%d]=%d, Tvarsel[%d]=%f\n",nres, k2q, k3q, Tvarsel[k3q], k3q, Tvalsel[k3q]);
k4q++;;
+ }else if( Dummy[k1]==2 ){ /* For dummy with age product */
+ /* Tvar[k1]; */ /* Age variable */
+ k3= resultmodel[nres][Tvar[k1]]; /* nres=1 k1=2 resultmodel[2(V4)] = 1=k3 ; k1=3 resultmodel[3(V3)] = 2=k3*/
+ k2=(int)Tvarsel[k3]; /* nres=1 k1=2=>k3=1 Tvarsel[resultmodel[2]]= Tvarsel[1] = 4=k2 (V4); k1=3=>k3=2 Tvarsel[2]=3 (V3)*/
+ TinvDoQresult[nres][(int)Tvarsel[k3]]=Tvalsel[k3]; /* Tinvresult[nres][4]=1 */
+ printf("Decoderesult Dummy with age k=%d, k1=%d Tvar[%d]=V%d k2=Tvarsel[%d]=%d Tvalsel[%d]=%d\n",k, k1, k1, Tvar[k1], k3,(int)Tvarsel[k3], k3, (int)Tvalsel[k3]);
+ }else if( Dummy[k1]==3 ){ /* For quant with age product */
+ k3q= resultmodel[nres][Tvar[k1]]; /* resultmodel[1(V5)] = 25.1=k3q */
+ k2q=(int)Tvarsel[k3q]; /* Tvarsel[resultmodel[1]]= Tvarsel[1] = 4=k2 */
+ TinvDoQresult[nres][(int)Tvarsel[k3q]]=Tvalsel[k3q]; /* Tqinvresult[nres][5]=25.1 */
+ printf("Decoderesult Quantitative with age nres=%d, k1=%d, Tvar[%d]=V%d V(k2q=V%d)= Tvalsel[%d]=%d, Tvarsel[%d]=%f\n",nres, k1, k1, Tvar[k1], k2q, k3q, Tvarsel[k3q], k3q, Tvalsel[k3q]);
+ }else if(Typevar[k1]==2 ){ /* For product quant or dummy (not with age) */
+ printf("Decoderesult Quantitative or Dummy (not with age) nres=%d k1=%d Tvar[%d]=%d \n",nres, k1, k1, Tvar[k1]);
}else{
- printf("Decodemodel probably a product Dummy[%d]==%d && Typevar[%d]==%d\n", k1, Dummy[k1], k1, Typevar[k1]);
- fprintf(ficlog,"Decodemodel probably a product Dummy[%d]==%d && Typevar[%d]==%d\n", k1, Dummy[k1], k1, Typevar[k1]);
+ printf("Error Decodemodel probably a product Dummy[%d]==%d && Typevar[%d]==%d\n", k1, Dummy[k1], k1, Typevar[k1]);
+ fprintf(ficlog,"Error Decodemodel probably a product Dummy[%d]==%d && Typevar[%d]==%d\n", k1, Dummy[k1], k1, Typevar[k1]);
}
}