-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
25 changed files
with
351 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# The `yahooquery` Package |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# The `yfinance` Pacakge | ||
|
||
Fetching data from Yahoo Finance: | ||
|
||
```{python} | ||
import yfinance as yf | ||
ticker = "NVDA" | ||
df = yf.download(ticker, start="2014-01-01", end="2024-01-01") | ||
df | ||
``` |
27 changes: 27 additions & 0 deletions
27
docs/notes/predictive-modeling/autoregressive-models/arima.qmd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Autocorrelation and Auto-Regressive Models | ||
|
||
Learning Objectives: | ||
|
||
+ Compute autocorrelation in Python using the statsmodels package | ||
+ Use autocorrelation to identify how many periods to use when training an ARMA model | ||
+ Train ARMA model in Python using the statsmodels package, to predict future values given past values. | ||
+ Understand the ARMA model assumption of stationary data. | ||
+ Remember that when making predictions using a trained ARMA model, the dates to predict have to match the format of the training dates. so if the model is trained on monthly data starting at the beginning of the month, we have to predict for dates at the beginning of future months. if the data is trained on quarterly data at the end of the quarter, we have to predict for dates at the end of future quarters. | ||
|
||
## Stationary Data | ||
|
||
what it means for data to be stationary - the mean does not move over time. | ||
|
||
|
||
for example: | ||
|
||
stock prices would probably not be stationary, however stock returns could be. | ||
|
||
gdp might not be stationary, however gdp growth could be. | ||
|
||
|
||
## Autocorrelation | ||
|
||
|
||
|
||
## Auto-Regressive Moving Average (ARMA) |
29 changes: 29 additions & 0 deletions
29
docs/notes/predictive-modeling/autoregressive-models/autocorrelation.qmd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Autocorrelation | ||
|
||
**Autocorrelation** is a statistical concept that measures the relationship between a variable's current value and its past values over successive time intervals. | ||
|
||
In time series analysis, autocorrelation helps identify patterns and dependencies in data, particularly when dealing with sequences of observations over time, such as stock prices, temperature data, or sales figures. Autocorrelation analysis is helpful for detecting trends, periodicities, and other temporal patterns in the data, as well as for developing predictive models. | ||
|
||
## Interpreting Autocorrelation | ||
|
||
Similar to correlation, autocorrelation will range in values from -1 to 1. A positive autocorrelation indicates that a value tends to be similar to preceding values, while a negative autocorrelation suggests that a value is likely to differ from previous observations. | ||
|
||
+ **Strong Positive Autocorrelation**: A high positive autocorrelation at a particular lag (close to +1) indicates that past values strongly influence future values at that lag. This could mean that the series has a strong trend or persistent behavior, where high values are followed by high values and low values by low ones. | ||
|
||
+ **Strong Negative Autocorrelation**: A strong negative autocorrelation (close to -1) suggests an oscillatory pattern, where high values tend to be followed by low values and vice versa. | ||
|
||
+ **Weak Autocorrelation**: If the ACF value is close to zero for a particular lag, it suggests that the time series does not exhibit a strong linear relationship with its past values at that lag. This can indicate that the observations at that lag are not predictive of future values. | ||
|
||
## Uses for Predictive Modeling | ||
|
||
In predictive modeling, especially for time series forecasting, autocorrelation is essential for selecting the number of lagged observations (or lags) to use in autoregressive models. By calculating the autocorrelation for different lag intervals, it is possible to determine how much influence past values have on future ones. This process helps us choose the optimal lag length, which in turn can improve the accuracy of forecasts. | ||
|
||
## Calculating Autocorrelation in Python | ||
|
||
In Python, we can calculate autocorrelation using the [`acf` function](https://www.statsmodels.org/stable/generated/statsmodels.tsa.stattools.acf.html) from `statsmodels. The autocorrelation function (ACF) calculates the correlation of a time series with its lagged values, providing a guide to the structure of dependencies within the data. | ||
|
||
## Examples of Autocorrelation | ||
|
||
### Autocorrelation of Random Data | ||
|
||
### Autocorrelation of Baseball Team Performance |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# Autoregressive Models |
Oops, something went wrong.