cattle <- read.csv('Livestock.csv')
cattle_ts <- ts(cattle$Cattle,
start = c(2000,1),
end = c(2022,4),
frequency = 4)
plot(cattle_ts,
type="o",
xlab="Year",
ylab="Cattle Production",
main="Quarterly Cattle Production: 2000-2022")
The plot has a seasonal and downward trend time series component. At a
certain length of the time series there has been an observed seasonality
and the direction of the trend goes down most of the time.
cattle.lag1a <- dplyr::lag(cattle$Cattle,n=1)
cattle.lag2a <- dplyr::lag(cattle$Cattle,n=2)
cattle1a <- cbind(cattle$Cattle, cattle.lag1a, cattle.lag2a)
plot.ts(cbind(cattle_ts,cattle.lag1a,cattle.lag2a),
plot.type="single",
col=c("black", "red", "blue"))
It can be observed that the data point of the original time series has
an influence to the later points of time. This will result to having a
predicted value from the past values.
cattle1<-diff(cattle_ts,lag=1)
cattle2<-diff(cattle1,lag=1)
plot.ts(cbind(cattle1,cattle2),
plot.type="single",
col=c("black", "red"))
It can be observed that there is a transformation of the series and this
will result to the removal of the seasonality and trend.
cattlema3<-ma(cattle_ts,order=3)
cattlema5<-ma(cattle_ts,order=5)
plot.ts(cbind(cattle_ts,cattlema3,cattlema5),
plot.type = 'single',
col=c('black', 'red', 'blue'))
It can be observed that by having the moving averages, it will eliminate
variations from the original plot which emphasizes a smoother plot.
hog <- read.csv('Livestock.csv')
hog_ts <- ts(hog$Hog,
start = c(2000,1),
end = c(2022,4),
frequency = 4)
plot(hog_ts,
type="o",
xlab="Year",
ylab="Hog Production",
main="Quarterly Hog Production: 2000-2022")
There is a repeated variation in the series from the plot above which
makes it a seasonalistic time series. It can also be seen that there is
a downward trend. And the seasonal pattern from the plot are observed at
every quarter of the year.
hog.lag1a <- dplyr::lag(hog$Hog,n=1)
hog.lag2a <- dplyr::lag(hog$Hog,n=2)
hog1a <- cbind(hog$Hog, hog.lag1a, hog.lag2a)
plot.ts(cbind(hog_ts,hog.lag1a,hog.lag2a),
plot.type="single",
col=c("black", "red", "blue"))
It can be observed that the data point of the original time series has
an influence to the later points of time. This will result to having a
predicted value from the past values.
hog1<-diff(hog_ts,lag=1)
hog2<-diff(hog1,lag=1)
plot.ts(cbind(hog1,hog2),
plot.type="single",
col=c("black", "red"))
It can be observed that there is a transformation of the series and this
will result to the removal of the seasonality and trend.
hogma3<-ma(hog_ts,order=3)
hogma5<-ma(hog_ts,order=5)
plot.ts(cbind(hog_ts,hogma3,hogma5),
plot.type = 'single',
col=c('black', 'red', 'blue'))
It can be observed that by having the moving averages, it eliminated
variations from the original plot which emphasizes a smoother plot.
goat <- read.csv('Livestock.csv')
goat_ts <- ts(goat$Goat,
start = c(2000,1),
end = c(2022,4),
frequency = 4)
plot(goat_ts,
type="o",
xlab="Year",
ylab="Goat Production",
main="Quarterly Goat Production: 2000-2022")
There is a sequence of repeated events from the plot above which makes
it a cyclistic time series.
goat.lag1a <- dplyr::lag(goat$Goat,n=1)
goat.lag2a <- dplyr::lag(goat$Goat,n=2)
goat1a <- cbind(goat$Goat, goat.lag1a, goat.lag2a)
plot.ts(cbind(goat_ts,goat.lag1a,goat.lag2a),
plot.type="single",
col=c("black", "red", "blue"))
It can be observed that the data point of the original time series has
an influence to the later points of time. This will result to having a
predicted value from the past values.
goat1<-diff(goat_ts,lag=1)
goat2<-diff(goat1,lag=1)
plot.ts(cbind(goat1,goat2),
plot.type="single",
col=c("black", "red"))
It can be observed that there is a transformation of the series and this
resulted to the removal of the cycle.
goatma3<-ma(goat_ts,order=3)
goatma5<-ma(goat_ts,order=5)
plot.ts(cbind(goat_ts,goatma3,goatma5),
plot.type = 'single',
col=c('black', 'red', 'blue'))
It can be observed that by having the moving averages, it eliminated
variations from the original plot which emphasizes a smoother plot.