Click or drag to resize

LogisticRegressionParameterCalc Class

Class for performing a binomial logistic regression.
Inheritance Hierarchy
SystemObject
  CenterSpace.NMath.CoreRegressionBase
    CenterSpace.NMath.CoreLogisticRegressionParameterCalc

Namespace: CenterSpace.NMath.Core
Assembly: NMath (in NMath.dll) Version: 7.4
Syntax
[SerializableAttribute]
public class LogisticRegression<ParameterCalc> : RegressionBase, 
	ICloneable
where ParameterCalc : new(), ILogisticRegressionCalc

Type Parameters

ParameterCalc
Class for model parameter calculation.

The LogisticRegressionParameterCalc type exposes the following members.

Constructors
 NameDescription
Public methodLogisticRegressionParameterCalc Default constructor. Constructs a LogisticRegression instance with all sizes equal to zero.
Public methodLogisticRegressionParameterCalc(DoubleMatrix, IListBoolean, Boolean) Constructs a LogisticRegression instance with the specifed regresssion matrix and observation vector, optionally adding an intercept parameter. The model parameter values are computed using the specified regression calculator.
Public methodLogisticRegressionParameterCalc(DoubleMatrix, DoubleVector, PredicateDouble, Boolean) Constructs a LogisticRegression instance with the specifed regresssion matrix and observation vector, optionally adding an intercept parameter. The vector of floating point observations is converted to a vector of booleans by applying the give predicate function.
Public methodLogisticRegressionParameterCalc(DoubleMatrix, IListBoolean, Boolean, ParameterCalc) Constructs a LogisticRegression instance with the specifed regresssion matrix and observation vector, optionally adding an intercept parameter. The model parameter values are computed using the specified regression calculator.
Public methodLogisticRegressionParameterCalc(DoubleMatrix, Int32, PredicateDouble, Boolean) Constructs a LogisticRegression instance optionally adding an intercept parameter. The provided matrix of values contains the observation values as one of its columns. The rest of the columns of the matrix forms the regression matrix. The floating point observation value in the matrix are converted to a vector of dichotomous values by applying the give predicate function.
Public methodLogisticRegressionParameterCalc(DoubleMatrix, DoubleVector, PredicateDouble, Boolean, ParameterCalc) Constructs a LogisticRegression instance with the specifed regresssion matrix and observation vector, optionally adding an intercept parameter. The vector of floating point observations is converted to a vector of booleans by applying the give predicate function.
Public methodLogisticRegressionParameterCalc(DoubleMatrix, Int32, PredicateDouble, Boolean, ParameterCalc) Constructs a LogisticRegression instance optionally adding an intercept parameter. The provided matrix of values contains the observation values as one of its columns. The rest of the columns of the matrix forms the regression matrix. The floating point observation value in the matrix are converted to a vector of dichotomous values by applying the give predicate function.
Top
Properties
 NameDescription
Public propertyColumnResizeIncrement Gets and sets the amount by which the regression matrix is resized if columns are added.
(Inherited from RegressionBase)
Public propertyHasInterceptParameter Returns true if the model has an intercept parameter; otherwise, false.
(Inherited from RegressionBase)
Public propertyIntercept Gets the intercept.
(Inherited from RegressionBase)
Public propertyIsGood Returns true if the model parameters were successfuly computed; otherwise, false.
(Inherited from RegressionBase)
Public propertyNumberOfObservations Gets the number of observations.
(Inherited from RegressionBase)
Public propertyNumberOfParameters Gets the number of parameters in the model.
(Inherited from RegressionBase)
Public propertyNumberOfPredictors Gets the number of predictors.
(Inherited from RegressionBase)
Public propertyObservations Gets the vector of observations.
(Inherited from RegressionBase)
Public propertyParameterCalculationErrorMessage Gets the error message associated with a failed parameter calculation.
(Inherited from RegressionBase)
Public propertyParameterCalculator Gets the parameter calculation object.
Public propertyParameterCovarianceMatrix Gets the covariance matrix for the parameters. The entry at column i, row j is the covariance between the ith and jth parameters.
Public propertyParameterEstimates Gets the array of parameter estimate objects.
Public propertyParameters Gets the computed model parameters.
(Inherited from RegressionBase)
Public propertyPredictorMatrix Gets the predictor matrix.
(Inherited from RegressionBase)
Public propertyRegressionMatrix Gets the regression matrix.
(Inherited from RegressionBase)
Public propertyRowResizeIncrement Gets and sets the amount by which the regression matrix is resized if rows are added.
(Inherited from RegressionBase)
Top
Methods
 NameDescription
Public methodAddInterceptParameter Adds an intercept parameter to the model and recalculates the model parameters.
(Inherited from RegressionBase)
Public methodAddObservation Adds the given observation to the model, and recalculates the model parameters.
(Inherited from RegressionBase)
Public methodAddObservations Adds the given observations to the model, and recalculates the model parameters.
(Inherited from RegressionBase)
Public methodAddPredictor Adds a predictor to the model, and recalculates the model parameters.
(Inherited from RegressionBase)
Public methodAddPredictors Adds predictors to the model, and recalculates the model parameters.
(Inherited from RegressionBase)
Public methodClone Creates a deep copy of this LogisticRegression.
Public methodStatic memberDesignVariables(IDFColumn) Convenience method for generating design, or dummy, variables which replace independent variables in a logistic model that take on discrete, nominal scaled values. The encoding method used is "reference cell coding". where the group with the SMALLEST code serves as the reference group. The method is described in the remark below.
Public methodStatic memberDesignVariables(IDFColumn, IComparable) Convenience method for generating design, or dummy, variables which replace independent variables in a logistic model that take on discrete, nominal scaled values. The encoding method used is "reference cell coding" with the group with the speficied code serves as the reference group. The method is described in the remark below.
Public methodStatic memberLogLikelihood Computes the value of the log likelihood function for a binomial logistic regression model with the given predictor variable values, probabilities and observed dichotomous outcomes.
Public methodObservationVarianceEstimates Computes the variance estimate for each observation. if pi is the probability of success predicted by the model for the ith observation, then the estimated variance for the ith observation is pi*(1.0 - pi).
Public methodPredictedProbabilities(DoubleMatrix) Returns a vector of predicted probabilities of a positive outcome for the predictor variable values contained in the rows of the input matrix A.
Public methodStatic memberPredictedProbabilities(DoubleMatrix, DoubleVector, Boolean) Returns a vector of predicted probabilities of a positive outcome for the predictor variable values contained in the rows of the input matrix A.
Public methodPredictedProbability(DoubleVector) Returns the probability of a positive outcome predicted by the model for the given set of predictor values.
Public methodStatic memberPredictedProbability(DoubleVector, DoubleVector, Boolean) Returns the probability of a positve outcome predicted by the model for the given set of predictor values.
Public methodRecalculateParameters Recalculates the model parameters.
(Overrides RegressionBaseRecalculateParameters)
Public methodRemoveInterceptParameter Removes the intercept parameter from the model, and recalculates the model parameters.
(Inherited from RegressionBase)
Public methodRemoveObservation Removes the row at the indicated index from the predictor matrix and the corresponding element from the observation vector, and recalculates the model parameters.
(Inherited from RegressionBase)
Public methodRemoveObservations Removes the specified rows from the predictor matrix, and recalculates the model parameters.
(Inherited from RegressionBase)
Public methodRemovePredictor Removes the specified predictor from the model, and recalculates the model parameters.
(Inherited from RegressionBase)
Public methodCode exampleRemovePredictors Removes the specified predictors from the model, and recalculates the model parameters.
(Inherited from RegressionBase)
Public methodSetRegressionData Sets the regression matrix, observation vector, and intercept option to the specified values, and recalculates the model parameters.
Top
Fields
 NameDescription
Protected fieldcolResizeIncrement_ Number of columns to add when adding variables (if needed).
(Inherited from RegressionBase)
Protected fielderrorMessage_ Explains errors, if any.
(Inherited from RegressionBase)
Protected fieldhasIntercept_ Does the model have an intercept parameter?
(Inherited from RegressionBase)
Protected fieldisGood_ Is the regression good?
(Inherited from RegressionBase)
Protected fieldobservationData_ Full set of observations.
(Inherited from RegressionBase)
Protected fieldobservations_ Subvector of the observation data used in the current regression model. observations_ = observationData_[regMatRowSlice_].
(Inherited from RegressionBase)
Protected fieldparameters_ Model parameters.
(Inherited from RegressionBase)
Protected fieldregMatColSlice_ regressionMatrx_ = regressionData_[regMatRowSlice_, regMatColSlice_]
(Inherited from RegressionBase)
Protected fieldregMatRowSlice_ regressionMatrx_ = regressionData_[regMatRowSlice_, regMatColSlice_]
(Inherited from RegressionBase)
Protected fieldregressionData_ The full set of regression data.
(Inherited from RegressionBase)
Protected fieldregressionMatrix_ A submatrix of the regression used in this regression model. regressionMatrx_ = regressionData_[regMatRowSlice_, regMatColSlice_]
(Inherited from RegressionBase)
Protected fieldrowResizeIncrement_ Number of rows to add when adding observations (if needed).
(Inherited from RegressionBase)
Top
Remarks
Logistic regression is used to model the relationship between a binary response variable and one or more predictor variables, which may be either discrete or continuous. Binary outcome data is common in medical applications. For example, the binary response variable might be whether or not a patient is alive five years after treatment for cancer or whether the patient has an adverse reaction to a new drug. As in multiple regression, we are interested in finding an appropriate combination of predictor variables to help explain the binary outcome. Let Y be a dichotomous random variable denoting the outcome of some experiment, and let X = (x1, x2, ... , xp – 1) be a collection of predictor variables. Denote the conditional probability that the outcome is present by P(Y = 1|x) = π(x), where π(x) has the form: exp(B0 + B1*x1 + B2*x2 + ... + Bp-1*xp-1) / (1 + exp(B0 + B1*x1 + B2*x2 + ... + Bp-1*xp-1)) If the xj are varied and the n values Y1,Y2, ... , Yn of Y are observed, we write: πi = exp(B0 + B1*xi1 + B2*xi2 + ... + Bp-1*xip-1) / (1 + exp(B0 + B1*xi1 + B2*xi2 + ... + Bp-1*xip-1)) The logistic regression problem is then to obtain an estimate of the vector: B = (B0, B1,..., Bp-1)
See Also