# Evaluating if metric of one group is higher than the metric of another group when group sizes differ significantly

I am working with a dataset that contains data of applicant income, gender, and loan status (whether or not the person was approved for a loan). I've created the following plots from the data. The histogram plot is: The kernel density estimate (KDE) plot is: The KDE plots seem to indicate that the accepted to rejected ratio among men is higher for a given income than compared to women. I want to investigate this further. Note (!) there are more men in the dataset than women, so any conclusions will need to take the variance into account.

An idea: My initial idea was to bin the incomes and compute the ratio of accepted/rejected in each bin for each gender. We can then plot the ratio and the variance (using the counts of men/women in each bin) to see if there is a statistical significance in the dependence of accepted/rejected on gender.

Question: Is the above idea sound? Should I formulate this a hypothesis testing problem? If so, how would I go about doing this?

• Interesting dataset. Do you perhaps have available the sum of the loan? So as to be able to compare the acceptance rate in relation to the relative size of the loan toward the applicants income Jan 26, 2022 at 20:42
• Hi @Kosmos, yes loan amount for each person is also available. The data is not very descriptive and I am not sure the units that were used, but I am using it more for the data science experience rather than hard insights. At any rate, here is the link: kaggle.com/vikasukani/… Jan 26, 2022 at 20:46
• I see. Also, are you using the only the applicant income or sum of the applicant and co-applicant? It may shed light on the potential gender disparity. Jan 26, 2022 at 21:01
• Fair point, I am using only the applicant income. I can add the coapplicant income as well. I suppose generally I am confused as to how to measure statistical significance of the statement that men are accepted at a higher rate than women for the same (combined) income. Is hypothesis testing relevant? Jan 26, 2022 at 21:04

This can be framed as hypothesis testing problem and can be approached as follows using CHI SQUARE test.

Null Hypothesis : H0: The distribution of the outcome is independent of the groups. Loan Rejection/ approval is indepndent of age/income Bins

Test Statistic for Testing H0: Distribution of outcome is independent of groups

Chi sqaure = (O-E)**2/E


and we find the critical value in a table of probabilities for the chi-square distribution with df=(r-1)*(c-1).

Here O = observed frequency, E=expected frequency in each of the response categories in each group, r = the number of rows in the two-way table and c = the number of columns in the two-way table. r and c correspond to the number of comparison groups and the number of response options in the outcome.

You can create a table like this below and perform chi square test: • OP asks three questions: "Is the above idea sound? Should I formulate this a hypothesis testing problem? If so, how would I go about doing this?" This response answers the last question, implies (but doesn't state) an affirmative answer to the second question, and does not address the first question.
– Ceph
Jan 27, 2022 at 20:09
• Thanks for the answer. What is the difference between the bin 1 and bin 2 variables? Jan 28, 2022 at 1:56
• Bins is something which you can do on your income for meaningful categories.. for example Bin1 can be from 0-1000\$ and so on.. THis will help to convert continuous variable to categorical variable. Jan 28, 2022 at 4:44

What you are describing is a contingency table, the Cartesian product of categorical variables with count values in the cells. The categorical variables are: gender, income bin, and loan status. Your contingency table will be a data cube.

One option for a statistical test on a contingency table is chi-squared test which compares expected vs. compared counts for categorical variables.