0% found this document useful (0 votes)
35 views

Python Task 1

Uploaded by

Nash Baraka
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
35 views

Python Task 1

Uploaded by

Nash Baraka
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

Question 1a

This paper uses monthly currency in circulation data of the Hong Kong Dollar collected from the HKMA’s
public API. The dataset is four years data, as before from [Start Date] to [End Date]. The first one
concerns with the depiction of the orientation and fluctuations in the data, cyclical character and the
rest while the second one, endeavors to predict future values of data by use of modelling strategies. To
download the data, the HKMA API was utilized and the details were saved in a pandas DataFrame which
comprised of only one column which is ‘total_issues’ signifying currency in circulation for the concerned
month. It was then necessary to limit the dataset to only the last four years from the and for this
purpose ‘end_of_month’ was indexed into datetime format.

Decomposition Analysis

The trend component indicates the nature of currency in circulation within the observed period in
relation to economic growth or alteration of monetary base. Seasonal decomposition aims at revealing
notable variations in values and shows that they rise notably in December and January, which might be
associated with higher consumer activity during festive months. The last part involves short-term
fluctuations in the data that remain after trend and seasonal adjustments have been made; random
components. Besides, this improves the understanding of currency distribution further while creating a
solid foundation for accurate forecasting models, which can be used to predict the trends in the future.
Question 1b

In the process for calculating it, the appointed historical foreign exchange rate of two chosen currencies
up to the existing date, that is up to July 14, 2024, is detected, and the future foreign exchange rate is
later simulated for a certain period of time. This type of forecast is numerical and it based its prediction
on factors of economics, market and statistical features. To interpret the analysis, examine the direction
by comparing the slopes of the two lines: This means that when the forecast line is moving above and
rising in comparison to the original line this is an indication that the first currency might strengthen
against the second currency while when the forecast line is situated below; this imply that the first
currency may weaken against the second currency. The maintenance of a horizontal line suggested that
the organization did not envisage any change in the future. In case of two lines the spread or distance
between the two lines depicts the magnitude of the forecasted movements where large degree of
movement is indicated by a wider spread while a smaller degree of movement is indicated by a narrow
spread. But it is important to note that the prediction is done with an error margin of the predicted
currency rates and the model’s reliability decreases with the forecast horizon.
Question 1c

Model Name RMSE


Seasonal Naive 31443.44
Exponential Smoothing 19150.39
ARIMA 30843.97

As for the performance, the Exponential Smoothing Model yielded the best results with an RMSE of
19150. Such a value of Pe is equal to 39, which reflects the model’s ability to track changes in values of
actual currency in circulation and reflect tendencies and fluctuations of both short- and long-term
timescales in the dataset. In contrast, the estimated RMSE from the employed Seasonal Naive Model
amounts to 31443. 44, showed the overall poor performance due to its use of corresponding month of
the preceding year that cannot effectively respond to overall change of trends or seasonal variation of
flows. The ARIMA Model for our dataset is, with the RMSE of 30843. 97 showed a slightly better result
than the Naive Model, but lower than the Exponential Smoothing Model. This means that although
there are some complicated patterns that the ARIMA models are capable of identifying, these models
may have to be constantly modified in order to better capture and forecast data that might have a
seasonality aspect to it such as this one for currency circulation.

Question 2a

In case with the assessment of JPY/USD daily exchange rate, the variable adopted is the Basic Loan Rate.
The Basic Loan Rate which is determined by the Bank of Japan is another key rate in Japan’s financial
system as it influences other rates in this country. Its influence on the JPY/USD exchange rate is
significant for several reasons:Its influence on the JPY/USD exchange rate is significant for several
reasons:

Monetary Policy Influence: The Basic Loan Rate gives the direction of the Japanese monetary policy as
determined by the BOJ. Fluctuations into this rate is used to send signals into the BOJ to either boost or
tame inflation, control growth or stabilize the yen that is directly proportional to the value of yen against
other currencies such as the USD. Interest Rate Differential: Fluctuations in the interest rates between
Japan and the United States affect the exchange rate of JPY/USD. There is always a tendency by
investors to get higher returns and this is often done by channelling capital from one country to another
on the basis of such differentials. Basic Loan Rate therefore acts as key factor that contributes to
changes in the JPY/USD exchange rate due to investors’ portfolio adjustments. Economic Expectations:
The Basic Loan Rate influences economic buoyant and investors’ sentiment. An ability to borrow at a
higher rate also means that the economy is strong meaning better values for yen while a low rate points
towards problems in economy meaning lower values of yen.

Question 2b

AR-X - GARCH Model Results

==============================================================================
Dep. Variable: Log_Return R-squared: -0.001

Mean Model: AR-X Adj. R-squared: -0.001

Vol Model: GARCH Log-Likelihood: -6989.36

Distribution: Normal AIC: 13990.7

Method: Maximum Likelihood BIC: 14025.9

No. Observations: 2605

Date: Sun, Jul 14 2024 Df Residuals: 2602

Time: 21:15:42 Df Model: 3

Mean Model

================================================================================

coef std err t P>|t| 95.0% Conf. Int.

--------------------------------------------------------------------------------

