My built-from-scratch derivative-based hyperplane fitter and its implementation in predicting stock prices
Let us consider the input matrix as
To fit an intercept A becomes
Ordinary Least Squares(OLS) estimator for the input matrix is defined to be
where y is the target vector and β is the weight vector. However, OLS is highly sensitive to outliers since squaring induces unnecessary bias in the model. To overcome the problem of squaring, I developed derivative-based estimation, which uses:
where
- Through this approach the change of an input variable with respect to other input variables is found out.
- The target variable per unit input variable also conveys an intuitive meaning as to which variable has the most impact on the target vector.
- Reduced sesitivity to outliers- Using the model with z-score normalized data, will automatically diminish the effect of values which have more deviation from mean.
Using a sliding window application for the derivative-based fitter, not only have i developed a sliding window stock price predictor but also a prediction mechanism to incorporate the fluctuations in the stock prices using binary trees. The figure below is an illustration as to how binary trees have applied in prediction and accomodate volatility:
Here RF is called the Risk Factor ranging between [0, 1]. RF at tick = t is calculated as the ratio of difference between prediction for t and actual value at t, to twice of nth percentile absolute error(for eg. 80th percentile error if considered significant).
Here's a comparison of the proposed model's performance with other time series forecasting model (1 unit on X-axis = 15m, data: Amazon stock as of 12/04/2024)
This project is licensed under the Apache 2.0 License.
For questions or feedback, feel free to reach out to vinayaksoni704@gmail.com
Disclaimer: The projects and analyses provided in this repository are for educational purposes only and should not be construed as financial advice.