Example #1
0
 public string writeModel(string outModelPath)
 {
     outPath = outModelPath;
     using (System.IO.StreamWriter sw = new System.IO.StreamWriter(outPath))
     {
         sw.WriteLine(modelTypes.LinearRegression.ToString());
         sw.WriteLine(InTablePath);
         sw.WriteLine(String.Join(",", IndependentFieldNames));
         sw.WriteLine(String.Join(",", DependentFieldNames));
         sw.WriteLine(String.Join(",", ClassFieldNames));
         sw.WriteLine(SampleSize.ToString());
         sw.WriteLine(NumberOfVariables.ToString());
         sw.WriteLine(InterceptThroughOrigin.ToString());
         sw.WriteLine(RMSE);
         sw.WriteLine(FValue.ToString());
         sw.WriteLine(PValue.ToString());
         sw.WriteLine(Rsquared.ToString());
         sw.WriteLine(AdjustedRsquared.ToString());
         sw.WriteLine(String.Join(" ", (from double d in Coefficients select d.ToString()).ToArray()));
         sw.WriteLine(String.Join(" ", (from double d in StandardErrors select d.ToString()).ToArray()));
         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()));
         sw.Close();
     }
     return(outPath);
 }
Example #2
0
 public string writeModel(string outModelPath)
 {
     if (lr == null)
     {
         buildModel();
     }
     outPath = outModelPath;
     using (System.IO.StreamWriter sw = new System.IO.StreamWriter(outPath))
     {
         sw.WriteLine(modelTypes.LogisticRegression.ToString());
         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(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()));
         sw.WriteLine(String.Join(",", (from double d in Coefficients select d.ToString()).ToArray()));
         sw.WriteLine(String.Join(",", (from double d in StandardError select d.ToString()).ToArray()));
         sw.WriteLine(String.Join(",", (from Accord.Statistics.Testing.WaldTest d in WaldStatistic select d.Statistic.ToString()).ToArray()));
         sw.WriteLine(String.Join(",", (from Accord.Statistics.Testing.WaldTest d in WaldStatistic select d.PValue.ToString()).ToArray()));
         sw.Close();
     }
     return(outPath);
 }
Example #3
0
 public string writeModel(string outModelPath)
 {
     outPath = outModelPath;
     using (System.IO.StreamWriter sw = new System.IO.StreamWriter(outPath))
     {
         sw.WriteLine(modelTypes.GLM.ToString());
         sw.WriteLine(InTablePath);
         sw.WriteLine(String.Join(",", IndependentFieldNames));
         sw.WriteLine(String.Join(",", DependentFieldNames));
         sw.WriteLine(String.Join(",", ClassFieldNames));
         sw.WriteLine(SampleSize.ToString());
         sw.WriteLine(NumberOfVariables.ToString());
         sw.WriteLine(Iterations.ToString());
         sw.WriteLine(DeltaC.ToString());
         sw.WriteLine(LogLikelihood);
         sw.WriteLine(LogLikelihoodratio);
         sw.WriteLine(PValue.ToString());
         sw.WriteLine(Deviance.ToString());
         sw.WriteLine(ChiSquare.ToString());
         sw.WriteLine(linkfunction.ToString());
         sw.WriteLine(String.Join(" ", (from double d in Coefficients select d.ToString()).ToArray()));
         sw.WriteLine(String.Join(" ", (from double d in StdError select d.ToString()).ToArray()));
         sw.WriteLine(String.Join(" ", (from double d in waldTestValues select d.ToString()).ToArray()));
         sw.WriteLine(String.Join(" ", (from double d in waldTestPValues select d.ToString()).ToArray()));
         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()));
         sw.Close();
     }
     return(outPath);
 }
Example #4
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);
 }
Example #5
0
 public void getReport(double alpha)
 {
     Forms.RunningProcess.frmRunningProcessDialog rd = new Forms.RunningProcess.frmRunningProcessDialog(false);
     rd.Text               = "Logistic Regression Results";
     rd.TopLevel           = true;
     rd.pgbProcess.Visible = false;
     rd.FormBorderStyle    = System.Windows.Forms.FormBorderStyle.Sizable;
     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));
     rd.addMessage("Coef: " + String.Join(" ", (from double d in Coefficients select d.ToString()).ToArray()));
     rd.addMessage("STE:  " + String.Join(", ", (from double d in StandardError select d.ToString()).ToArray()));
     rd.addMessage("\n\nWald stats for coefficients:\nchi-sq: " + String.Join(", ", (from Accord.Statistics.Testing.WaldTest d in WaldStatistic select d.Statistic.ToString()).ToArray()));
     rd.addMessage("p-value: " + String.Join(", ", (from Accord.Statistics.Testing.WaldTest d in WaldStatistic select d.PValue.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)
         {
             createRegChart();
         }
     }
     catch
     {
         System.Windows.Forms.MessageBox.Show("Cannot create charts");
     }
     rd.Show();
     rd.enableClose();
 }
Example #6
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();
 }
Example #7
0
 /// <summary>
 ///   Converts the numeric P-Value of this test to its equivalent string representation.
 /// </summary>
 ///
 public override string ToString()
 {
     return(PValue.ToString(System.Globalization.CultureInfo.CurrentCulture));
 }
Example #8
0
 /// <summary>
 ///   Converts the numeric P-Value of this test to its equivalent string representation.
 /// </summary>
 ///
 public string ToString(string format, IFormatProvider formatProvider)
 {
     return(PValue.ToString(format, formatProvider));
 }