Skip to content

Commit 5f0e4bc

Browse files
committed
Finalize project: Complete paper.tex and README.md.
1 parent 06400c4 commit 5f0e4bc

File tree

3 files changed

+75
-75
lines changed

3 files changed

+75
-75
lines changed

README.md

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Apple Stock AR-Process Analysis & Multistep Forecasting
1+
# Autoregressive Model Analysis and Multistep Forecast of Apple Stock Data
22

33
## Table of Contents
44

@@ -11,26 +11,27 @@ ______________________________________________________________________
1111

1212
## Overview
1313

14-
In this project, I analyzed apple stock data using time series econometrics methods. The
15-
final result of my project is a latex file that roughly describes the analysis steps and
16-
the charts and to what extent it is possible to use/interpret my results.
14+
In this project, Apple stock data was analyzed using time series econometrics methods.
15+
The final output of this project is the LaTeX file **paper.pdf** that roughly describes
16+
the analysis steps as well as the figures/tables and deals with the question to what
17+
extent it is possible to interpret the results.
1718

1819
In this project, I:
1920

2021
- fit several AR processes to Apple's historical stock data.
21-
- compare model performance to identify the best fitting AR process.
22-
- evaluate the ability of the best model to perform multistep forecasts.
23-
- investigate the extent to which it is possible to use the AR process for analysis.
24-
- provide analysis and plots to visualize both the model fit and forecasting
22+
- compared model performance to identify the best fitting AR process.
23+
- evaluated the ability of the best model to perform multistep forecasts.
24+
- investigated the extent to which it is possible to use the AR process for analysis.
25+
- provided analysis and plots to visualize both the model fit and forecasting
2526
performance.
2627

2728
______________________________________________________________________
2829

2930
## System Prerequisites
3031

