This research work was for my undergraduate thesis at Joseph Ayo Babalola University. It was based on selected Less Developed countries in Africa, Asia, and South America.
This repository contains the Jupyter notebook files, python files, and datasets used for this research work.
This paper focuses on predicting life expectancy in selected less-developed countries. It also investigates the ways through which various factors affect life expectancy and the prediction strength of the same.
- Correlation Analysis
- Linear Regression machine learning model (for prediction). The model was trained and tested with the World Development Indicators dataset.
- 62 less developed countries were considered in all (selected based on their Human Development Index), and 12 features were used.
- Evaluation metrics and tests used include R-squared, Mean Absolute Error (MAE), Mean Squared Error (MSE), and Root Mean Squared Error (RMSE).
✅ We found that Indicators thought to be great predictors of life expectancy were not. Strong predictors of life expectancy that were observed include literacy rate, infant mortality, sanitation, government expenditure on education, adolescent fertility rate, and percentage of urban population living in slums.
✅ The model had an accuracy of 79.55%
✅ The R-squared value was 0.8930.
✅ The Mean Absolute Error was 1.9190
✅ Mean Squared Error was 5.7623
✅ The Root Mean Squared Error was 2.4005
- NumPy
- Pandas
- Scikit-learn
- pycountry_convert
- statsmodel.
The initial dataset, WDIEXCEL.xlxs is the WHO's World Development Indicators dataset.
- data_extracter.ipynb: This file contains code that work on the
WDIEXCELdataset and exports other Excel datasets based on it. These are the datasets that it produces, in order.WDI_EXCEL_TRIMMED.xlsx: This file trims theWDIEXCELdataset to the following columns: Country Name, Indicator Name, Indicator Code, 2017, 2018, 2019WDI_EXCEL_TRIMMED_WITH_CONTINENT.xlsx: This file has the same contents asWDI_EXCEL_TRIMMED.xlsx, but with a new column, Continent.AFRICA_ASIA_SOUTHAME_CONTRIES.xlsx: This lists all the countries in Africa, Asia, and South AmericaSELECTED_COUNTRIES_WITH_HDI: The code that produces this file appends to each country inAFRICA_ASIA_SOUTHAME_CONTRIES.xlsx, the corresponding Human Development Index (HDI) value.
- wdi_trim_to_selected_countries.ipynb: This notebook contains code that filters the
WDI_EXCEL_TRIMMED_WITH_CONTINENT.xlsxfile to only contain the countries in theSELECTED_COUNTRIES_WITH_HDI.xlsxfile. It exports this data intoWDI_EXCEL_TRIMMED_SELECTED_COUNTRIES.xlsx. - filter_wdi_dataset_selected_variables.ipynb: This notebook produces a new Excel file,
FINAL_FILTERED_WDI_DATASET.xlsx. This file contains the data inWDI_EXCEL_TRIMMED_SELECTED_COUNTRIES.xlsxfiltered based on the initially selected indicators in theMAIN DATASET.xlsx, the Variables List worksheet. - fill_dataset.ipynb: This notebook populates the
FINAL_MAIN_TEST.xlsx, although I already made changes to the file by adding some new worksheets. - linear_regression.ipynb: This notebook performs the Linear regression training and testing, and prints out the Model score, and evaluation metrics such as MAE, MSE, and R-squared. It uses the
FINAL_DATASEST_CORRELATION.xlsxfile which is a copy ofSheet 3of theFINAL_MAIN_TEST.xlsxfile. It uses theTrimmedIndicatorswork sheet. It also has other worksheets that shows the correlation analysis performed on the initially selected variables. - regression_script.ipynb: This file performs the trains the linear regression model and prints out metrics using the
statsmodellibrary.