Let's try with the economic sector. We can legitimately infer that the economic sector should be with a given customer going into default or not.
Let us start by fitting the linear model. As I was saying, this can be easily done in R employing the lm() function:
linear_regression_economic_sector <- lm(as.numeric(default_flag) ~ economic_sector, clean_casted_stored_data_validated_complete)
As you can see, we define as y the default_flag attribute, and as x the economic_sector. The lm() function takes care of estimating β0 and β1.
You can have a look at the estimates by printing out the linear_regression_economic_sector object:
linear_regression_economic_sector
Which will give you this as an output:
Call:
lm(formula = as.numeric(default_flag) ~ economic_sector, data = clean_casted_stored_data_validated_complete)
Coefficients: (Intercept) economic_sector 2.741e+00 -2.083e-09
Thinking again about the linear model definition, we can say that our intercept is the β0 we were discussing before, while the β1 is represented here from the -2.083e-09 related to the economic_sector variable.