Q1: Which Loan purpose is the most common

ggplot(loans_full_schema, aes(loan_purpose))+
  geom_bar()+
  coord_flip()+
  labs(title = "Distribution of Loan Purposes",
       x = "Loan Purpose",
       y = "Count") +
  theme(plot.title = element_text(hjust = 0.5, size = rel(1.5), margin = margin(15,15,15,15)), 
        axis.title = element_text(size = rel(1.2)), 
        axis.title.x = element_text(margin = margin(10,5,5,5)), 
        axis.title.y = element_text(margin = margin(5,10,5,5)))

The most common loan purpose is for debt consolidation

Q2: Do common loan purposes have higher or lower interest rates?

ggplot(data = loans_full_schema) + 
  stat_summary(mapping = aes(x = factor(term), y = interest_rate, fill = loan_purpose) , fun = "mean", geom = "bar", position = "dodge") + 
  labs(title = "Mean Interest Rate by Term and Loan Purpose", 
       x = "Term", 
       y = "Mean Interest Rate",
       fill = "Loan Purpose") + 
  theme(plot.title = element_text(hjust = 0.5, size = rel(1.5), margin = margin(15,15,15,15)), 
        axis.title = element_text(size = rel(1.2)), 
        axis.title.x = element_text(margin = margin(10,5,5,5)), 
        axis.title.y = element_text(margin = margin(5,10,5,5)), 
        axis.text = element_text(size = rel(1.2)))

The bar chart shows The average interenst rate by the Loan purposed. We can tell with longer term(60 months), the interest rate is higher than the shorter one (36 months). This might happen because for longer term, it increase the risk of longer repayment periods.

Q3: Are higher interest loans associated with lower credit grades?

ggplot(data = loans_full_schema) + 
  stat_summary(mapping = aes(x = grade , y = interest_rate) , fun = "mean", geom = "bar", position = "dodge") + 
  labs(title = "Mean Interest Rate by Credit Grade", 
       x = "Grade", 
       y = " Mean Interest Rate") + 
  theme(plot.title = element_text(hjust = 0.5, size = rel(1.5), margin = margin(15,15,15,15)), 
        axis.title = element_text(size = rel(1.2)), 
        axis.title.x = element_text(margin = margin(10,5,5,5)), 
        axis.title.y = element_text(margin = margin(5,10,5,5)), 
        axis.text = element_text(size = rel(1.2)))

Based on the visualization, the lower grade would have higher interest rate. This reflects risk-based pricing, where borrowers with lower creditworthiness are charged higher interest rates.

Q4: Does income differ by loan purpose?

ggplot(data = loans_full_schema) + 
  stat_summary(mapping = aes(x = loan_purpose , y = annual_income) , fun = "mean", geom = "bar", position = "dodge") + 
  coord_flip()+
  labs(title = "Mean Anual Income by Loan Purpose", 
       x = "Loan Purpose", 
       y = " Mean Anual Income") + 
  theme(plot.title = element_text(hjust = 0.5, size = rel(1.5), margin = margin(15,15,15,15)), 
        axis.title = element_text(size = rel(1.2)), 
        axis.title.x = element_text(margin = margin(10,5,5,5)), 
        axis.title.y = element_text(margin = margin(5,10,5,5)))

Borrowers with higher annual income tend to take loans for large purchases, renewable energy investments, or major financial commitments, suggesting that higher-income individuals may use loans strategically rather than for debt consolidation