Binary Classification of Household Income in the Philippines
By: Kyle Aguilar
Tags: Machine Learning, Philippines, Xgboost, Data, Data Science

Introduction

Hopefully, most of you out there in the United States have filled out the 2020 Census. I did, and it was a timely exercise while concurrently working with a set of household data sampling a nation’s population. The Philippine Statistics Authority runs a survey called the Family Income and Expenditure Survey (FIES) every three years to gather information on income, standards of living and expenditures of homes in all seventeen regions.

The Philippines is the twelfth most populous country in the world and is one of Asia’s fastest-growing economies. There is a heavy reliance on agriculture, so populations are concentrated where there is good farmland; additionally, one-eighth of the national population lives in Manila, the capital. As I was looking to flex my modeling muscles by exploring a classification task, this was a great dataset with which to explore data and feature importance, due to the breadth and level of detail documented in the survey.

The Dataset

The dataset, composed of 41,544 rows, originally available from the Philippine Statistics Authority is available on Kaggle here, and I changed the target column (‘Total Household Income’) from a continuous variable to a binary variable, with 1 indicating that a family makes above the median. The median household income in this dataset is 164,079 PHP, with a mean of 247,555 PHP.

The 59 feature columns in the form of object and integer datatypes are wide-ranging in their description of a typical Filipino household. The full set of survey questions within each category are even more granular and total 81 pages, documenting consumption and agricultural activity down to the number of eggs gathered and amount spent on jeepney fare. I have loosely grouped the 59 columns into four different types as below.

Expenditures : e.g. rice, meat, alcohol, tobacco, transportation, communication and education (unit of time for food expenditure is a week, and a month for all others, to reduce memory bias)

: e.g. rice, meat, alcohol, tobacco, transportation, communication and education (unit of time for food expenditure is a week, and a month for all others, to reduce memory bias) Household Descriptions : e.g. region, source of income, household head marital status, number of children, number of employed family members

: e.g. region, source of income, household head marital status, number of children, number of employed family members Possessions : e.g. number of televisions, air-conditioners, vehicles, cell phones, and computers

: e.g. number of televisions, air-conditioners, vehicles, cell phones, and computers Living Conditions: e.g. type of building/house, type of roof, toilet facilities, electricity, water supply source

Libraries

For data cleaning/exploration: pandas, NumPy

For plotting: Matplotlib, seaborn, Scikit-plot, pydotplus, IPython

For modeling: scikit-learn, XGBoost

Exploratory Data Analysis

During my exploration stage, my main goal was to ensure that I had a complete data-set of usable features, and to retain/transform object columns that have a visible relationship on the household income. As the dataset only has ~41K rows, I wanted to retain its length, and removed two object columns with missing data (Household Head Occupation and

Household Head Class of Worker), which were each missing 7,536 values.

To understand my approach with the remaining object columns, compare the countplots on the left. I dropped Household Head Sex as it did not seem to have a significant impact on Household Income, but took a different approach to Type of Walls, where there seemed to be a stronger correlation of Household Income and Type of Walls. Rather than create dummy variables for every unique value within Type of Walls, I created one binary column of Strong Walls, and one-hot encoded all values not Strong to 0.

This process left me with 49 features of the initial dataset to start the modeling process.

Modeling

Of the methods that we have reviewed, I used the below models for a total of 8. I split my data into a 70/30 Train-Test Set to validate each model and added scores to a summary dataframe for each model based on the performance with the test data. The Logistic Regression model with Recursive Feature Elimination reduced my feature set from 49 to 40, the number of features that achieved the best F1 Score, and each successive model uses those 40 features.

Logistic Regression (one vanilla, one with RFE)

Decision Trees

Random Forest (one vanilla, one with GridSearch)

K-Nearest Neighbors

XGBoost (one vanilla, one with GridSearch)

The below summary illustrates the Recall, Precision, Accuracy and F1 Scores. I am not dealing with any class imbalance, and not looking to tune towards precision or recall specifically, but XGBoost with GridSearch just edged out my baseline XGBoost and Random Forest with GridSearch.

Summary Table of Model Performance

Interpreting Feature Selection

One of the most satisfying parts of conducting a modeling exercise is being able to visualize feature importance. As XGBoost is an ensemble algorithm composed of weak learners(decision trees with limited depth), importance is given to the variables that enhance the performance of each iterative learner, and is returned as an average of importances of all decision trees within the model.

We can see that within the top ten features below that expenditures significantly contribute to our target, although I was surprised to see Communication and Miscellaneous Goods and Services at the top of the list. I delved into the FIES summary documents to better understand what was asked in this survey question.

Communication encompasses spend on internet including such methods as prepaid internet cards, personal telephones (both monthly service charges and the cost of a new cell phone or landline installation), and postal services. As the country continues to develop and modernize, it is worth continuing to explore how this spend category is a defining factor in a family’s ability to spend or earn income.

Miscellaneous Goods and Services encompasses spend on personal care such as beauty products and services (including toiletries), personal effects not included in Clothing, Footwear and Other Wear (e.g. bags and jewelry), all types of insurance, retirement home spend, and any other services not mentioned in other categories. Most interestingly to me, financial services is also part of this category. As Filipinos overseas are one of the largest diasporas (around 12% of the population works abroad as of 2019), the scale of remittances sent to the Philippines is enormous. If any associated fees are included in this category, it would make sense that the impact of such a broad category that can encompass both luxury goods and financial services is correlated with a household’s income.

Future Work

There are many directions that can be taken with a dataset of this nature to further improve our model and our ability to interpret the results and features, and how they reflect on a modernizing, diverse Filipino society. For example, I could use this data and compare it with prior and later surveys to see how feature importances may have changed over time. Alternatively, a comparison between agricultural, tourist-heavy, or urban regions would also shed light on income disparity. As a number of continuous columns are similar in nature (such as the food expenditures and housing traits) there is also a potential for feature engineering to see whether simplifying in this way results in any changes to the model and feature importance ranking. An alternative way to create features might be to create a grade for living conditions that encompasses all related columns such as type of roof, walls, toilet facilities and water supply.

Conclusion

This data and the accompanying summary provide a wealth of areas for exploring methods of classification or linear regression, and deep insights can be gained on how Filipino families are spending and earning their income. I look forward to using this dataset for ongoing learning opportunities, and hope to share more about how the evolving economy in the Philippines can be visualized, expressed, and predicted. If you have any feedback on this post or would like to review my repo, please comment below.

Sources

“Family Income and Expenditure Survey 2015.” Philippine Statistics Authority, Jan. 2017, psa.gov.ph/sites/default/files/FIES 2015 Final Report.pdf. Web. 21 Apr. 2020.

“Remittances from Filipinos Abroad Reach 2.9 Bln USD in August 2019.” Xinhua News Agency, 15 Oct. 2019, www.xinhuanet.com/english/2019-10/15/c_138473763.htm. Web. 21 Apr. 2020.

“The World Factbook: Philippines.” Central Intelligence Agency, Central Intelligence Agency, 1 Feb. 2018 (updated 21 Apr. 2020), www.cia.gov/library/publications/the-world-factbook/geos/rp.html. Web. 21 Apr. 2020.

“Asian Development Bank Member Fact Sheet: Philippines.” Asian Development Bank, July 2019, https://www.adb.org/sites/default/files/publication/27790/phi-2018.pdf. Web. 21 Apr. 2020.

“Feature Importance and Feature Selection With XGBoost in Python”. Jason Brownlee. Machine Learning Mastery, 31 Aug. 2016, https://machinelearningmastery.com/feature-importance-and-feature-selection-with-xgboost-in-python/. Web. 21 Apr 2020.