-
Notifications
You must be signed in to change notification settings - Fork 0
fernandosrinesh/Modeling-and-forecasting-inflation-R-Project
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
--- title: "Modeling and forecasting inflation in Sri Lanka using ARIMA models" author: " Srinesh Heshan Fernando" date: "2021/6/4" output: html_document --- ```{r setup, include=FALSE} knitr::opts_chunk$set(echo = TRUE,warning = FALSE) ``` ## INTRODUCTION This study is based on a data set of annual rates of inflation in Sri Lanka (LK) ranging over the period 1960 – 2019. All the data was adapted from the World Bank data sources. # Load the data ```{r cars} library(zoo) library(forecast) library(ggplot2) library(tseries) setwd("C:/Users/wangz/Desktop") md <- read.csv("data.csv",header = TRUE) SL<- md[md$Country.Name == 'Sri Lanka',] CN<- md[md$Country.Name == 'China',] SL <- SL[ , !names(SL) %in% c("Country.Name", "Country.Code","Indicator.Name","Indicator.Code")] SL <-t(SL) rownames(SL) <- c(1960:2020) colnames(SL) <- c("inflation rates") ``` ***Converting data to time series format (TS)*** ```{r cars 1} Sri_Lanka <- ts(SL,start=1960,frequency=1) str(Sri_Lanka) ``` ***View trend chart*** ```{r cars 2} plot.ts(Sri_Lanka) ``` # Stationary The augmented Dickey Fuller (ADF) test can be used to test whether a time series is stationary or not. The Ho is that the sequence is nonstationary. ```{r cars 2.1} adf.test(Sri_Lanka,alternative="stationary") ``` As the p-value is higher than 0.05, so we can not reject the Ho, which means the sequence is nonstationary. #seasonality/ ACF and PACF: ```{r cars 2.5} tsdisplay(Sri_Lanka,xlab="year",ylab="inflation rates index") ``` #differential processing First do log smoothing, and then do differential processing: ```{r cars 3} Srilog <- log(Sri_Lanka) Sridiff <- diff(Srilog, differences=1) plot.ts(Sridiff) ``` ***Check the ACF and PACF *** ```{r cars 4} ``` ```{r cars 5} ``` ```{r cars 6} ```
About
Modeling and forecasting inflation in Sri Lanka using ARIMA models
Topics
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published