[Genabel-commits] r1227 - in branches/ProbABEL-pacox/v.0.3.0/ProbABEL: . src

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sun May 19 17:07:02 CEST 2013


Author: lckarssen
Date: 2013-05-19 17:07:02 +0200 (Sun, 19 May 2013)
New Revision: 1227

Modified:
   branches/ProbABEL-pacox/v.0.3.0/ProbABEL/configure.ac
   branches/ProbABEL-pacox/v.0.3.0/ProbABEL/src/main.cpp
   branches/ProbABEL-pacox/v.0.3.0/ProbABEL/src/reg1.cpp
Log:
In ProbABEL pacoxfix branch (0.3.0): 
  It looks like these are the last changes needed to make the CoxPH model work in the 0.3.0 branch! More testing still needed, however. 

- main.cpp: Fixed wrong order of arguments when calling the estimate() function for Cox.
- reg1.cpp: 
  + Uncommented the interaction_excluded region. Commenting this was previously needed to get Cox regression working. Now that the problem has been solved, this is no longer needed. 
  + In call to apply_model(): fix the number of arguments. The 'iscox' variable was not passed in the right slot, because the 'interaction' variable was missing in the function call. 
- configure.ac: set pacoxph=yes instead of pacoxph=${enableval} as the last one doesn't seem to work. 


Modified: branches/ProbABEL-pacox/v.0.3.0/ProbABEL/configure.ac
===================================================================
--- branches/ProbABEL-pacox/v.0.3.0/ProbABEL/configure.ac	2013-05-19 14:58:15 UTC (rev 1226)
+++ branches/ProbABEL-pacox/v.0.3.0/ProbABEL/configure.ac	2013-05-19 15:07:02 UTC (rev 1227)
@@ -114,7 +114,7 @@
 AC_ARG_ENABLE([pacoxph],
     [AS_HELP_STRING([--disable-pacoxph], [disable building the pacoxph program])],
     [pacoxph=no],
-    [pacoxph=${enableval}])
+    [pacoxph=yes])
 
 if test "x$pacoxph" = "xyes"; then
    AC_MSG_NOTICE([building of pacoxph is enabled])

Modified: branches/ProbABEL-pacox/v.0.3.0/ProbABEL/src/main.cpp
===================================================================
--- branches/ProbABEL-pacox/v.0.3.0/ProbABEL/src/main.cpp	2013-05-19 14:58:15 UTC (rev 1226)
+++ branches/ProbABEL-pacox/v.0.3.0/ProbABEL/src/main.cpp	2013-05-19 15:07:02 UTC (rev 1227)
@@ -569,11 +569,9 @@
                     }
 #elif COXPH
                     coxph_reg rd(rgd);
-// LCK                    std::cout << "HERE, model="<<model<<"\n";
                     rd.estimate(rgd, 0, MAXITER, EPS, CHOLTOL, model,
-                                input_var.getInteraction(), true,
-                                input_var.getNgpreds());
-// LCK                    std::cout << "HERE DONE\n";
+                                input_var.getInteraction(),
+                                input_var.getNgpreds(), true, 0);
 #endif
 
                     if (!input_var.getAllcov() && model == 0

Modified: branches/ProbABEL-pacox/v.0.3.0/ProbABEL/src/reg1.cpp
===================================================================
--- branches/ProbABEL-pacox/v.0.3.0/ProbABEL/src/reg1.cpp	2013-05-19 14:58:15 UTC (rev 1226)
+++ branches/ProbABEL-pacox/v.0.3.0/ProbABEL/src/reg1.cpp	2013-05-19 15:07:02 UTC (rev 1227)
@@ -173,45 +173,41 @@
     }
 
     //Han Chen
-    // if (is_interaction_excluded)
-    // {
-    //     mematrix<double> nX_without_interact_phe;
-    //     nX_without_interact_phe.reinit(nX.nrow, nX.ncol - 1);
-    //     int col_new;
-    //     for (int row = 0; row < nX.nrow; row++)
-    //     {
-    //         col_new = -1;
-    //         for (int col = 0; col < nX.ncol; col++)
-    //         {
-    //             if (col != interaction && !iscox)
-    //             {
-    //                 col_new++;
-    //                 nX_without_interact_phe[row * nX_without_interact_phe.ncol
-    //                         + col_new] = nX[row * nX.ncol + col];
-    //             }
-    //             if (col != interaction - 1 && iscox)
-    //             {
-    //                 col_new++;
-    //                 nX_without_interact_phe[row * nX_without_interact_phe.ncol
-    //                         + col_new] = nX[row * nX.ncol + col];
-    //             }
-    //         }
-    //     }
-    //     std::cout<<"LEAVINGHERE\n";
-    //     return nX_without_interact_phe;
-    // } //interaction_only, model!=0, ngpreds==2
-// LCK    printf("In apply_model: nX.nrow: %i nX.ncol: %i\n", nX.nrow, nX.ncol);
+    if (is_interaction_excluded)
+    {
+        mematrix<double> nX_without_interact_phe;
+        nX_without_interact_phe.reinit(nX.nrow, nX.ncol - 1);
+        int col_new;
+        for (int row = 0; row < nX.nrow; row++)
+        {
+            col_new = -1;
+            for (int col = 0; col < nX.ncol; col++)
+            {
+                if (col != interaction && !iscox)
+                {
+                    col_new++;
+                    nX_without_interact_phe[row * nX_without_interact_phe.ncol
+                            + col_new] = nX[row * nX.ncol + col];
+                }
+                if (col != interaction - 1 && iscox)
+                {
+                    col_new++;
+                    nX_without_interact_phe[row * nX_without_interact_phe.ncol
+                            + col_new] = nX[row * nX.ncol + col];
+                }
+            }
+        }
+        return nX_without_interact_phe;
+    } //interaction_only, model!=0, ngpreds==2
     return nX;
 }
 
 mematrix<double> t_apply_model(mematrix<double>& X, int model, int interaction,
                                int ngpreds, bool iscox, int nullmodel)
 {
-// LCK    std::cout << "t_apply: ngpreds: " << ngpreds << "; model: "<< model<<"\n";
-
     mematrix<double> tmpX = transpose(X);
-    mematrix<double> nX = apply_model(tmpX, model, interaction, ngpreds, iscox,
-                                      nullmodel);
+    mematrix<double> nX = apply_model(tmpX, model, interaction, ngpreds,
+                                      interaction, iscox, nullmodel);
     mematrix<double> out = transpose(nX);
     return out;
 }



More information about the Genabel-commits mailing list