Johnson’s Relative Weights analysis. Implementation with JavaScript

Stepan Kovalyshyn
Analytics Vidhya
Published in
5 min readMar 12, 2020

--

Here you are a manager at a banking institution who wants to understand what drives customer loyalty most of all. There are many different factors that impact customer loyalty and statistical methods for determining whats most relevant and important. A few years ago researchers relied on traditional statistics (e.g., correlations; standardized regression weights) which are known to yield faulty or misleading information concerning variable importance (especially when predictor variables are correlated with one another, which is often the case in organizational research). The Johnson’s Relative Weights analysis became a viable alternative to traditional statistics that overcomes this problem by linking the uncorrelated variables back to the original predictors. It consists of two general steps:

1. Transformation of predictor variables into a set of orthogonal (uncorrelated) variables that are maximally related to the original independent variables.

2. Regression of the dependent variables on the new set of transformed variables.

The Johnson’s Relative Weights (JRW) analysis is a useful technique that’s widely used in many scientific fields aiming to evaluate how the response (dependent) variable relates to a set of predictors (independent variables) when those are correlated to each other. The dependent variable is something that depends on other factors, while the independent variable is a variable that stands alone and isn’t changed by the other variables you are trying to measure.

So you hired an outsource company that made market research of individual banking preferences that affects customer loyalty. Researchers gathered information and outlined six individual banking preferences:

  • online banking features,
  • security of your funds,
  • branch availability,
  • ease of deposit,
  • interest of rates,
  • minimum balance requirements.

Taking into account information provided by analysts you defined the Johnson’s Relative Weights analysis as a statistical technique to calculate relevance importance.

Customer loyalty is a dependent variable in our case and banking preferences are independent variables that have an effect on it. After proceeding with the information supplied by analysts, you obtain a matrix of correlations between dependent and independent variables which looks as below.

Correlation matrix of individual banking preferences

A correlation matrix displayed as a table showing correlation coefficients between variables where each cell in the table shows the correlation between two variables. This information allows us to compute the importance rank with the JRW analysis.

The Johnson’s Relative Weights calculation consists of nine calculation steps:

1. In the first step, we retrieve the correlation between dependent and independent variables. As Customer loyalty is the dependent variable, the matrix will look like the first column excluding itself.

Correlation matrix of dependent individual banking preferences

2. The second part of the first step is retrieving a correlation matrix between independent and independent variables so that Customer loyalty is excluded from the initial correlation matrix.

Correlation matrix of independent individual banking preferences

3. In step #2, eigenvectors and eigenvalues on the above correlation matrix have to be calculated. When it’s done, then we have to create a diagonal matrix of eigenvalues and take square root of it. It was step #3.

4. In the next step, we multiplicate the matrix of eigenvectors, the matrix from the step #3, and the eigenvector matrix transposed. As a result of this computation, we get lambda calculated. I have spent some time getting expected results in this step, which is why I added intermediate results for your reference below.

Results calculated at step #4

5. In step #5, we square the above matrix.

6. To get partial effect of each independent variable on the dependent variable, we multiply the inverse matrix from the step #5 on the correlation matrix between dependent and independent variables from the step #1. The calculation of the partial effect is step #6.

Partial effect (step #6)

7. In step #7 , we compute the R² by calculating the sum of squared values from the step #6.

R-Squared (step #7)

8. Then in the next step, we calculate the raw relative weight as the multiplication of the matrix from the step #5 and square values of the step #6.

9. The final step is the calculation of row relative weights as a percentage of R². In order to do it, you have to divide the raw relative weights by R² and multiply it by 100.

Independent variables importance rank (step #8 and step #9)

As we know the JRW calculation steps, we can move to the programming part.

Johnson’s Relative Weights analysis implementation with JavaScript

The Johnson’s Relative Weights analysis consists of complex mathematical computations. To proceed with it, two npm packages here used: ml-matrix and mathjs. For more reference, please follow these links:

Johnson’s Relative Weights analysis with commented calculation steps for your reference:

For more details, you can follow GitHub repository:

You also can use the npm package:

To be sure of the results obtained, different datasets were processed with the SPSS and rwa package from the R programming language and compared with the johnsons-relative-weights package (JavaScript).

Summary

After processing the Johnson’s Relative Weights analysis, we may conclude that the most important rank between individual banking preferences is Minimum balance requirements with 25,84%. The second and third important preferences are Ease of deposit and Security of your funds with 18,30% and 17,59% respectively. Banking preferences of the least important are Online banking features -16,28%, Interest rates -12,09% and Branch availability - 9,90%.

The use of the Johnson’s Relative Weights analysis can help businesses better understand market behavior and become a mainstay in development of strategic marketing solutions.

--

--