NMath Stats User's Guide

TOC | Previous | Next | Index

6.5 Significance of Parameters (.NET, C#, CSharp, VB, Visual Basic, F#)

Instances of class LinearRegressionParameter test statistical hypothesis about individual parameters in a LinearRegression.

Creating Linear Regression Parameter Objects

You can construct a LinearRegressionParameter from a LinearRegression object and the index of the parameter you wish to test. For instance, this code creates a test object for the third parameter:

Code Example – C# linear regression

LinearRegressionParameter param =
  new LinearRegressionParameter( lr, 2 );

Alternatively, you can get an array of test objects for all parameters in a linear regression using the ParameterEstimates property on LinearRegression:

Code Example – C# linear regression

LinearRegressionParameter[] params = lr.ParameterEstimates; 

Properties Linear Regression Parameters

Class LinearRegressionParameter provides the following properties:

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.

Hypothesis Tests

Class LinearRegressionParameter provides the following methods for testing statistical hypotheses regarding parameter values:

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

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

TStatisticCriticalValue() gets the critical value for the t-statistic for a given alpha level.

ConfidenceInterval() returns a confidence interval for the parameter for a given alpha level.

For example, this code tests whether the fifth parameter in a model is significantly different than zero:

Code Example – C# linear regression

LinearRegressionParameter param =
  new LinearRegressionParameter( lr, 4 );
double tstat = param.TStatistic( 0.0 );
double pValue = param.TStatisticPValue( 0.0 );
double criticalValue = param.TStatisticCriticalValue( 0.05 );
Interval confidenceInterval = param.ConfidenceInterval( 0.05 );

Updating Linear Regression Parameters

The SetRegression() method updates the regression and parameter index in a parameter test object:

Code Example – C# linear regression

param.SetRegression( lr, 6 );

Top

Top