Social Science Research/Rehabilitation of the Homeless

The study https://arxiv.org/abs/2302.04455 titled "Rehabilitating Homeless: Dataset and Key Insights," introduces a new and extensive dataset on homeless rehabilitation, collected over two decades by a Russian nonprofit organization. It is described as the first dataset to contain detailed information on thousands of homeless individuals seeking rehabilitation. The paper presents the results obtained from applying machine learning models to predict rehabilitation success, highlighting the importance of certain characteristics in predicting outcomes. The primary objective of the data analysis is to predict the value of the variable contract_success related to the completion of the "contract," which represents the agreement between the client and the organization on rehabilitation goals, using the other variables in the dataset. A successfully completed contract is defined as "fulfilled." The dataset also includes binary variables (0 or 1) for 43 contract types, representing the different specific goals the homeless person intended to achieve through the contract with the organization.

The data and the authors' Python analysis can be downloaded here: https://github.com/LEYADEV/homeless

Dataset Description

The dataset variables with their descriptions are as follows:

Variable Description
type id Contract type ID (43 types total)
gender client's gender
age client's age in years
is homeless the client is homeless
is married client's marital status
has dependants the client has dependents
has profession the client has a profession
has residence The client has residency (but may be unable to use it for any reason)
contacts relatives The client has recently contacted relatives
source perm job The client's primary source of income is a permanent job
source temp job The client's primary source of income is a temporary job
source pension The client's primary source of income is a pension
source alms The client's primary source of income is alms
source relatives The client's primary source of income is relatives
source other The client's primary source of income is not listed
source gathering The client's primary source of income is collection
source charity The client's primary source of income is charity
source rehabs The client's primary source of income is rehab centers
is citizen the client is a citizen of the country
is retired the client is retired
disability group the client has a disability in a certain group (1, 2, or 3)
is registered the client is registered
from orphanage the client lived in an orphanage
was confined the client was in isolation
chem confirmed the client confirms a chemical dependency
chem possible possible chemical dependency
chem no answer the client refused to answer about the chemical dependency
chem no the client denies chemical dependency
contract_success 0 - if the contract is "partially fulfilled due to the client's refusal" or "not fulfilled due to the client's refusal" or "partially fulfilled due to the client's absence" or "not fulfilled due to the client's absence"; 1 - if the contract is "fulfilled"
comments alcohol The client has a problem with alcohol
comments chem The client has problems with chemicals or medications
comments disability The client has a disability
comments absence The client does not see a social worker
comments orphange The client grew up in an orphanage
comments work The client is looking for work
comments confinement The client was in solitary confinement
comments noresidence The client has no place to live
comments aggression The client displays aggressive behavior
comments disturbance The client has a disturbance in a shelter
comments disease The client has a disease
comments death The client, or someone close to the client, has died
comments nursinghome The client needs to be admitted to a nursing home
comments relatives The client has relatives
comments illiteracy The client is illiterate
comments foreigner The client is a foreigner
comments ticket The client needs a ticket home
comments court The client is having trouble with a court
comments pregnancy The client is/was pregnant
comments mental The client has a mental problem
comments fire TheClient's residence has been burned down
comments social benefits Client needs a pension or other social benefits
comments divorce divorced client
type 1 Restore/obtain passport
type 2 Apply for social benefits
type 3 Obtain medical insurance
type 4 Restore/obtain tax identification number (certificate)
type 5 Obtain documentation to support work experience
type 6 Register disability
type 7 Arrange for nursing home placement
type 8 Temporary registration with organization
type 9 Registration at another address
type 10 Employment
type 11 Employment with accommodation
type 12 Arrange for a night shelter
type 13 Alcohol and drug rehabilitation centers
type 14 Arrange for a hospital
type 15 Search for relatives
type 16 Return to hometown
type 17 Determine/assume citizenship
type 18 Legal assistance in court
type 19 Obtain housing
type 20 Cancel fraudulent transaction and restore housing
type 21 Submit request(s) and/or application(s)
type 22 Rehabilitation program (name omitted) to preserve anonymity
type 23 Restore school records
type 24 Issuance of a duplicate birth certificate or other document
type 25 Obtain/reinstate military ID
type 26 Obtain an international passport
type 27 Rehabilitation equipment (prosthetic devices, etc.)
type 28 Obtain social insurance certificate (insurance - individual personal account number)
type 29 Arrange for placement in a social adjustment center
type 30 Assistance with vocational training
type 31 Identification
type 32 Registration at an AIDS center
type 33 Arrange for placement in a crisis center
type 34 Psychological support
type 35 Recalculate/reinstate/obtain social benefits
type 36 Complete case in civil court
type 37 Obtain unpaid wages upon dismissal
type 38 Health Restoration
Type 39 Employment Adjustment Program
Type 40 Supported Housing
Type 41 Support for the Rehabilitation Program for Clients with Chemical Dependency
Type 42 Pre-Housing Preparation
Type 43 Hostel

Impact of the dataset variables on contract success

The impact of alcohol consumption on contract success is negative. In fact, by calculating the inference of the two variables, we reject the null hypothesis H0 and can state that we are 95% confident that the percentage of customers who consume alcohol and fulfill the contract is lower than the percentage of customers who do not consume alcohol and fulfill the contract, given that p_value < 0.05:

library(statsr)

#Loading data:
df <- read.csv("final_with_onehot_types_ALL_221120.csv")

df$contract_success <- factor(df$contract_success, levels = c(0,1), labels = c("not fulfilled","fulfilled"))

df$comments_alcohol <- factor(df$comments_alcohol, levels = c(0,1), labels = c("No","Yes"))

df <- df[,-c(49,53)]

inference(y = contract_success , x = comments_alcohol, data = df, statistic = "proportion", type = "ht", null=0,alternative = "greater", method = "theoretical", success = "fulfilled" )

Response variable: categorical (2 levels, success: fulfilled) Explanatory variable: categorical (2 levels) n_No = 6351, p_hat_No = 0.498 n_Yes = 1841, p_hat_Yes = 0.447 H0: p_No = p_Yes HA: p_No > p_Yes z = 3.8543 p_value = 1e-04

Similarly, by calculating inferences for all other variables with the variable contract_success, we can evaluate whether the impact on the success of the contract is positive or negative:

for (i in 13:98) {
 dat<-inference(y = contract_success, x = as.factor(df[,i]), data = df, statistic = "proportion", type = "ht", null=0, alternative = "greater", method = "theoretical", success = "fulfilled", verbose = FALSE )

 if (dat$p_value<0.05)
   print(paste(colnames(df[i]),"negative impact"))
 else
   print(paste(colnames(df[i]),"positive impact"))
 }
[1] "comments_alcohol negative impact"
[1] "comments_chem positive impact"
[1] "comments_disability positive impact"
[1] "comments_absence negative impact"
[1] "comments_orphange negative impact"
[1] "comments_work positive impact"
[1] "comments_confinement negative impact"
[1] "comments_noresidence positive impact"
[1] "comments_aggression positive impact"
[1] "comments_disturbance negative impact"
[1] "comments_disease positive impact"
[1] "comments_death negative impact"
[1] "comments_nursinghome positive impact"
[1] "comments_relatives negative impact"
[1] "comments_illiteracy impact" to positive"
[1] "comments_foreigner negative impact"
[1] "comments_ticket positive impact"
[1] "comments_court positive impact"
[1] "comments_pregnancy positive impact"
[1] "comments_mental positive impact"
[1] "comments_fire negative impact"
[1] "comments_social_benefits positive impact"
[1] "comments_divorce positive impact"
[1] "contacts_relatives positive impact"
[1] "no_relatives positive impact"
[1] "source_perm_job positive impact"
[1] "source_temp_job negative impact"
[1] "source_social_benefits negative impact"
[1] "source_alms negative impact"
[1] "source_relatives positive impact"
[1] "source_other positive impact"
[1] "source_gathering positive impact"
[1] "source_charity positive impact"
[1] "source_rehabs negative impact"
[1] "is_citizen positive impact"
[1] "is_retired positive impact"
[1] "is_registered positive impact"
[1] "from_orphanage positive impact"
[1] "was_confined positive impact"
[1] "chem_confirmed positive impact"
[1] "chem_possible positive impact"
[1] "chem_noanswer positive impact"
[1] "chem_no positive impact"
[1] "type_1 positive impact"
[1] "type_2 negative impact"
[1] "type_3 negative impact"
[1] "type_4 positive impact"
[1] "type_5 positive impact"
[1] "type_6 negative impact"
[1] "type_7 negative impact"
[1] "type_8 positive impact"
[1] "type_9 positive impact"
[1] "type_10 positive impact"
[1] "type_11 positive impact"
[1] "type_12 positive impact"
[1] "type_13 positive impact"
[1] "type_14 positive impact"
[1] "type_15 positive impact"
[1] "type_16 positive impact"
[1] "type_17 negative impact"
[1] "type_18 negative impact"
[1] "type_19 negative impact"
[1] "type_20 negative impact"
[1] "type_21 negative impact"
[1] "type_22 positive impact"
[1] "type_23 positive impact"
[1] "type_24 positive impact"
[1] "type_25 positive impact"
[1] "type_26 positive impact"
[1] "type_27 positive impact"
[1] "type_28 positive impact"
[1] "type_29 positive impact"
[1] "type_30 positive impact"
[1] "type_31 negative impact"
[1] "type_32 positive impact"
[1] "type_33 positive impact"
[1] "type_34 negative impact"
[1] "type_35 positive impact"
[1] "type_36 negative impact"
[1] "type_37 positive impact"
[1] "type_38 negative impact"
[1] "type_39 negative impact"
[1] "type_40 positive impact"
[1] "type_41 positive impact"
[1] "type_42 positive impact"
[1] "type_43 positive impact"

Predicting Contract Success

To predict the contract_success variable using the others, it is best to implement the XGBoost algorithm, obtaining a forecast accuracy of 77% (better results can be found in the study authors' Jupyter report):

import pandas as pd
from sklearn.model_selection import train_test_split
from sklearn.metrics import classification_report
from xgboost import XGBClassifier

with_onehot_types = pd.read_csv('final_with_onehot_types_ALL_221120.csv')

x_columns_t = list(set(with_onehot_types.columns) - set(['contract_id', 'client_id', 'contract_success', 'contract_status_id']))
X_t = with_onehot_types[x_columns_t]
y_t = with_onehot_types.contract_success

X_train_t, X_val_t, y_train_t, y_val_t = train_test_split(X_t,
                                                          y_t,
                                                          test_size=0.2,
                                                          stratify=y_t)
model = XGBClassifier()
model.fit(X_train_t, y_train_t)
preds= model.predict(X_val_t)

print(classification_report(y_val_t, preds))
              precision    recall  f1-score   support
           0       0.77      0.78      0.78       883
           1       0.76      0.75      0.76       824
    accuracy                           0.77      1707
   macro avg       0.77      0.77      0.77      1707
weighted avg       0.77      0.77      0.77      1707