Const 0.1419 6.217e-02 2.282 2.247e-02 [2.004e-02, 0.264]

Log_Return[1] 0.0148 2.197e-02 0.676 0.499 [-2.820e-02,5.790e-02]

Rate 0.0425 2.654e-02 1.601 0.109 [-9.520e-03,9.453e-02]

Volatility Model

==========================================================================

coef std err t P>|t| 95.0% Conf. Int.

--------------------------------------------------------------------------

omega 0.3066 0.132 2.317 2.049e-02 [4.728e-02, 0.566]

alpha[1] 0.0828 2.164e-02 3.826 1.302e-04 [4.039e-02, 0.125]

beta[1] 0.8995 2.595e-02 34.658 3.420e-263 [ 0.849, 0.950]

==========================================================================

Covariance estimator: robust

Iteration: 1, Func. Count: 8, Neg. LLF: 19030.610468340252

Iteration: 2, Func. Count: 19, Neg. LLF: 16396.817618723057

Iteration: 3, Func. Count: 29, Neg. LLF: 16166.079676174264

Iteration: 4, Func. Count: 39, Neg. LLF: 297465107.463242


Iteration: 5, Func. Count: 47, Neg. LLF: 7054.800091902354

Iteration: 6, Func. Count: 55, Neg. LLF: 8606.681330145542

Iteration: 7, Func. Count: 64, Neg. LLF: 7019.255395154161

Iteration: 8, Func. Count: 72, Neg. LLF: 6989.439897279936

Iteration: 9, Func. Count: 79, Neg. LLF: 6989.3596886476735

Iteration: 10, Func. Count: 86, Neg. LLF: 6989.358654763657

Iteration: 11, Func. Count: 93, Neg. LLF: 6989.358589389926

Iteration: 12, Func. Count: 99, Neg. LLF: 6989.358589391717

Optimization terminated successfully (Exit mode 0)

Current function value: 6989.358589389926

Iterations: 12

Function evaluations: 99

Gradient evaluations: 12

The specification of the AR-X - GARCH model proved to be sound and the convergence was achieved
with a log likelihood equal to approximately -6989. 36, which means that the fit to the data is
satisfactory for the analyzed variables. In the mean model (AR-X), it is different of zero with positive sign
that indicates the mean return is positive supported by the coefficient of 0 respectively. The year with
most of the response was 1419 with standard error of 0. 06217. However, the lagged log return
(Log_Return[1]) have comparatively very small coefficient value equal to 0. mean was 0148 with a
Standard error of 0. 02197 and a p-value of 0. 499, signifying that there is actually no relationship
between the variables of this study and previous returns. Likewise, when it comes to Rate, which is the
exogenous variable, the Basic Loan Rate, its coefficient is 0. 0425 ± 0. Standard errors again demonstrate
the accuracy in arriving at this number, with the greater the standard error, the less accurate the final
number. respective codes 02654 and a p-value of 0. 109, meaning that there is no evidence of the
influence on returns within the conventional levels of statistical significance.

Moving to the volatility model (GARCH), and Omega which is the mean of the volatilities, it is estimated
to be 0. 3066 with standard error of 0. 132. The ARCH term (Alpha[1]), which is the effect of past
squared residuals on the current volatility, has a coefficient of 0. 0828 with a stand error of 0. 02164,
signifying moderate influence. Surprisingly the GARCH term, Beta[1], present a strong persistence
meaning that there is 0. 8995 and standard error of 0. 02595, it suggested that past volatility is a potent
determinant of current volatility and backed up this analysis by referring to the statistical significance of
the findings. However, concerning the model fit, the R-squared and adjusted R-squared values equal to -
0. 001 both and, therefore, the model explained very little about mean returns. The AIC equals 13990. 7
and the BIC equals 14025. 9 ; the lower these two values are, the better the model fits; however, the
values should not be too low, reflecting a good balance between model fit and model complexity.
In conclusion, the perfect conformity with the AR-X - GARCH model is pointed, which indicates the
presence of a positive average return and high volatility persistence, however the insignificance of
lagged return and Basic Loan Rate effects reveal the model’s shortcomings in reflecting all features of
returns behavior. These findings are significant for profitability and risk calculation in decision-making
processes of investments.

Question 2c

Analyzing the graph of the standardized residuals I obtain the following conclusions. Firstly, it is
apparent from the realizations that there is volatility clustering that is aggregation of high volatility
followed by low. This is evident in graphs and diagrams in the form of big positive and negative
movements in the residuals occurring in sets. Secondly the residuals don’t show signs of any long term
trends, and hence the overall pattern is fairly well captured by the model, but there are bursts of large
residuals which could imply that certain forms of dynamics are not fully captured by the model. Third,
the evaluation against critical VaR lines: upper 10% VaR level represented by green dashed line, and
lower 10% VaR level demonstrated by red dashed line reveals that there are cases when the
standardized residuals are above such levels, especially in the lower extreme. This frequent exceedance
means that the risk of extreme negative events might be underestimated by the model. Broadly, the
model thus identified appears to capture the over-arching residual pattern although there is evidence
that would suggest that the model might be fine-tuned to incorporate high volatility and event risks’
periods.

You might also like