NMath User's Guide

TOC | Previous | Next | Index

43.5 Parameter Estimates (.NET, C#, CSharp, VB, Visual Basic, F#)

The ParameterEstimates property on LogisticRegression gets an array of LogisticRegressionParameter estimate objects. This class tests statistical hypotheses about estimated parameters in logistic regressions:

Value gets the value of the parameter.

StandardError gets the standard error of the parameter.

ParameterIndex gets the index of the parameter in the linear regresssion.

Beta gets the standardized beta coefficient. Beta coefficients are weighted by the ratio of the standard deviation of the independent variable over the standard deviation of the dependent variable.

ConfidenceInterval() returns the 1 - alpha confidence interval for the parameter.

TStatistic() returns the t-statistic for the null hypothesis that the parameter is equal to a given test value.

TStatisticPValue() returns the p-value for a t-test with the null hypothesis that the parameter is equal to a given test value versus the alternative hypothesis that it is not.

TStatisticCriticalValue() gets the critical value of the t-statistic for the specified alpha level.

For instance, this code prints out the model parameter estimates and standard error.

Code Example – C# logistic regression

var parameterEstimates = lr.ParameterEstimates;
for ( int i = 0; i < parameterEstimates.Length; i++ )
  var estimate = parameterEstimates[i];
  if ( i == 0 )
    Console.WriteLine( "Constant term = {0}, SE = {1}", 
      estimate.Value, estimate.StandardError);
    Console.WriteLine( "Coefficient for {0} = {1}, SE = {2}", 
      df[i].Name, estimate.Value, estimate.StandardError);

Code Example – VB logistic regression

Dim ParameterEstimates = LR.ParameterEstimates
For I As Integer = 0 To ParameterEstimates.Length - 1
  Dim Estimate = ParameterEstimates(I)
  If (I = 0) Then
    Console.WriteLine("Constant term = {0}, SE = {1}",
      Estimate.Value, Estimate.StandardError)
    Console.WriteLine("Coefficient for {0} = {1}, SE = {2}",
      DF(I).Name, Estimate.Value, Estimate.StandardError)
  End If