Skip to content
Advertisement

How to remove features from regression results using bonferroni correction results?

I implemented a regression model using

JavaScript

After fitting a regression model, I ran a bonferroni correction using

JavaScript

And I get the following result:

JavaScript

I want to use these arrays to remove the features in model_a that are False and create a new model ‘train_simplified’.

I’m using the following manual approach, but I want to know if there´s a more efficient way to do it.

JavaScript

Advertisement

Answer

You could use Pandas loc to select only the features in model_a that are True.

.loc[] is primarily label based, but may also be used with a boolean array.

JavaScript
JavaScript

Output from train_simplified

JavaScript
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement