Esempio n. 1
0
 public void getReport(double alpha)
 {
     Forms.RunningProcess.frmRunningProcessDialog rd = new Forms.RunningProcess.frmRunningProcessDialog(false);
     rd.Text               = "PLR Results";
     rd.TopLevel           = true;
     rd.pgbProcess.Visible = false;
     rd.FormBorderStyle    = System.Windows.Forms.FormBorderStyle.Sizable;
     rd.addMessage("Iterations = " + NumberOfIterationsToConverge.ToString());
     rd.addMessage("Convergence = " + Delta.ToString());
     rd.addMessage("LogLikelihood = " + LogLikelihood.ToString());
     rd.addMessage("Deviance = " + Deviance.ToString());
     rd.addMessage("Likelihood Ratio Chi-squared = " + X2.ToString() + " DF = " + DegreesOfFredom.ToString() + " p-value = " + PValue.ToString());
     rd.addMessage("\n\nClasses: " + String.Join(", ", Categories));
     rd.addMessage("Reference Class = " + Categories[0]);
     rd.addMessage("\nParameter coefficients:\n");
     rd.addMessage("intercept, " + String.Join(", ", IndependentFieldNames));
     for (int i = 0; i < Coefficients.Length; i++)
     {
         double[] c = Coefficients[i];
         rd.addMessage(String.Join(" ", (from double d in c select d.ToString()).ToArray()));
     }
     rd.addMessage("\nParameter standard error:");
     for (int i = 0; i < StandardError.Length; i++)
     {
         double[] c = StandardError[i];
         rd.addMessage(String.Join(", ", (from double d in c select d.ToString()).ToArray()));
     }
     rd.addMessage("\nParameter Wald Chi-Squared:");
     for (int i = 0; i < WaldStatistic.Length; i++)
     {
         double[] c = WaldStatistic[i];
         rd.addMessage(String.Join(", ", (from double d in c select d.ToString()).ToArray()));
     }
     rd.addMessage("\nParameter Wald P-value:");
     for (int i = 0; i < WaldPvalue.Length; i++)
     {
         double[] c = WaldPvalue[i];
         rd.addMessage(String.Join(", ", (from double d in c select d.ToString()).ToArray()));
     }
     try
     {
         if (ModelHelper.chartingAvailable() && System.Windows.Forms.MessageBox.Show("Do you want to build probability graphs?", "Graphs", System.Windows.Forms.MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes)
         {
             regChart();
             //if (mlr == null) mlr = buildModel();
         }
     }
     catch
     {
         System.Windows.Forms.MessageBox.Show("Cannot create charts");
     }
     rd.Show();
     rd.enableClose();
 }
Esempio n. 2
0
 public string writeModel(string outModelPath)
 {
     if (mlr == null)
     {
         buildModel();
     }
     outPath = outModelPath;
     using (System.IO.StreamWriter sw = new System.IO.StreamWriter(outPath))
     {
         sw.WriteLine(modelTypes.PLR);
         sw.WriteLine(InTablePath);
         sw.WriteLine(String.Join(",", IndependentFieldNames));
         sw.WriteLine(String.Join(",", DependentFieldNames));
         sw.WriteLine(String.Join(",", ClassFieldNames));
         sw.WriteLine(String.Join(",", Categories));
         sw.WriteLine(NumberOfIndependentVariables.ToString());
         sw.WriteLine(NumberOfCategories.ToString());
         sw.WriteLine(Delta.ToString());
         sw.WriteLine(NumberOfIterationsToConverge.ToString());
         sw.WriteLine(LogLikelihood.ToString());
         sw.WriteLine(Deviance.ToString());
         sw.WriteLine(X2.ToString());
         sw.WriteLine(PValue.ToString());
         sw.WriteLine(String.Join(",", (from double d in minValues select d.ToString()).ToArray()));
         sw.WriteLine(String.Join(",", (from double d in maxValues select d.ToString()).ToArray()));
         sw.WriteLine(String.Join(",", (from double d in sumValues select d.ToString()).ToArray()));
         for (int i = 0; i < Coefficients.Length; i++)
         {
             string[] vlArr = (from double d in Coefficients[i] select d.ToString()).ToArray();
             sw.WriteLine(String.Join(" ", vlArr));
         }
         for (int i = 0; i < StandardError.Length; i++)
         {
             string[] vlArr = (from double d in StandardError[i] select d.ToString()).ToArray();
             sw.WriteLine(String.Join(" ", vlArr));
         }
         for (int i = 0; i < WaldStatistic.Length; i++)
         {
             string[] vlArr = (from double d in WaldStatistic[i] select d.ToString()).ToArray();
             sw.WriteLine(String.Join(" ", vlArr));
         }
         for (int i = 0; i < WaldPvalue.Length; i++)
         {
             string[] vlArr = (from double d in WaldPvalue[i] select d.ToString()).ToArray();
             sw.WriteLine(String.Join(" ", vlArr));
         }
         sw.Close();
     }
     return(outPath);
 }