[Genabel-commits] r1139 - pkg/ProbABEL/src

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Mar 13 23:07:18 CET 2013


Author: maartenk
Date: 2013-03-13 23:07:17 +0100 (Wed, 13 Mar 2013)
New Revision: 1139

Modified:
   pkg/ProbABEL/src/main.cpp
Log:
commented out unneeded code (+-230 lines) and removed some duplicated code by a function

Modified: pkg/ProbABEL/src/main.cpp
===================================================================
--- pkg/ProbABEL/src/main.cpp	2013-03-13 19:56:54 UTC (rev 1138)
+++ pkg/ProbABEL/src/main.cpp	2013-03-13 22:07:17 UTC (rev 1139)
@@ -330,6 +330,44 @@
     }
 }
 
+int get_start_position(const cmdvars& input_var, int model, int start_pos,
+        int number_of_rows_or_columns)
+{
+    if (!input_var.getAllcov() && model == 0 && input_var.getInteraction() == 0)
+    {
+        if (input_var.getNgpreds() == 2)
+        {
+            start_pos = number_of_rows_or_columns - 2;
+        } else
+        {
+            start_pos = number_of_rows_or_columns - 1;
+        }
+    } else if (!input_var.getAllcov() && model == 0
+            && input_var.getInteraction() != 0)
+    {
+        if (input_var.getNgpreds() == 2)
+        {
+            start_pos = number_of_rows_or_columns - 4;
+        } else
+        {
+            start_pos = number_of_rows_or_columns - 2;
+        }
+    } else if (!input_var.getAllcov() && model != 0
+            && input_var.getInteraction() == 0)
+    {
+        start_pos = number_of_rows_or_columns - 1;
+    } else if (!input_var.getAllcov() && model != 0
+            && input_var.getInteraction() != 0)
+    {
+        start_pos = number_of_rows_or_columns - 2;
+    } else
+    {
+        start_pos = 0;
+    }
+
+    return start_pos;
+}
+
 int main(int argc, char * argv[])
 {
     cmdvars input_var;
@@ -593,323 +631,20 @@
             {
                 write_mlinfo(outfile, file, mli, csnp, input_var, gcount, freq);
             }
+        } else
+        {
 
-            for (int model = 0; model < maxmod; model++)
-            {
-                if (poly) //allel freq is not to rare
-                {
+            int file = 0;
+            write_mlinfo(outfile, file, mli, csnp, input_var, gcount, freq);
+            maxmod = 1;
 
-#if LOGISTIC
-                    logistic_reg rd(rgd);
-                    if (input_var.getScore())
-                    rd.score(nrd.residuals, rgd, 0, CHOLTOL, model,
-                            input_var.getInteraction(),
-                            input_var.getNgpreds(),
-                            invvarmatrix);
-                    else
-                    rd.estimate(rgd, 0, MAXITER, EPS, CHOLTOL, model,
-                            input_var.getInteraction(),
-                            input_var.getNgpreds(),
-                            invvarmatrix,
-                            input_var.getRobust());
-#elif LINEAR
-                    linear_reg rd(rgd);
-                    if (input_var.getScore())
-                        rd.score(nrd.residuals, rgd, 0, CHOLTOL, model,
-                                input_var.getInteraction(),
-                                input_var.getNgpreds(), invvarmatrix);
-                    else
-                    {
-                        //	rd.mmscore(rgd,0,CHOLTOL,model,input_var.getInteraction(), input_var.getNgpreds(), invvarmatrix);
-                        rd.estimate(rgd, 0, CHOLTOL, model,
-                                input_var.getInteraction(),
-                                input_var.getNgpreds(), invvarmatrix,
-                                input_var.getRobust());
-                    }
-#elif COXPH
-                    coxph_reg rd(rgd);
-                    rd.estimate(rgd, 0, MAXITER, EPS, CHOLTOL, model,
-                            input_var.getInteraction(), true,
-                            input_var.getNgpreds());
-#endif
-
-                    if (!input_var.getAllcov() && model == 0
-                            && input_var.getInteraction() == 0)
-                    {
-                        if (input_var.getNgpreds() == 2)
-                        {
-                            start_pos = rd.beta.nrow - 2;
-                        } else
-                        {
-                            start_pos = rd.beta.nrow - 1;
-                        }
-                    } else if (!input_var.getAllcov() && model == 0
-                            && input_var.getInteraction() != 0)
-                    {
-                        if (input_var.getNgpreds() == 2)
-                        {
-                            start_pos = rd.beta.nrow - 4;
-                        } else
-                        {
-                            start_pos = rd.beta.nrow - 2;
-                        }
-                    } else if (!input_var.getAllcov() && model != 0
-                            && input_var.getInteraction() == 0)
-                    {
-                        start_pos = rd.beta.nrow - 1;
-                    } else if (!input_var.getAllcov() && model != 0
-                            && input_var.getInteraction() != 0)
-                    {
-                        start_pos = rd.beta.nrow - 2;
-                    } else
-                    {
-                        start_pos = 0;
-                    }
-
-                    for (int pos = start_pos; pos < rd.beta.nrow; pos++)
-                    {
-                        *beta_sebeta[model] << input_var.getSep()
-                                << rd.beta[pos]
-                                << input_var.getSep()
-                                << rd.sebeta[pos];
-                        //Han Chen
-#if !COXPH
-                        if (input_var.getInverseFilename() == NULL
-                                && !input_var.getAllcov()
-                                && input_var.getInteraction() != 0)
-                        {
-                            if (pos > start_pos)
-                            {
-                                if (model == 0)
-                                {
-                                    if (pos > start_pos + 2
-                                            || input_var.getNgpreds() != 2)
-                                    {
-                                        *covvalue[model] << rd.covariance[pos
-                                                - 3]
-                                                << input_var.getSep()
-                                                << rd.covariance[pos - 2];
-                                    }
-                                } else
-                                {
-                                    *covvalue[model] << rd.covariance[pos - 1];
-                                }
-                            }
-                        }
-#endif
-                        //Oct 26, 2009
-                    }
-
-                    //calculate chi2
-                    //________________________________
-                    //cout <<  rd.loglik<<" "<<input_var.getNgpreds() << "\n";
-
-                    if ((input_var.getInverseFilename() == NULL
-                            && input_var.getNgpreds() != 2)
-                            || input_var.getNgpreds() == 2)
-                    {
-                        cout << rd.loglik
-                                << " "
-                                << input_var.getNgpreds()
-                                << "\n";
-                        if (input_var.getScore() == 0)
-                        {
-                            //*chi2[model] << 2.*(rd.loglik-null_loglik);
-                            *chi2[model] << rd.loglik;
-                        } else
-                        {
-                            //*chi2[model] << rd.chi2_score;
-                            *chi2[model] << "nan";
-                        }
-                    }
-                    //________________________________
-                } else //beta, sebeta = nan
-                {
-                    if (!input_var.getAllcov() && model == 0
-                            && input_var.getInteraction() == 0)
-                    {
-                        if (input_var.getNgpreds() == 2)
-                        {
-                            start_pos = rgd.X.ncol - 2;
-                        } else
-                        {
-                            start_pos = rgd.X.ncol - 1;
-                        }
-                    } else if (!input_var.getAllcov() && model == 0
-                            && input_var.getInteraction() != 0)
-                    {
-                        if (input_var.getNgpreds() == 2)
-                        {
-                            start_pos = rgd.X.ncol - 4;
-                        } else
-                        {
-                            start_pos = rgd.X.ncol - 2;
-                        }
-                    } else if (!input_var.getAllcov() && model != 0
-                            && input_var.getInteraction() == 0)
-                    {
-                        start_pos = rgd.X.ncol - 1;
-                    } else if (!input_var.getAllcov() && model != 0
-                            && input_var.getInteraction() != 0)
-                    {
-                        start_pos = rgd.X.ncol - 2;
-                    } else
-                    {
-                        start_pos = 0;
-                    }
-                    if (input_var.getInteraction() != 0
-                            && !input_var.getAllcov()
-                            && input_var.getNgpreds() != 2)
-                    {
-                        start_pos++;
-                    }
-
-                    if (model == 0)
-                    {
-                        end_pos = rgd.X.ncol;
-                    } else
-                    {
-                        end_pos = rgd.X.ncol - 1;
-                    }
-
-                    if (input_var.getInteraction() != 0)
-                    {
-                        end_pos++;
-                    }
-
-                    for (int pos = start_pos; pos < end_pos; pos++)
-                    {
-                        *beta_sebeta[model] << input_var.getSep()
-                                << "nan"
-                                << input_var.getSep()
-                                << "nan";
-                    }
-
-                    if (input_var.getNgpreds() == 2)
-                    {
-                        //Han Chen
-#if !COXPH
-                        if (!input_var.getAllcov()
-                                && input_var.getInteraction() != 0)
-                        {
-                            if (model == 0)
-                            {
-                                *covvalue[model] << "nan"
-                                        << input_var.getSep()
-                                        << "nan";
-                            } else
-                            {
-                                *covvalue[model] << "nan";
-                            }
-                        }
-#endif
-                        //Oct 26, 2009
-                        *chi2[model] << "nan";
-                    } else
-                    { //ngpreds=1
-                        if (input_var.getInverseFilename() == NULL)
-                        {
-                            //                     Han Chen
-#if !COXPH
-                            if (!input_var.getAllcov()
-                                    && input_var.getInteraction() != 0)
-                            {
-                                *covvalue[model] << "nan";
-                            }
-#endif
-                            //Oct 26, 2009
-                            *chi2[model] << "nan";
-                        }
-                    }
-
-                }
-            }
-            //end of model cycle
-            if (input_var.getNgpreds() == 2)
-            {
-                cout << "ngpreds==2 model end" << "\n";
-
-                //Han Chen
-                *outfile[0] << beta_sebeta[0]->str() << input_var.getSep();
-#if !COXPH
-                if (!input_var.getAllcov() && input_var.getInteraction() != 0)
-                {
-                    *outfile[0] << covvalue[0]->str() << input_var.getSep();
-                }
-#endif
-                *outfile[0] << chi2[0]->str() << "\n";
-
-                *outfile[1] << beta_sebeta[1]->str() << input_var.getSep();
-#if !COXPH
-                if (!input_var.getAllcov() && input_var.getInteraction() != 0)
-                {
-                    *outfile[1] << covvalue[1]->str() << input_var.getSep();
-                }
-#endif
-                *outfile[1] << chi2[1]->str() << "\n";
-
-                *outfile[2] << beta_sebeta[2]->str() << input_var.getSep();
-#if !COXPH
-                if (!input_var.getAllcov() && input_var.getInteraction() != 0)
-                {
-                    *outfile[2] << covvalue[2]->str() << input_var.getSep();
-                }
-#endif
-                *outfile[2] << chi2[2]->str() << "\n";
-
-                *outfile[3] << beta_sebeta[3]->str() << input_var.getSep();
-#if !COXPH
-                if (!input_var.getAllcov() && input_var.getInteraction() != 0)
-                {
-                    *outfile[3] << covvalue[3]->str() << input_var.getSep();
-                }
-#endif
-                *outfile[3] << chi2[3]->str() << "\n";
-
-                *outfile[4] << beta_sebeta[4]->str() << input_var.getSep();
-#if !COXPH
-                if (!input_var.getAllcov() && input_var.getInteraction() != 0)
-                {
-                    *outfile[4] << covvalue[4]->str() << input_var.getSep();
-                }
-#endif
-                *outfile[4] << chi2[4]->str() << "\n";
-                //Oct 26, 2009
-
-            } else  //ngpreds == 1
-            {
-
-                if (input_var.getInverseFilename() == NULL)
-                {
-                    //Han Chen
-                    *outfile[0] << beta_sebeta[0]->str() << input_var.getSep();
-#if !COXPH
-                    if (!input_var.getAllcov()
-                            && input_var.getInteraction() != 0)
-                    {
-                        *outfile[0] << covvalue[0]->str() << input_var.getSep();
-                    }
-#endif
-                    *outfile[0] << chi2[0]->str() << "\n";
-                    //Oct 26, 2009
-                } else
-                {
-                    *outfile[0] << beta_sebeta[0]->str() << "\n";
-                }
-            }  // end ngpreds ==1
-
         }
-//
-//End of All models output.
-//
-        else  //Only additive model. Only one output file
+
+        for (int model = 0; model < maxmod; model++)
         {
-            //Write mlinfo to output:
-            int file = 0;
-            write_mlinfo(outfile, file, mli, csnp, input_var, gcount, freq);
-            int model = 0;
-            if (poly)  //allel freq is not to rare
+            if (poly) //allel freq is not to rare
             {
+
 #if LOGISTIC
                 logistic_reg rd(rgd);
                 if (input_var.getScore())
@@ -924,88 +659,17 @@
                         invvarmatrix,
                         input_var.getRobust());
 #elif LINEAR
-                //cout << (rgd.get_unmasked_data()).nids << " 1\n";
-#if DEBUG
-                rgd.X.print();
-                rgd.Y.print();
-#endif
                 linear_reg rd(rgd);
-#if DEBUG
-                rgd.X.print();
-                rgd.Y.print();
-#endif
-                //cout << (rgd.get_unmasked_data()).nids << " 2\n";
                 if (input_var.getScore())
-                {
-#if DEBUG
-                    cout << "input_var.getScore/n";
-                    nrd.residuals.print();
-                    cout << CHOLTOL << " <-CHOLTOL\n";
-                    cout << model << " <-model\n";
-                    cout << input_var.getInteraction()
-                    << " <-input_var.getInteraction()\n";
-                    cout << input_var.getNgpreds()
-                    << " <-input_var.getNgpreds()\n";
-                    invvarmatrix.print();
-#endif
                     rd.score(nrd.residuals, rgd, 0, CHOLTOL, model,
                             input_var.getInteraction(), input_var.getNgpreds(),
                             invvarmatrix);
-#if DEBUG
-                    rd.beta.print();
-                    cout << rd.chi2_score << " <-chi2_scoren\n";
-                    rd.covariance.print();
-                    rd.residuals.print();
-                    rd.sebeta.print();
-                    cout << rd.loglik << " <-logliken\n";
-                    cout << rd.sigma2 << " <-sigma2\n";
-#endif
-                } else
+                else
                 {
-                    // if(input_var.getInverseFilename()== NULL)
-                    // {
-                    // cout << (rgd.get_unmasked_data()).nids << " 3\n";
-#if DEBUG
-                    cout << "rd.estimate\n";
-                    cout << CHOLTOL << " <-CHOLTOL\n";
-                    cout << model << " <-model\n";
-                    cout << input_var.getInteraction()
-                    << " <-input_var.getInteraction()\n";
-                    cout << input_var.getNgpreds()
-                    << " <-input_var.getNgpreds()\n";
-                    cout << input_var.getRobust()
-                    << " <-input_var.getRobust()\n";
-                    cout << "start invarmatrix\n";
-                    invvarmatrix.print();
-                    cout << "end invarmatrix\n";
-                    cout << rgd.is_interaction_excluded
-                    << " <-rgd.is_interaction_excluded\n";
-#endif
+                    //	rd.mmscore(rgd,0,CHOLTOL,model,input_var.getInteraction(), input_var.getNgpreds(), invvarmatrix);
                     rd.estimate(rgd, 0, CHOLTOL, model,
                             input_var.getInteraction(), input_var.getNgpreds(),
                             invvarmatrix, input_var.getRobust());
-
-#if DEBUG
-                    cout << "rd.beta\n";
-                    rd.beta.print();
-                    cout << rd.chi2_score << " <-chi2_scoren\n";
-                    cout << "rd.covariance\n";
-                    rd.covariance.print();
-                    cout << "rd.residuals\n";
-                    rd.residuals.print();
-                    cout << "rd.sebeta\n";
-                    rd.sebeta.print();
-                    cout << rd.loglik << " <-logliken\n";
-                    cout << rd.sigma2 << " <-sigma2\n";
-#endif
-                    //cout << (rgd.get_unmasked_data()).nids << " 4\n";
-                    //}
-                    //else
-                    //{
-                    //   rd.mmscore(rgd, 0, CHOLTOL, model,
-                    //              input_var.getInteraction(),
-                    //              input_var.getNgpreds(), invvarmatrix);
-                    //}
                 }
 #elif COXPH
                 coxph_reg rd(rgd);
@@ -1014,23 +678,13 @@
                         input_var.getNgpreds());
 #endif
 
