This README provides an overview of the code for predicting Ethereum stock prices using linear regression and autoregressive models. It includes data preparation, model fitting, and visualization steps.
- Prerequisites
- Data Input
- Time Series Plot
- Modeling
- Correlation Analysis
- Autoregressive Model
- Model Visualization
- Conclusion
Make sure you have the necessary R packages installed. This code specifically requires the car
package for the Durbin-Watson test.
Read the Ethereum price data from a CSV file.
Create a time series plot to visualize Ethereum prices over time.
Fit a simple linear regression model using time as the predictor.
Visualize the residuals from the model.
Perform a Durbin-Watson test to check for autocorrelation in the residuals.
durbinWatsonTest(model)
Create lagged terms for the price and calculate correlations.
Fit an autoregressive model using the first four lagged terms.
model = ar.ols(ethereum$price, order.max = 10, demean = F, intercept = T)
Check for autocorrelation in the residuals.
Plot the actual vs. fitted values from the autoregressive model.
This code provides a comprehensive approach to predicting Ethereum stock prices using linear and autoregressive models.
The analysis indicates that the following lagged terms are important for predicting Ethereum prices:
- Lag 1: Shows a strong positive correlation and is significant in the autoregressive model.
- Lag 4: Exhibits a significant negative coefficient, suggesting an important delayed effect.
- Lag 2 and Lag 3: Although not statistically significant, they still contribute to the model's predictive power.
These insights can help refine future forecasting efforts and suggest that incorporating these lags may improve model performance. For further exploration, consider experimenting with different model orders or additional predictors to enhance forecasting accuracy.