risk.validation.kolmogorovSmirnov
Syntax
Description
returns the two-sample Kolmogorov-Smirnov (KS) statistic, where ksValue = risk.validation.kolmogorovSmirnov(Score,BinaryResponse)Score
contains numeric values that represent rankings or predictions from a binary classification
model, such as probability of default (PD) estimates. BinaryResponse
specifies the target state of each value in Score. This syntax is
well-suited for binary classification models.
calculates the two-sample KS statistic for the data in ksValue = risk.validation.kolmogorovSmirnov(Sample1,Sample2)Sample1 and
Sample2.
Examples
Input Arguments
Output Arguments
Algorithms
The risk.validation.kolmogorovSmirnov function calculates the KS statistic by taking the
largest absolute difference between the empirical cumulative distribution functions (CDFs) for
two samples.
When you specify
Sample1,Sample2, the function calculates the empirical CDFs using the data in the samples.When you specify
ScoreandBinaryResponse,risk.validation.kolmogorovSmirnovusesBinaryResponseto create two samples from the data inScoreand then calculates the empirical CDF using the data in the samples. The sample given by the0values inBinaryResponsecorresponds to theOutputargument'sFalsePositiveRatefield, and the sample given by the1values corresponds to theTruePositiveRatefield.
Alternative Functionality
You can calculate the and visualize the KS statistic by using the risk.validation.kolmogorovSmirnovPlot plot.
risk.validation.kolmogorovSmirnovPlot displays the KS statistic and
empirical cumulative distribution function (CDFs) for the samples, and allows you to plot a
difference profile for the empirical CDFs. You can also perform a two-sample KS test using
kstest2.
Version History
Introduced in R2025a