Login
Order Now
Support
R Studio Task on Time Series

R Studio Task on Time Series

  • 14th Apr, 2022
  • 15:27 PM

##Reading  the data file
library("readxl")
library(forecast)
library(fma)
library(datasets)
library(ggplot2)

mydata=read_excel("C:/Users/Arnav Singh/Downloads/Lynx.xlsx")
summary(mydata)
names(mydata)
head(mydata)

#TimeSeries conversion and plot
my1 <- ts (mydata, start = 1821, frequency = 1)
autoplot(my1)

###############################################
#Exponential smoothing Forecast

###############################################

ses5 = ses(mydata$'Annual Canadian Lynx Trappings',h=25)
ses5
accuracy(ses5)
autoplot(ses5) + autolayer(fitted(ses5),series = "fitted")


####################################################
#Holt's Model
####################################################

holt5 = holt(mydata$'Annual Canadian Lynx Trappings',h=25)
autoplot(holt5) + autolayer(fitted(holt5),series = "fitted")
accuracy(holt5)

##################################################################
#Damped output 
#################################################################

holt5damped = holt(mydata$`Annual Canadian Lynx Trappings`,damped = TRUE,phi = 0.95,h=15)
autoplot(holt5damped) + autolayer(fitted(holt5damped),series = "fitted")
accuracy(holt5damped)
 

Share this post

assignment helpassignment helperassignment expertsassignment writing services