Skip to content

Regression in PlotToolPro #94

@zoeyzhougs

Description

@zoeyzhougs

Describe the problem.
Regression should be available in PlotToolPro.

Describe the solution you'd like
Add a class in gs-quant (constructor in PlotToolPro) for the model fitting which has methods to get model parameters and perform prediction.

For example, linear regression should take the form LinearRegression(X, y, w) where X denotes explanatory variables [x1, x2, x3, ...], y is the dependent variable and w is the moving window. The class has methods:
coefficient(i) - the i-th coefficient
rsquare() - model R squared
tstat(i) - t-stat of the i-th coefficient
fitted_values() - fitted values
predict(X') where X' is the test set of explanatory variables - predicated values (Note: if multiple regression models have been fitted over the moving window, the most recent model will be used for prediction)

In PlotToolPro, users could fit a linear regression between changes of implied volatility of S&P 500 index and returns on the underlying by:

spx = returns(SPX.spot(), 1, simple)
spx_vol = diff(SPX.implied_volatility(1m, forward, 100), 1)
r = LinearRegression([spx], spx_vol, 60)
r.fitted_values()

Are you willing to contribute
Yes

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions