| LogisticRegressionFitAnalysisParameterCalcHLStatistic(Int32, IEqualityComparerDoubleVector) Method |
Calculates the Hosmer Lemeshow statistic for the model using the specified number
of groups and the given comparer to determine equality of covariate patterns.
Namespace: CenterSpace.NMath.CoreAssembly: NMath (in NMath.dll) Version: 7.4
Syntax public LogisticRegressionFitAnalysisParameterCalcHosmerLemeshowStatistic HLStatistic(
int g,
IEqualityComparer<DoubleVector> covariatesEqualityComparer
)
Public Function HLStatistic (
g As Integer,
covariatesEqualityComparer As IEqualityComparer(Of DoubleVector)
) As LogisticRegressionFitAnalysisParameterCalcHosmerLemeshowStatistic
public:
LogisticRegressionFitAnalysisParameterCalcHosmerLemeshowStatistic^ HLStatistic(
int g,
IEqualityComparer<DoubleVector^>^ covariatesEqualityComparer
)
member HLStatistic :
g : int *
covariatesEqualityComparer : IEqualityComparer<DoubleVector> -> LogisticRegressionFitAnalysisParameterCalcHosmerLemeshowStatistic
Parameters
- g Int32
- The number of groups.
- covariatesEqualityComparer IEqualityComparerDoubleVector
- Comparer to use for determining when
two covariate patterns are equal.
Return Value
LogisticRegressionFitAnalysisParameterCalcHosmerLemeshowStatisticThe Hosmer Lemeshow statistic for the model.
Remarks
The HL statistic is computed by first grouping the observations as follows:
First, the observations are sorted in increasing order of their estimated probability.
The observations are then organized into blocks, where each block constists of
observations with the same covariate pattern.
The observations are then divided into approximately g groups according to
the following scheme. Let N be the total number of subjects. Let M be the target
number of subjects for each group given by
M = [(1/g) * N + 0.5],
where [x] represents the integral value of x.
Denote by nj the number of
observations in the jth block and suppose that observations of the (j - 1)th
block have been placed in the kth group. Let c be the total number of subjects
currently in the kth group. Subjects for the jth block (containing nj subjects)
are also placed in the kth group if
c is less than M and c + [0.5 * nj] is less than or equal to M
Otherwise, the nj subjects are put into the next group. In addition, if the number
of subjects in the last group does not exceed [0.5 * N] (half the target group size),
the last two groups are collapsed to form only one group.
See Also