31-
To make sure that the project works on your machine you need to have installed *Python*,
32-
*a modern LaTeX distribution*, *Git*, and if applicable a *text editor*. For a more
33-
detailed explanation see the
32+
To make sure that the project works on your device it is necessary to have installed
33+
*Python*, *a modern LaTeX distribution*, *Git*, and if applicable a *text editor*. For a
34+
more detailed explanation see the
3435
[documentation](https://econ-project-templates.readthedocs.io/en/stable/getting_started/index.html).
3536

3637
______________________________________________________________________
@@ -43,7 +44,7 @@ First one needs to clone the repository:
4344
git clone https://github.com/iame-uni-bonn/final-project-Lenr4.git
4445
```
4546

46-
Next navigate to the project root and create and activate the environment:
47+
Next, navigate to the project root and create and activate the environment:
4748

4849
```bash
4950
mamba env create lennart_epp
@@ -56,7 +57,7 @@ After the environment is activated, one can run the project by:
5657
pytask
5758
```
5859

59-
> 🛑 **Caution**: If you had trouble with kaleido on windows you need to use this
60+
> 🛑 **Caution**: If there were any trouble with kaleido on windows you need to use this
6061
> [workaround](https://effective-programming-practices.vercel.app/plotting/why_plotly_prerequisites/objectives_materials.html#windows-workaround):
6162
>
6263
> ```bash
@@ -71,22 +72,22 @@ The Project is structured into three different parts.
7172
7273
- **bld**: The Build directory cointaing all output files.
7374
74-
- **plots**: top 3 AR models for fitting(1 step forecast), multistep forecast, ACF all
75-
as interactive html and pdf
76-
- **forecasts**: 10 step forecast using AR(1) as pkl file
77-
- **data**: cleaned apple data as pkl file
78-
- **memory**: pkl file of ACF, and tex files of *Hurst* and *ADF* statistics
79-
- **models** pkl file of all AR models and tex file with top model statistics
75+
- **plots**: Top 3 AR models for fitting (1 step forecast), ACF, Multistep forecast;
76+
all as interactive .html and .pdf files.
77+
- **forecasts**: Multistep forecast using AR(1) as .pkl file.
78+
- **data**: Cleaned Apple data as .pkl file.
79+
- **memory**: .pkl file of ACF and .tex files of *Hurst* and *ADF* statistics.
80+
- **models**: .pkl file of all AR models and .tex file with top model statistics.
8081
81-
- **src**: The source directory containing all python files needed for the analysis.
82+
- **src**: The Source directory containing all python files needed for the analysis.
8283
8384
- **data**: CSV file containing the raw data for reproducibilty.
8485
- **data_management**: Python files for cleaning and downloading the data from
8586
[Yahoo Finance](https://de.finance.yahoo.com/).
8687
- **analysis**: Python files which analyse the data.
8788
- **final**: Python files which plot the results.
8889
89-
- **tests**: The test directory containing all python files which are used for testing.
90+
- **tests**: The Test directory containing all python files which are used for testing.
9091
9192
- **data_management**: Python files for testing the data management steps.
9293
- **analysis**: Python files for testing the analysis steps.

documents/paper.lof

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
\contentsline {figure}{\numberline {1}{\ignorespaces Comparison of the top-performing AR models.}}{1}{}%
2-
\contentsline {figure}{\numberline {2}{\ignorespaces Autocorrelation Function (ACF) of the differenced time series with 95\% confidence bands.}}{2}{}%
3-
\contentsline {figure}{\numberline {3}{\ignorespaces Multi-step forecast for Apple stock price.}}{3}{}%
1+
\contentsline {figure}{\numberline {1}{\ignorespaces Comparison of the top-performing AR models}}{1}{}%
2+
\contentsline {figure}{\numberline {2}{\ignorespaces Autocorrelation Function (ACF) of the differenced time series with 95\% confidence bands}}{2}{}%
3+
\contentsline {figure}{\numberline {3}{\ignorespaces Multi-step forecast for Apple stock price}}{3}{}%

documents/paper.tex

Lines changed: 50 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@
3737

3838
\begin{document}
3939

40-
\title{Apple Stock AR-Process Analysis and Multistep Forecasting}
41-
\author{Lennart Epp}
40+
\title{Autoregressive Model Analysis and Multistep Forecast of Apple Stock Data}
41+
\author{Lennart Lülsdorf}
4242
\date{\today}
4343

4444
\maketitle
@@ -57,73 +57,72 @@
5757
\section{Introduction}
5858

5959
In this project, Apple stock data is analyzed using time series econometrics methods. This
60-
paper is structured as follows: first, I present the Top 3 best-fitting AR(p) models for approximating
61-
i.e for one step forecasting of the Apple stock data. So for this forecast/approximation, only values
62-
of the original data namley the close price of the apple stock are used as in input for the forecast.\\
63-
Then, I proceed with an analysis to what extent it is possible to fit an AR(p) process on Apple.
64-
For this I checked if the differenced Apple data is stationary and after that I concern whether the
65-
time series has long or short memory.\\
66-
Lastly, I will present a multi-step forecast, where each forecasted value is used as input
67-
for the next prediction. I will analyze why this approach fails to capture Apple stock dynamics
68-
beyond a one-step forecast and discuss the overall feasibility of fitting an AR model to Apple stock data.
60+
project is structured as follows: first, the three best autoregressive AR(p) models for approximating
61+
i.e. for one step forecasting of the Apple stock data are presented. Therefore, for this approximation, only values
62+
of the original data, namley the close price of the apple stock, are used as an input for the forecast.\\
63+
This was followed by an analysis, to what extent it is possible to fit an AR(p) process on Apple.
64+
To do this, the stationarity of the differenced Apple data was examined and also whether the time series has long or short memory.\\
65+
Finally, a multi-step forecast is presented, where each forecasted value is used as an input
66+
for the next prediction. The failure of this approach to capture Apple stock dynamics beyond a one-step forecast
67+
will be analyzed and a discussion of the overall feasibility to fit an AR model to Apple stock data completes the project.
6968

7069
\section{Top AR(p) Approximations}
7170

72-
The following plots shows the top 3 AR model fits in the sense of the Akaike Information
73-
Criterion. It also shows the residual plot of the top 3 AR models. The figure shows that
74-
one-step forecasts closely follow the original data. However, the variance of the residuals
75-
increases over time, suggesting that the model struggles to maintainforecast accuracy over
71+
In the first graph of Figure 1 the three best AR model fits in the sense of the Akaike Information
72+
Criterion (AIC) are shown. The second graph visualizes the residual plot of these AR models. Overall, the figure displays
73+
that one-step forecasts closely follow the original data. However, the variance of the residuals
74+
increases over time, suggesting that the model struggles to maintain forecast accuracy over
7675
longer periods.
7776

7877
\begin{figure}[H]
7978
\centering
8079
\includegraphics[scale=1.8, width=\textwidth, trim=10 10 10 10, clip]
8180
{../bld/plots/top_ar_models_plot.pdf}
82-
\caption{Comparison of the top-performing AR models.}
81+
\caption{Comparison of the top-performing AR models}
8382
\label{fig:top_ar_models}
8483
\end{figure}
8584

86-
\noindent In the following table, you see the metrics of the best AR(P) processes in terms of their AIC.
87-
First, notice that the AR(p) was fitted on the differenced close price since the P-Value of
88-
the Augmented Dickey-Fuller test suggested differencing, indicating that the original close
89-
price is likely not stationary.\\
90-
Therefore, the AR coefficients had to be integrated to approximate the original time series,
91-
which could lead to accumulated errors. So given the AIC as you can see in the table, the AR(1) process fitted
92-
Apple best. In total I tested p values up to 12.
85+
\noindent Table 1 contains the metrics of the best AR(p) processes in terms of their AIC.
86+
Notice that the AR(p) model was fitted on the differenced time series of the close price from Apple stock data,
87+
since the p-value of the Augmented Dickey-Fuller (ADF) test showed that the original close price time series
88+
is nonstationary.\\
89+
Therefore, the AR coefficients had to be integrated, to approximate the original time series,
90+
which increases the probability of accumulated errors. So, given the AIC the AR(1) process fitted
91+
Apple best (Table 1). In total, values for p from 1 to 12 were tested.
9392

9493
\input{../bld/models/top_models.tex}
9594

9695
\section{Memory Analysis}
9796

98-
In this section, I check to what extent it is possible to fit an AR model on the differenced data.
99-
Therefore, I first used the ADF test to check if the differenced close price is stationary.
100-
The results are shown in the following table, indicating that the differenced series is likely
101-
stationary. This is a necessary prerequest for fitting AR models.
97+
This section addresses the question to what extent it is possible to fit an AR model on the differenced data.
98+
Therefore, the ADF test was used to check if the differenced close price was stationary.
99+
The results are shown in Table 2, indicating that the differenced series is likely
100+
stationary, which is a necessary prerequest for fitting AR models.
102101

103102
\input{../bld/memory/diff_close_stat_test.tex}
104103

105104

106105
\noindent After confirming stationarity, the next critical question is whether the differenced time series
107-
exhibits short or long memory. Therefore I computed the Autocorrelation Function of the time series. As
108-
you can see in the following plot the ACF decreases over time but still has a few outlieres which
109-
indicates that the time series has the characteristics of a process with a short memory,
110-
but with potential components with a long memory.
106+
exhibits short or long memory. Therefore, the Autocorrelation Function (ACF) of the time series was computed. Visualized
107+
in Figure 2, the ACF decreases over time, which indicates the characteristics of a process with short memory.
108+
However, a few outlieres visualize a potential of a time series with long memory.
109+
111110

112111
\begin{figure}[H]
113112
\centering
114113
\includegraphics[scale=1.2, width=\textwidth, trim=10 10 10 10, clip]
115114
{../bld/plots/acf_plot.pdf}
116115
\caption{Autocorrelation Function (ACF) of the differenced time series with 95\% confidence
117-
bands.}
116+
bands}
118117
\label{fig:acf_plot}
119118
\end{figure}
120119

121120

122-
\noindent Since the differenced close price is likely stationary, but the ACF indictaes some long run effects
123-
I also cumpted the hurst coefficient which has an value of approximately .052 which indicates
124-
that the time series shows characteristics of a process with almost random behavior, as the Hurst coefficient
125-
close to 0.5 indicates the absence of strong long-term dependencies. However, since the ACF indicates some
126-
long-term effects, this result could indicate a mixture of short-term autocorrelations with occasional
121+
\noindent Since the differenced close price is likely stationary, but the ACF indictaes some long run effects,
122+
the Hurst exponent was computed (Table 3). This exponent indicates the absence of strong long-term dependencies
123+
with a value close to 0.5. For the Apple stock data a value of approximately 0.52 was computed. This demonstrates
124+
that the time series shows characteristics of a process with almost random behavior. However, since the ACF indicates some
125+
long-term effects (Figure 2), this result might be an indication for a mixture of short-term autocorrelations with occasional
127126
persistence.
128127

129128

@@ -134,44 +133,44 @@ \section{Memory Analysis}
134133
\section{Multistep Forecast}
135134

136135
Although the differenced close price was found to be stationary, the presence of a Hurst
137-
coefficient of 0.52 and some significant autocorrelation function (ACF) values suggest that
136+
coefficient of 0.52 and some significant ACF values suggest that
138137
the series retains some degree of long memory.
139138

140139
\noindent AR models are designed to capture short-term dependencies and assume that the impact of past
141140
values decays rapidly. However, in a long-memory process, dependencies persist for a longer
142141
time, meaning that an AR(p) model may fail to account for the full structure of the series
143142
beyond a few steps ahead.
144143

145-
\noindent In a one-step-ahead forecast, the AR model predicts the next value based solely on observed
146-
historical data. In a multi-step forecast, each predicted value is used as input for the next
144+
\noindent In an one-step-ahead forecast, the AR model predicts the next value based solely on observed
145+
historical data. While in a multi-step forecast, each predicted value is used as an input for the next
147146
prediction. This recursive approach leads to error accumulation.
148147

149-
\noindent The following figure illustrates that the AR model fails to capture the long-term structure
148+
\noindent Figure 3 illustrates that the AR model fails to capture the long-term structure
150149
of Apple stock price movements when applied to multi-step forecasting. This is due to error accumulation
151-
and the model's inability to account for evolving market dynamics.
150+
and the model's incapacity to account for evolving market dynamics.
152151

153152

154153
\begin{figure}[H]
155154
\centering
156155
\includegraphics[scale=1.8, width=\textwidth, trim=10 10 10 10, clip]
157156
{../bld/plots/multistep_forecast.pdf}
158-
\caption{Multi-step forecast for Apple stock price.}
157+
\caption{Multi-step forecast for Apple stock price}
159158
\label{fig:apple_forecast}
160159
\end{figure}
161160

162161
\section{Conclusion}
163162

164-
To conclude my analysis i went through the following steps:\\
163+
The autoregressive model analysis of Apple stock data can be summarized in three steps:
165164
First, the stationarity analysis, conducted using the Augmented Dickey-Fuller (ADF) test,
166-
indicated that the original close price series was non-stationary, requiring differencing to
167-
achieve stationarity.\\
168-
Second, the evaluation of different AR(p) models based on the Akaike Information Criterion
169-
(AIC) revealed that an AR(1) model provided the best fit among the examined options.\\
165+
indicated that the original close price series was nonstationary, requiring differencing to
166+
achieve stationarity. Second, the evaluation of different AR(p) models based on the
167+
AIC revealed that an AR(1) model provided the best fit among the examined options.
170168
Third, the study investigated the memory characteristics of the time series by computing the
171169
Hurst exponent and analyzing the autocorrelation function (ACF). The results suggested that
172-
the differenced time series exhibited short-memory behavior.\\
173-
Finally, the limitations of AR models for multi-step forecasting were assessed. While the AR(1)
174-
model performs well for short-term forecasts, its accuracy deteriorates over multiple steps
170+
the differenced time series exhibited a mixture of short-term autocorrelations with occasional
171+
persistence.\\
172+
Finally, the limitations of AR models for multi-step forecasting were assessed. While the AR
173+
models performs well for short-term forecasts, its accuracy deteriorates over multiple steps
175174
due to error propagation and the inability to capture long-term dependencies.
176175

177176
\end{document}

0 commit comments

Comments
 (0)