Age and Education Factors
Age and education may also influence employees' absenteeism. For instance, older employees might need more frequent medical treatment, while employees with higher education degrees, covering positions of higher responsibility, might be less prone to being absent.
First, let's investigate the correlation between age and absence hours. We will create a regression plot, in which we'll plot the Age
column on the x axis and Absenteeism time in hours
on the y axis. We'll also include the Pearson's correlation coefficient and its p-value, where the null hypothesis is that the correlation coefficient between the two features is equal to zero:
from scipy.stats import pearsonr # compute Pearson's correlation coefficient and p-value pearson_test = pearsonr(preprocessed_data["Age"], \ Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â preprocessed_data["Absenteeism time in hours...