LinearRegressionModel Constructor

Definition

Namespace: Numerics.NET.Statistics
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 9.0.4

Overload List

LinearRegressionModel(Vector<Double>, Vector<Double>[])

Constructs a new LinearRegressionModel.
C#
public LinearRegressionModel(
	Vector<double> dependentVariable,
	params Vector<double>[] independentVariables
)

Parameters

dependentVariable  Vector<Double>
A vector that specifies the dependent variable.
independentVariables  Vector<Double>[]
An array of vectors that contain the independent variables.

Exceptions

ArgumentNullException

dependentVariable is null.

LinearRegressionModel(IDataFrame, String, String)

Constructs a new LinearRegressionModel.
C#
public LinearRegressionModel(
	IDataFrame dataFrame,
	string formula,
	string? weightVariable = null
)

Parameters

dataFrame  IDataFrame
A IDataFrame containing the data for the regression.
formula  String
A formula that specifies the variables in the model.
weightVariable  String  (Optional)
(Optional.) The name of the variable that contains the case weights. May be null.

Exceptions

ArgumentNullException

dataFrame is null.

-or-

formula is null.

FormatException

The formula is not in the correct format.

LinearRegressionModel(IDataFrame, String, String[])

Constructs a new LinearRegressionModel.
C#
public LinearRegressionModel(
	IDataFrame dataFrame,
	string dependentVariable,
	params string[] independentVariables
)

Parameters

dataFrame  IDataFrame
A IDataFrame containing the data for the regression.
dependentVariable  String
The name of the dependent variable.
independentVariables  String[]
An array containing the names of the independent variables.

LinearRegressionModel(Vector<Double>, Matrix<Double>, Boolean, Vector<Double>)

Constructs a new LinearRegressionModel.
C#
public LinearRegressionModel(
	Vector<double> dependentData,
	Matrix<double> independentData,
	bool noIntercept = false,
	Vector<double>? weightData = null
)

Parameters

dependentData  Vector<Double>
A vector that contains the data for the dependent variable.
independentData  Matrix<Double>
A matrix that contains the data for the independent variables.
noIntercept  Boolean  (Optional)
Specifies whether the intercept (constant) term should be omitted from the model.
weightData  Vector<Double>  (Optional)
(Optional.) A vector that contains the weight for each observation.

Remarks

Each column of independentData corresponds to an independent variable.

Exceptions

ArgumentNullException

dependentData is null.

-or-

independentData is null.

LinearRegressionModel(IDataFrame, String, String[], Boolean, String)

Constructs a new LinearRegressionModel.
C#
public LinearRegressionModel(
	IDataFrame dataFrame,
	string dependentVariable,
	string[] independentVariables,
	bool noIntercept = false,
	string? weightVariable = null
)

Parameters

dataFrame  IDataFrame
A IDataFrame containing the data for the regression.
dependentVariable  String
The name of the dependent variable.
independentVariables  String[]
An array containing the names of the independent variables.
noIntercept  Boolean  (Optional)
Indicates whether a constant term should be excluded from the model. The default is false.
weightVariable  String  (Optional)
The name of the variable that contains the case weights. May be null.

Exceptions

ArgumentNullException

dataFrame is null.

-or-

dependentVariable is null.

-or-

independentVariables is null.

LinearRegressionModel(ModelInput, Vector<Double>, SymmetricMatrix<Double>, Int32, Double)

Constructs a fitted linear regression model.
C#
public LinearRegressionModel(
	ModelInput specification,
	Vector<double> parameters,
	SymmetricMatrix<double> covarianceMatrix,
	int degreesOfFreedom,
	double standardError
)

Parameters

specification  ModelInput
parameters  Vector<Double>
covarianceMatrix  SymmetricMatrix<Double>
degreesOfFreedom  Int32
standardError  Double

Remarks

Models created with this constructor do not carry any information about the source data or the fit results.

See Also