-                if (!input_var.getAllcov() && input_var.getInteraction() == 0)
-                {
-                    start_pos = rd.beta.nrow - 1;
-                } else if (!input_var.getAllcov()
-                        && input_var.getInteraction() != 0)
-                {
-                    start_pos = rd.beta.nrow - 2;
-                } else
-                {
-                    start_pos = 0;
-                }
-#if DEBUG
-                cout << " start_pos;" << start_pos << "\n";
-#endif
+                int number_of_rows_or_columns = rd.beta.nrow;
+                start_pos = get_start_position(input_var, model, start_pos,
+                        number_of_rows_or_columns);
+                cout << "start_pos" << start_pos << "\n";
                 for (int pos = start_pos; pos < rd.beta.nrow; pos++)
                 {
-                    *beta_sebeta[0] << input_var.getSep()
+                    *beta_sebeta[model] << input_var.getSep()
                             << rd.beta[pos]
                             << input_var.getSep()
                             << rd.sebeta[pos];
@@ -1042,7 +696,29 @@
                     {
                         if (pos > start_pos)
                         {
-                            *covvalue[0] << rd.covariance[pos - 1];
+                            if (model == 0)
+                            {
+                                if (input_var.getNgpreds() == 2)
+                                {
+                                    if (pos > start_pos + 2)
+                                    {
+                                        *covvalue[model] << rd.covariance[pos
+                                                - 3]
+                                                << input_var.getSep()
+                                                << rd.covariance[pos - 2];
+                                    }
+
+                                } //end ngpred=2
+                                else
+                                {
+                                    *covvalue[model] << rd.covariance[pos - 1];
+                                }
+
+                            } //end model
+                            else
+                            {
+                                *covvalue[model] << rd.covariance[pos - 1];
+                            } //end ngpred==1
                         }
                     }
 #endif
@@ -1051,62 +727,150 @@
 
                 //calculate chi2
                 //________________________________
-                if (input_var.getInverseFilename() == NULL)
+                //cout <<  rd.loglik<<" "<<input_var.getNgpreds() << "\n";
+
+                if ((input_var.getInverseFilename() == NULL
+                        && input_var.getNgpreds() != 2)
+                        || input_var.getNgpreds() == 2)
                 {
-#if DEBUG
-                    cout << " inverse_filename == NULL" << "\n";
-#endif
+
                     if (input_var.getScore() == 0)
                     {
-                        *chi2[0] << rd.loglik; //2.*(rd.loglik-null_loglik);
+                        //*chi2[model] << 2.*(rd.loglik-null_loglik);
+                        *chi2[model] << rd.loglik;
                     } else
                     {
-                        *chi2[0] << "nan"; //rd.chi2_score;
+                        //*chi2[model] << rd.chi2_score;
+                        *chi2[model] << "nan";
                     }
                 }
                 //________________________________
             } else //beta, sebeta = nan
             {
-                if (!input_var.getAllcov() && input_var.getInteraction() == 0)
-                    start_pos = rgd.X.ncol - 1;
-                else if (!input_var.getAllcov()
-                        && input_var.getInteraction() != 0)
-                    start_pos = rgd.X.ncol - 2;
-                else
-                    start_pos = 0;
+                int number_of_rows_or_columns = rgd.X.ncol;
+                start_pos = get_start_position(input_var, model, start_pos,
+                        number_of_rows_or_columns);
 
-                end_pos = rgd.X.ncol;
-                if (input_var.getInteraction() != 0)
+                if (input_var.getInteraction() != 0 && !input_var.getAllcov()
+                        && input_var.getNgpreds() != 2)
                 {
-                    end_pos++;
+                    start_pos++;
                 }
-                if (input_var.getInteraction() != 0 && !input_var.getAllcov())
+
+                if (model == 0)
                 {
-                    start_pos++;
+                    end_pos = rgd.X.ncol;
+                } else
+                {
+                    end_pos = rgd.X.ncol - 1;
                 }
 
+                if (input_var.getInteraction() != 0)
+                {
+                    end_pos++;
+                }
+
                 for (int pos = start_pos; pos < end_pos; pos++)
                 {
-                    *beta_sebeta[0] << input_var.getSep()
+                    *beta_sebeta[model] << input_var.getSep()
                             << "nan"
                             << input_var.getSep()
                             << "nan";
                 }
-                if (input_var.getInverseFilename() == NULL)
+
+                if (input_var.getNgpreds() == 2)
                 {
                     //Han Chen
 #if !COXPH
                     if (!input_var.getAllcov()
                             && input_var.getInteraction() != 0)
                     {
-                        *covvalue[0] << "nan";
+                        if (model == 0)
+                        {
+                            *covvalue[model] << "nan"
+                                    << input_var.getSep()
+                                    << "nan";
+                        } else
+                        {
+                            *covvalue[model] << "nan";
+                        }
                     }
 #endif
                     //Oct 26, 2009
-                    *chi2[0] << "nan";
+                    *chi2[model] << "nan";
+                } else
+                { //ngpreds=1
+                    if (input_var.getInverseFilename() == NULL)
+                    {
+                        //                     Han Chen
+#if !COXPH
+                        if (!input_var.getAllcov()
+                                && input_var.getInteraction() != 0)
+                        {
+                            *covvalue[model] << "nan";
+                        }
+#endif
+                        //Oct 26, 2009
+                        *chi2[model] << "nan";
+                    }
                 }
+
             }
+        }
+        //end of model cycle
+        if (input_var.getNgpreds() == 2)
+        {
 
+            //Han Chen
+            *outfile[0] << beta_sebeta[0]->str() << input_var.getSep();
+#if !COXPH
+            if (!input_var.getAllcov() && input_var.getInteraction() != 0)
+            {
+                *outfile[0] << covvalue[0]->str() << input_var.getSep();
+            }
+#endif
+            *outfile[0] << chi2[0]->str() << "\n";
+
+            *outfile[1] << beta_sebeta[1]->str() << input_var.getSep();
+#if !COXPH
+            if (!input_var.getAllcov() && input_var.getInteraction() != 0)
+            {
+                *outfile[1] << covvalue[1]->str() << input_var.getSep();
+            }
+#endif
+            *outfile[1] << chi2[1]->str() << "\n";
+
+            *outfile[2] << beta_sebeta[2]->str() << input_var.getSep();
+#if !COXPH
+            if (!input_var.getAllcov() && input_var.getInteraction() != 0)
+            {
+                *outfile[2] << covvalue[2]->str() << input_var.getSep();
+            }
+#endif
+            *outfile[2] << chi2[2]->str() << "\n";
+
+            *outfile[3] << beta_sebeta[3]->str() << input_var.getSep();
+#if !COXPH
+            if (!input_var.getAllcov() && input_var.getInteraction() != 0)
+            {
+                *outfile[3] << covvalue[3]->str() << input_var.getSep();
+            }
+#endif
+            *outfile[3] << chi2[3]->str() << "\n";
+
+            *outfile[4] << beta_sebeta[4]->str() << input_var.getSep();
+#if !COXPH
+            if (!input_var.getAllcov() && input_var.getInteraction() != 0)
+            {
+                *outfile[4] << covvalue[4]->str() << input_var.getSep();
+            }
+#endif
+            *outfile[4] << chi2[4]->str() << "\n";
+            //Oct 26, 2009
+
+        } else  //ngpreds == 1
+        {
+
             if (input_var.getInverseFilename() == NULL)
             {
                 //Han Chen
@@ -1117,17 +881,244 @@
                     *outfile[0] << covvalue[0]->str() << input_var.getSep();
                 }
 #endif
-                *outfile[0] << chi2[model]->str() << "\n";
+                *outfile[0] << chi2[0]->str() << "\n";
                 //Oct 26, 2009
             } else
             {
                 *outfile[0] << beta_sebeta[0]->str() << "\n";
-#if DEBUG
-                cout << "Se beta" << beta_sebeta[0] << "\n";
-#endif
             }
+            //}  // end ngpreds ==1
+
         }
 //
+//End of All models output.
+//
+//        else  //Only additive model. Only one output file
+//        {
+//            //Write mlinfo to output:
+//            int file = 0;
+//            write_mlinfo(outfile, file, mli, csnp, input_var, gcount, freq);
+//            int model = 0;
+//            if (poly)  //allel freq is not to rare
+//            {
+//#if LOGISTIC
+//                logistic_reg rd(rgd);
+//                if (input_var.getScore())
+//                rd.score(nrd.residuals, rgd, 0, CHOLTOL, model,
+//                        input_var.getInteraction(),
+//                        input_var.getNgpreds(),
+//                        invvarmatrix);
+//                else
+//                rd.estimate(rgd, 0, MAXITER, EPS, CHOLTOL, model,
+//                        input_var.getInteraction(),
+//                        input_var.getNgpreds(),
+//                        invvarmatrix,
+//                        input_var.getRobust());
+//#elif LINEAR
+//                //cout << (rgd.get_unmasked_data()).nids << " 1\n";
+//#if DEBUG
+//                rgd.X.print();
+//                rgd.Y.print();
+//#endif
+//                linear_reg rd(rgd);
+//#if DEBUG
+//                rgd.X.print();
+//                rgd.Y.print();
+//#endif
+//                //cout << (rgd.get_unmasked_data()).nids << " 2\n";
+//                if (input_var.getScore())
+//                {
+//#if DEBUG
+//                    cout << "input_var.getScore/n";
+//                    nrd.residuals.print();
+//                    cout << CHOLTOL << " <-CHOLTOL\n";
+//                    cout << model << " <-model\n";
+//                    cout << input_var.getInteraction()
+//                    << " <-input_var.getInteraction()\n";
+//                    cout << input_var.getNgpreds()
+//                    << " <-input_var.getNgpreds()\n";
+//                    invvarmatrix.print();
+//#endif
+//                    rd.score(nrd.residuals, rgd, 0, CHOLTOL, model,
+//                            input_var.getInteraction(), input_var.getNgpreds(),
+//                            invvarmatrix);
+//#if DEBUG
+//                    rd.beta.print();
+//                    cout << rd.chi2_score << " <-chi2_scoren\n";
+//                    rd.covariance.print();
+//                    rd.residuals.print();
+//                    rd.sebeta.print();
+//                    cout << rd.loglik << " <-logliken\n";
+//                    cout << rd.sigma2 << " <-sigma2\n";
+//#endif
+//                } else
+//                {
+//                    // if(input_var.getInverseFilename()== NULL)
+//                    // {
+//                    // cout << (rgd.get_unmasked_data()).nids << " 3\n";
+//#if DEBUG
+//                    cout << "rd.estimate\n";
+//                    cout << CHOLTOL << " <-CHOLTOL\n";
+//                    cout << model << " <-model\n";
+//                    cout << input_var.getInteraction()
+//                    << " <-input_var.getInteraction()\n";
+//                    cout << input_var.getNgpreds()
+//                    << " <-input_var.getNgpreds()\n";
+//                    cout << input_var.getRobust()
+//                    << " <-input_var.getRobust()\n";
+//                    cout << "start invarmatrix\n";
+//                    invvarmatrix.print();
+//                    cout << "end invarmatrix\n";
+//                    cout << rgd.is_interaction_excluded
+//                    << " <-rgd.is_interaction_excluded\n";
+//#endif
+//                    rd.estimate(rgd, 0, CHOLTOL, model,
+//                            input_var.getInteraction(), input_var.getNgpreds(),
+//                            invvarmatrix, input_var.getRobust());
+//
+//#if DEBUG
+//                    cout << "rd.beta\n";
+//                    rd.beta.print();
+//                    cout << rd.chi2_score << " <-chi2_scoren\n";
+//                    cout << "rd.covariance\n";
+//                    rd.covariance.print();
+//                    cout << "rd.residuals\n";
+//                    rd.residuals.print();
+//                    cout << "rd.sebeta\n";
+//                    rd.sebeta.print();
+//                    cout << rd.loglik << " <-logliken\n";
+//                    cout << rd.sigma2 << " <-sigma2\n";
+//#endif
+//                    //cout << (rgd.get_unmasked_data()).nids << " 4\n";
+//                    //}
+//                    //else
+//                    //{
+//                    //   rd.mmscore(rgd, 0, CHOLTOL, model,
+//                    //              input_var.getInteraction(),
+//                    //              input_var.getNgpreds(), invvarmatrix);
+//                    //}
+//                }
+//#elif COXPH
+//                coxph_reg rd(rgd);
+//                rd.estimate(rgd, 0, MAXITER, EPS, CHOLTOL, model,
+//                        input_var.getInteraction(), true,
+//                        input_var.getNgpreds());
+//#endif
+//
+//                if (!input_var.getAllcov() && input_var.getInteraction() == 0)
+//                {
+//                    start_pos = rd.beta.nrow - 1;
+//                } else if (!input_var.getAllcov()
+//                        && input_var.getInteraction() != 0)
+//                {
+//                    start_pos = rd.beta.nrow - 2;
+//                } else
+//                {
+//                    start_pos = 0;
+//                }
+//#if DEBUG
+//                cout << " start_pos;" << start_pos << "\n";
+//#endif
+//                for (int pos = start_pos; pos < rd.beta.nrow; pos++)
+//                {
[TRUNCATED]

To get the complete diff run:
    svnlook diff /svnroot/genabel -r 1139


More information about the Genabel-commits mailing list