If the p value of a specific independent variable is less than 0.05 then it is considered to be a statistically significant variable. How to extract these variables from the dataset using Python ?
2 comments
Leave a comment
You must be logged in to post a comment.
The statsmodels.regression.linear_model.OLSResults.pvalues should give you the pvalues of the respective variables. pvalues[0] should give you the pvalues of the 1st variable. You can filter out the names of the variables wherever pvalues[i]<0.05 and then use the list of variable names to filter out data as per need.