[Genabel-commits] r893 - branches/ProbABEL-refactoring/ProbABEL/src

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Apr 17 00:43:46 CEST 2012


Author: maartenk
Date: 2012-04-17 00:43:46 +0200 (Tue, 17 Apr 2012)
New Revision: 893

Modified:
   branches/ProbABEL-refactoring/ProbABEL/src/comand_line_settings.cpp
   branches/ProbABEL-refactoring/ProbABEL/src/comand_line_settings.h
   branches/ProbABEL-refactoring/ProbABEL/src/main.cpp
   branches/ProbABEL-refactoring/ProbABEL/src/utilities.cpp
Log:
-(re)import of preprocessor switches

Modified: branches/ProbABEL-refactoring/ProbABEL/src/comand_line_settings.cpp
===================================================================
--- branches/ProbABEL-refactoring/ProbABEL/src/comand_line_settings.cpp	2012-04-14 12:22:17 UTC (rev 892)
+++ branches/ProbABEL-refactoring/ProbABEL/src/comand_line_settings.cpp	2012-04-16 22:43:46 UTC (rev 893)
@@ -68,10 +68,6 @@
     return mlinfofilename;
 }
 
-const int* cmdvars::getNeco() const
-{
-    return neco;
-}
 
 int cmdvars::getNgpreds() const
 {
@@ -334,4 +330,11 @@
     {
         outfilename = (char *) string("regression").c_str();
     }
+#if COXPH
+    if (score)
+    {
+        fprintf(stderr,"\n\nOption --score is implemented for linear and logistic models only\n");
+        exit(1);
+    }
+#endif
 }

Modified: branches/ProbABEL-refactoring/ProbABEL/src/comand_line_settings.h
===================================================================
--- branches/ProbABEL-refactoring/ProbABEL/src/comand_line_settings.h	2012-04-14 12:22:17 UTC (rev 892)
+++ branches/ProbABEL-refactoring/ProbABEL/src/comand_line_settings.h	2012-04-16 22:43:46 UTC (rev 893)
@@ -69,9 +69,15 @@
 
         iscox = false;
         isFVF = 0;
-        noutcomes = 1;
+
         skipd = 2;
         allcov = 0;
+#if COXPH
+    int noutcomes = 2;
+    iscox=true;
+#else
+    int noutcomes = 1;
+#endif
     }
     void set_variables(int, char *[]);
     char* getPhefilename() const;
@@ -84,7 +90,7 @@
     int getIsFvf() const;
     char* getMapfilename() const;
     char* getMlinfofilename() const;
-    const int* getNeco() const;
+
     int getNgpreds() const;
     int getNohead() const;
     int getNoutcomes() const;

Modified: branches/ProbABEL-refactoring/ProbABEL/src/main.cpp
===================================================================
--- branches/ProbABEL-refactoring/ProbABEL/src/main.cpp	2012-04-14 12:22:17 UTC (rev 892)
+++ branches/ProbABEL-refactoring/ProbABEL/src/main.cpp	2012-04-16 22:43:46 UTC (rev 893)
@@ -278,6 +278,18 @@
      if(input_var.getInverseFilename()!= NULL) {std::cerr<<"ERROR: mmscore is forbidden for logistic regression\n";exit(1);}
      #endif
      */
+#if COXPH
+    if(inverse_filename != NULL)
+    {
+        std::cerr<<"ERROR: mmscore is forbidden for cox regression\n";
+        exit(1);
+    }
+    if (robust)
+    {
+        std::cerr<<"ERROR: robust standard errors not implemented for Cox regression\n";
+        exit(1);
+    }
+#endif
 
     std::cout << "Reading data ...";
     if (input_var.getInverseFilename() != NULL)
@@ -308,15 +320,36 @@
     // estimate null model
     //TODO: remove this unused variable if there is not a reason to keep it
     //double null_loglik = 0.;
+#if COXPH
+    coxph_data nrgd=coxph_data(phd,gtd,-1);
+#else
+    regdata nrgd = regdata(phd, gtd, -1);
+#endif
+
+
     regdata nrgd = regdata(phd, gtd, -1, input_var.isIsInteractionExcluded());
     std::cout << " loaded null data ...";
-    linear_reg nrd = linear_reg(nrgd);
-    nrd.estimate(nrgd, 0, CHOLTOL, 0, input_var.getInteraction(),
-            input_var.getNgpreds(), invvarmatrix, input_var.getRobust(), 1);
-    //null_loglik = nrd.loglik;
+#if LOGISTIC
+    logistic_reg nrd=logistic_reg(nrgd);
+    nrd.estimate(nrgd,0,MAXITER,EPS,CHOLTOL,0, input_var.getInteraction(), input_var.getNgpreds(), invvarmatrix, input_var.getRobust(), 1);
+#elif LINEAR
+
+    linear_reg nrd=linear_reg(nrgd);
+
+    nrd.estimate(nrgd,0,CHOLTOL,0, input_var.getInteraction(), input_var.getNgpreds(), invvarmatrix, input_var.getRobust(), 1);
+#elif COXPH
+    coxph_reg nrd(nrgd);
+
+    nrd.estimate(nrgd,0,MAXITER,EPS,CHOLTOL,0, input_var.getInteraction(), input_var.getNgpreds(), 1);
+#endif
+
     std::cout << " estimated null model ...";
     // end null
-    regdata rgd(phd, gtd, 0, input_var.isIsInteractionExcluded());
+#if COXPH
+    coxph_data rgd(phd,gtd,0);
+#else
+    regdata rgd(phd, gtd, 0,input_var.isIsInteractionExcluded());
+#endif
 
     std::cout << " formed regression object ...";
 

Modified: branches/ProbABEL-refactoring/ProbABEL/src/utilities.cpp
===================================================================
--- branches/ProbABEL-refactoring/ProbABEL/src/utilities.cpp	2012-04-14 12:22:17 UTC (rev 892)
+++ branches/ProbABEL-refactoring/ProbABEL/src/utilities.cpp	2012-04-16 22:43:46 UTC (rev 893)
@@ -19,4 +19,3 @@
     printf("ERROR: %s\n", buffer);
     exit(EXIT_FAILURE);
 }
-



More information about the Genabel-commits mailing list