LogisticRegressionModel Constructor

Definition

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

Overload List

LogisticRegressionModel(ICategoricalVector, Vector<Double>[])

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

Parameters

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

Exceptions

ArgumentNullException

dependentVariable is null.

-or-

independentVariables is null.

LogisticRegressionModel(IDataFrame, String)

Constructs a new LogisticRegressionModel.
C#
public LogisticRegressionModel(
	IDataFrame dataFrame,
	string formula
)

Parameters

dataFrame  IDataFrame
A data frame containing the data for the regression.
formula  String
A formula that specifies the variables in the model.

Exceptions

FormatException

The formula is not in the correct format.

LogisticRegressionModel(IDataFrame, String, String[])

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

Parameters

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

LogisticRegressionModel(Vector<Double>, Matrix<Double>, Vector<Double>)

Constructs a new SimpleRegressionModel.
C#
public LogisticRegressionModel(
	Vector<double> dependentData,
	Matrix<double> independentData,
	Vector<double>? weights = 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 variable.
weights  Vector<Double>  (Optional)
Optional case weights, validated when fitting. Weights must be finite and nonnegative, match the observation count, and contain at least one positive value.

Remarks

Columns of the matrix specify independent variables. An intercept is included in the model.

Exceptions

ArgumentNullException

dependentData is null.

-or-

independentData is null.

LogisticRegressionModel(ICategoricalVector, Vector<Double>[], Vector<Double>, LogisticRegressionMethod)

Constructs a new LogisticRegressionModel.
C#
public LogisticRegressionModel(
	ICategoricalVector dependentVariable,
	Vector<double>[] independentVariables,
	Vector<double>? weights = null,
	LogisticRegressionMethod method = LogisticRegressionMethod.Automatic
)

Parameters

dependentVariable  ICategoricalVector
A vector that specifies the dependent variable.
independentVariables  Vector<Double>[]
An array of vectors that contain the independent variables.
weights  Vector<Double>  (Optional)
Optional case weights, validated when fitting. Weights must be finite and nonnegative, match the observation count, and contain at least one positive value.
method  LogisticRegressionMethod  (Optional)
Optional. A LogisticRegressionMethod value that specifies the kind of logistic regression to perform. The default infers binary or nominal regression from the outcome categories.

Exceptions

ArgumentNullException

dependentVariable is null.

-or-

independentVariables is null.

LogisticRegressionModel(ModelInput, IIndex, Vector<Double>, SymmetricMatrix<Double>, Int32)

Constructs a fitted logistic regression model.
C#
public LogisticRegressionModel(
	ModelInput specification,
	IIndex categoryIndex,
	Vector<double> parameters,
	SymmetricMatrix<double> covarianceMatrix,
	int degreesOfFreedom
)

Parameters

specification  ModelInput
The input to the model.
categoryIndex  IIndex
The index that specifies the categories or classes of the model.
parameters  Vector<Double>
The values of the model parameters.
covarianceMatrix  SymmetricMatrix<Double>
The covariance matrix of the model parameters.
degreesOfFreedom  Int32
The degrees of freedom of the model.

Remarks

Models created with this constructor do not carry fit diagnostics. Coefficients and covariance are copied. Parameter names are preserved when supplied, otherwise derived from the expanded feature schema and outcome categories. The category count selects binary or nominal prediction.

Exceptions

ArgumentNullExceptionOne of the reference arguments is null.
ArgumentExceptionThere are fewer than two categories or the specification has no feature schema.
DimensionMismatchExceptionThe coefficient count or covariance order does not match the feature schema and nonreference categories.
ArgumentOutOfRangeExceptionDegrees of freedom is not positive.

See Also