Practical Test 1
Practical Test 1
R
2024-01-31
# 2140818 Vansh Sharma
# Practical Test
library(readxl)
data1<- read_excel("AXISBANK.xlsx")
View(data1)
library(astsa)
library(tseries)
library(forecast)
##
## Attaching package: 'forecast'
#Q1)Comment on the structure of the data based on the time series components.
summary(data1)
## Mean : 585.76
## Max. :2023.35
##
## 1st Qu.: 230.97 1st Qu.: 231.12 1st Qu.: 284217 1st Qu.:5.869e+12
## 3rd Qu.: 877.31 3rd Qu.: 875.81 3rd Qu.: 5515245 3rd Qu.:3.457e+14
##
class(data1)
ts.plot(data1$Close)
data3=ts(data1$Close,start = 2000,end=2021,frequency=1)
class(data3)
## [1] "ts"
ts.plot(data3)
acf(data3)
#Q2)Discuss the mathematical model for the chosen data sets. Is the data
stationary in nature? Comment.
#Q3)Calculate the moving average of order 3 and 5 and comment on the same.
ma3<-ma(data3,order=3)
ma5<-ma(data3,order=5)
## Series: data3
## ARIMA(1,2,0)
##
## Coefficients:
## ar1
## -0.6605
## s.e. 0.1551
##
## sigma^2 = 1.026: log likelihood = -28.41
## AIC=60.82 AICc=61.53 BIC=62.81
##
## Training set error measures:
## ME RMSE MAE MPE MAPE MASE
## Training set 0.197092 0.9414755 0.7222051 0.6679452 2.815029 0.6651889
## ACF1
## Training set -0.1468044
## Point Forecast Lo 80 Hi 80 Lo 95 Hi 95
## 2022 39.51790 38.21959 40.81621 37.53230 41.50350
## 2023 42.22305 40.05279 44.39332 38.90392 45.54219
## 2024 44.87057 41.37028 48.37087 39.51734 50.22381
## 2025 47.55616 42.69077 52.42155 40.11519 54.99713
## 2026 50.21661 43.75012 56.68309 40.32697 60.10624