variance_inflation_factor
Calculate VIF (variance inflation factor), which tests for collinearity.
It quantifies the severity of multicollinearity in an ordinary least squares regression analysis. The square root of the variance inflation factor indicates how much larger the standard error increases compared to if that variable had 0 correlation to other predictor variables in the model.
It is defined as:
where is the coefficient of determination of the regression equation with the column i being the result from the i:th series being the exogenous variable.
A VIF over 5 indicates a high collinearity and correlation. Values over 10 indicates causes problems, while a value of 1 indicates no correlation. Thus VIF values between 1 and 5 are most commonly considered acceptable. In order to improve the results one can often remove a column with high VIF.
For further information see: https://en.wikipedia.org/wiki/Variance_inflation_factor
Examples
from openbb import obb
# Calculate the variance inflation factor.
stock_data = obb.equity.price.historical(symbol='TSLA', start_date='2023-01-01', provider='yfinance').to_df()
obb.econometrics.variance_inflation_factor(data=stock_data, column="close")
Parameters
- standard
Name | Type | Description | Default | Optional |
---|---|---|---|---|
dataset | List[Data] | Dataset to calculate VIF on | False | |
columns | Optional[list] | The columns to calculate to test for collinearity | True |
Returns
OBBject
results : List[Data]
The resulting VIF values for the selected columns