Learn R Programming

PDtoolkit (version 1.2.0)

hhi: Herfindahl-Hirschman Index (HHI)

Description

hhi performs calculation on Herfindahl-Hirschman Index.

Usage

hhi(x)

Value

The command hhinormal.test returns single element numeric vector of HHI value.

Arguments

x

Numeric vector of input values (e.g. number of observations or sum of exposure per rating grade).

Examples

Run this code
#simulate PD model and rating scale
suppressMessages(library(PDtoolkit))
data(loans)
res <- stepFWDr(start.model = Creditability ~ 1, 
   p.value = 0.05, 
   db = loans)
mod.predictions <- unname(predict(res$model, type = "response"))
rating.scale <- sts.bin(y = loans$Creditability, x = mod.predictions)[[1]]
#calculate HHI 
hhi(x = rating.scale$no)

Run the code above in your browser using DataLab