Click or drag to resize
Accord.NET (logo)

MultipleLinearRegressionAnalysis Class

Multiple Linear Regression Analysis
Inheritance Hierarchy
SystemObject
  Accord.MachineLearningTransformBaseDouble, Double
    Accord.Statistics.AnalysisMultipleLinearRegressionAnalysis

Namespace:  Accord.Statistics.Analysis
Assembly:  Accord.Statistics (in Accord.Statistics.dll) Version: 3.7.0
Syntax
[SerializableAttribute]
public class MultipleLinearRegressionAnalysis : TransformBase<double[], double>, 
	IRegressionAnalysis, IMultivariateAnalysis, IAnalysis, IAnova, ISupervisedLearning<MultipleLinearRegression, double[], double>
Request Example View Source

The MultipleLinearRegressionAnalysis type exposes the following members.

Constructors
Properties
  NameDescription
Public propertyArray Obsolete.
Source data used in the analysis.
Public propertyChiSquareTest
Gets a Chi-Square Test between the expected outputs and the results.
Public propertyCoefficients
Gets the collection of coefficients of the model.
Public propertyCoefficientValues
Gets the value of each coefficient.
Public propertyConfidences
Gets the Confidence Intervals (C.I.) for each coefficient found in the regression.
Public propertyFTest
Gets a F-Test between the expected outputs and results.
Public propertyInformationMatrix
Gets the information matrix obtained during learning.
Public propertyInputs
Gets or sets the name of the input variables for the model.
Public propertyNumberOfInputs
Gets the number of inputs accepted by the model.
(Inherited from TransformBaseTInput, TOutput.)
Public propertyNumberOfOutputs
Gets the number of outputs generated by the model.
(Inherited from TransformBaseTInput, TOutput.)
Public propertyNumberOfSamples
Gets the number of samples used to compute the analysis.
Public propertyOrdinaryLeastSquares
Gets or sets the learning algorithm used to learn the MultipleLinearRegression.
Public propertyOutput
Gets or sets the name of the output variable for the model.
Public propertyOutputs Obsolete.
Gets the dependent variable value for each of the source input points.
Public propertyRegression
Gets the Regression model created and evaluated by this analysis.
Public propertyResults Obsolete.
Gets the resulting values obtained by the linear regression model.
Public propertyRSquareAdjusted
Gets the adjusted coefficient of determination, as known as R² adjusted
Public propertyRSquared
Gets the coefficient of determination, as known as R²
Public propertySource Obsolete.
Source data used in the analysis.
Public propertyStandardError
Gets the standard deviation of the errors.
Public propertyStandardErrors
Gets the Standard Error for each coefficient found during the logistic regression.
Public propertyTable
Gets the ANOVA table for the analysis.
Public propertyToken
Gets or sets a cancellation token that can be used to stop the learning algorithm while it is running.
Public propertyZTest
Gets a Z-Test between the expected outputs and the results.
Top
Methods
  NameDescription
Public methodCompute Obsolete.
Computes the Multiple Linear Regression Analysis.
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public methodGetConfidenceInterval
Gets the confidence interval for a given input.
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetPredictionInterval
Gets the prediction interval for a given input.
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodLearn
Learns a model that can map the given inputs to the given outputs.
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Public methodTransform(TInput)
Applies the transformation to a set of input vectors, producing an associated set of output vectors.
(Inherited from TransformBaseTInput, TOutput.)
Public methodTransform(Double)
Applies the transformation to an input, producing an associated output.
(Overrides TransformBaseTInput, TOutputTransform(TInput).)
Public methodTransform(TInput, TOutput)
Applies the transformation to an input, producing an associated output.
(Inherited from TransformBaseTInput, TOutput.)
Top
Extension Methods
  NameDescription
Public Extension MethodHasMethod
Checks whether an object implements a method with the given name.
(Defined by ExtensionMethods.)
Public Extension MethodIsEqual
Compares two objects for equality, performing an elementwise comparison if the elements are vectors or matrices.
(Defined by Matrix.)
Public Extension MethodToT
Converts an object into another type, irrespective of whether the conversion can be done at compile time or not. This can be used to convert generic types to numeric types during runtime.
(Defined by ExtensionMethods.)
Top
Remarks

Linear regression is an approach to model the relationship between a single scalar dependent variable y and one or more explanatory variables x. This class uses a MultipleLinearRegression to extract information about a given problem, such as confidence intervals, hypothesis tests and performance measures.

This class can also be bound to standard controls such as the DataGridView by setting their DataSource property to the analysis' Coefficients property.

References:

  • Wikipedia contributors. "Linear regression." Wikipedia, The Free Encyclopedia, 4 Nov. 2012. Available at: http://en.wikipedia.org/wiki/Linear_regression

Examples
// And also extract other useful information, such
// as the linear coefficients' values and std errors:
double[] coef = mlra.CoefficientValues;
double[] stde = mlra.StandardErrors;

// Coefficients of performance, such as r²
double rsquared = mlra.RSquared; // 0.62879

// Hypothesis tests for the whole model
ZTest ztest = mlra.ZTest; // 0.99999
FTest ftest = mlra.FTest; // 0.01898

// and for individual coefficients
TTest ttest0 = mlra.Coefficients[0].TTest; // 0.00622
TTest ttest1 = mlra.Coefficients[1].TTest; // 0.53484

// and also extract confidence intervals
DoubleRange ci = mlra.Coefficients[0].Confidence; // [3.2616, 14.2193]

// We can use the analysis to predict an output for a sample
double y = mlra.Regression.Transform(new double[] { 10, 15 }); 

// We can also obtain confidence intervals for the prediction:
DoubleRange pci = mlra.GetConfidenceInterval(new double[] { 10, 15 });

// and also prediction intervals for the same prediction:
DoubleRange ppi = mlra.GetPredictionInterval(new double[] { 10, 15 });
// Now we can show a summary of analysis
// Accord.Controls.DataGridBox.Show(regression.Coefficients);
// We can also show a summary ANOVA
DataGridBox.Show(regression.Table);
// And also extract other useful information, such
// as the linear coefficients' values and std errors:
double[] coef = mlra.CoefficientValues;
double[] stde = mlra.StandardErrors;

// Coefficients of performance, such as r²
double rsquared = mlra.RSquared; // 0.62879

// Hypothesis tests for the whole model
ZTest ztest = mlra.ZTest; // 0.99999
FTest ftest = mlra.FTest; // 0.01898

// and for individual coefficients
TTest ttest0 = mlra.Coefficients[0].TTest; // 0.00622
TTest ttest1 = mlra.Coefficients[1].TTest; // 0.53484

// and also extract confidence intervals
DoubleRange ci = mlra.Coefficients[0].Confidence; // [3.2616, 14.2193]

// We can use the analysis to predict an output for a sample
double y = mlra.Regression.Transform(new double[] { 10, 15 }); 

// We can also obtain confidence intervals for the prediction:
DoubleRange pci = mlra.GetConfidenceInterval(new double[] { 10, 15 });

// and also prediction intervals for the same prediction:
DoubleRange ppi = mlra.GetPredictionInterval(new double[] { 10, 15 });
See Also