# Algorithm to find the attributes that comprise the greatest concentration

I have a porfolio of mortgage loans where each loan has a number of attributes attr1, attr2, .., attrN.

I would like to analyze the portfolio credit risk concentration (see below) using these attributes, but instead of providing as input which attributes to use to calculate the percentages, I'm looking for an algorithm that will find these attributes for me.

So the input is the portfolio + a list of all the loan attributes, and the output is the list of attributes that comprise the largest concentration.

One way to achieve this is to calculate the concentration of all the attribute combinations, but that's overkilling. Is there a better way?

UPDATE

Portfolio credit risk concentration:

Let's say you have N loans. Each loan has three attributes related to the person that borrowed the money: (1) loan type, (2) Zip code, (3) Customer Segment.

Loan type values: Personal, Residential, Auto, etc. Customer segment values: Retail, Business, Corporate, etc.

Let's say that if you take Loan type = Personal and Customer segment = Retail, you get 80% of the loans. That's the concentration, and the number of attributes used was two.

What I'm looking for is an algorithm that will give me the largest concentration, without knowing beforehand which attributes and values to use. Note that in real scenarios you may have up to 100 attributes.

UPDATE 2 - Example

As mentioned above, there are loans with attributes. Each loan is a record in the data set, and each record has three attributes/fields: (1) loan type, (2) Zip code, (3) Customer Segment. Let us say that I have the following set of loans:

Loan #  Loan Type  Zip code  Customer Segment
1       Personal   12000     Retail
2       Personal   12000     Retail
3       Auto       13000     Retail
4       Auto       14000     Retail
6       Auto       13000     Retail
7       Direct     12000     Corporate
8       Material   14000     Corporate
9       Personal   13000     Retail


Now, to calculate a concentration, I need to find loans that have the same attributes. For example, loan 1 and 2 attributes are Personal/12000/Retail. Since there are 10 loans, the two loans that I selected comprise 20% of the loans. Therefore, I can say that Personal/12000/Retail has a concentration of 20% of the loan portfolio.

I don't need to use all the attributes. For example, loans 3, 4 & 6 are Auto/Retail (omitting the zip code). Therefore, I can say that Auto/Retail has a concentration of 3/10 or 33.33%.

What I'm looking for is an algorithm that will give me the highest concentration in a set of records (loans in the example) and also that will find out automatically the attributes used in the concentration.

• What is a "portfolio credit risk concentration"? Is it a number? – jbowman Oct 27 '18 at 17:30
• See added update – ps0604 Oct 28 '18 at 15:00
• "portfolio + a list of attributes?" So you have a dataset with something like "payed back loan/ did not pay back loan" and you want to find a good set of attributes that lets you predict this credit risk for future customers? – mlvalidated Nov 1 '18 at 11:45
• No, I don't want to predict anything. The dataset consists of an amount (the amount owed by the client) and other attributes such as client code, expiration date, etc. The amount shouldn't be used to calculate the concentration. The transactions (such as customer payed back installment) are not considered in this exercise. – ps0604 Nov 1 '18 at 13:11
• Why not use all attributes? – Jay Schyler Raadt Nov 1 '18 at 17:38

A structure coefficient is often used in canonical correlation analysis to describe relationships between synthetic variables and observed variables, but these structure coefficients can be used in multiple regression as well (Coureville & Thompson, 2001). The structure coefficient, $$r_s$$, is the ratio of the correlation coefficient, $$r$$, to the multiple correlation coefficient, $$R$$. Thus, squaring the numerator and denominator yields
$$\frac{r^2}{R^2}=r_s^2$$
This concept is similar to commonality, which is used in all possible subsets (APS) regression (Kraha et al, 2012). By reviewing the structure coefficients and the commonalities, you can find which variables explain the most variance. Thus, you will be able to "find the largest concentration" of variance explained. See Nimon's yhat for doing APS and getting structure coefficients in R.