Time Series - Canadian Wheat
A. Introduction
Canada is a major wheat producing nation. Wheat crops contribute $11B annually to Canadaβs
economy. However, Canadian wheat crops are impacted by changing climate conditions, as well
as diseases and pests, resulting in a continued need to produce increasingly productive and
resilient varieties of high-quality wheat. Therefore, I decided to examine the price of extra
Canadian Wheat over time for my Time Series project.
B. Data
I obtained my data from the Index Mundi website at
http://www.indexmundi.com/commodities/?commodity=canadian-wheat&months=120
The data I collected is from February 2004 to March 2012. This data contains Canadian Wheat
Monthly Price in US Dollars per Metric Ton.
Canadian Wheat Monthly Price - US Dollars per Metric Ton
800
600
500
400
300
200
100
2/1/2012
10/1/2011
6/1/2011
2/1/2011
10/1/2010
6/1/2010
2/1/2010
10/1/2009
6/1/2009
2/1/2009
10/1/2008
6/1/2008
2/1/2008
10/1/2007
6/1/2007
2/1/2007
10/1/2006
6/1/2006
2/1/2006
10/1/2005
6/1/2005
2/1/2005
10/1/2004
6/1/2004
0
2/1/2004
US DOLLARS PER METRIC TON
700
The prices range from $164.26 to $732.42. From the graph, you see the price reaches a
maximum peak in February 2008 and then returns to the usual price.
C. Seasonality
To check further for seasonality, I graphed each of the years by month to observe any monthly
trends in the graph below. It does not appear to be any seasonal trends that will require
adjustments to the data.
Canadian Wheat Monthly Price by Years - US Dollars per Metric
Ton
US DOLLARS PER METRIC TON
800
700
600
500
400
300
200
100
0
Jan
2004
Fev
Mars
2005
April
2006
May
2007
Jun
Jull
2008
Aug
2009
Sept
2010
Nov
Oct
2011
Dec
2012
D. Analysis
a. Autocorrelation and Partial Autocorrelation
I. Autocorrelation
We define the autocorrelation at
The autocorrelation function drops to zero at the lag 17. It shows that the price of Canadian
Wheat is stationary. According to the graph below, the autocorrelation shows a decreasing trend
that is not significant at lag 12. For the first difference, the autocorrelations become not
significant at lag 2. For the second and third differences, the autocorrelations become not
significant at lag 2 and 3 respectively and after that they become significant at lag 8 for both
differences. Thus, the series could be represented by an AR(1) or AR(2) process.
II.
Partial Autocorrelation
We define the partial autocorrelation at
The Partial Autocorrelation graph here shows that the volatility in the beginning is high. But for
the first diffence, there is no volatility and no significant πππ . This confirms that the models
AR(1) or AR(2) process are the best choices to present this series.
b. Selection of Model
i. Regression Model AR(1)
The general form of the model is
ππ‘ = πΌ + π½1 ππ‘β1 + ππ‘
πΆ
π·π
Estimate
17.15413
0.94972
R-squared
0.9083
Std. Error
10.01035
0.03095
Adjusted Rsquared
0.9074
t value
1.714
30.685
AIC
962.0182
Pr(>|t|)
0.0899
<2e-16
BIC
969.7423
The result of the equation is ππ‘ = 17.15413 + 0.94972ππ‘β1 . The R2 and adjusted R2 values are
fairly high, so this is a very good model when we look at the graph. Significance value of F is
close to zero and it indicates that regression is significant. The AR(1) is almost a perfect fit.
ii.
Regression Model AR(2)
The general form of the model is
ππ‘ = πΌ + π½1 ππ‘β1 + π½2 ππ‘β2 + ππ‘
Estimate
19.3885
1.1093
-0.1678
πΆ
π·π
π·π
R-squared
0.91
Std. Error
10.1273
0.1022
0.1019
Adjusted Rsquared
0.908
t value
1.914
10.854
-1.646
AIC
952.3478
Pr(>|t|)
0.0586
<2e-16
0.103
BIC
962.6052
The equation is ππ‘ = 19.3885 + 1.1093ππ‘β1 β 0.1678ππ‘β2 . The R-squared and adjusted Rsquared values are a little bit higher than AR (1) model and also the AIC and BIC is lower than
AR (1). Significance value of F is close to zero and it indicates that regression is significant.
Also, the coefficients respect the rules of AR (2) stationarity.
The graph above shows the predicted values versus the real prices for the AR (2) model. It is also
a good fit, but it is not as good as AR (1).
E. Conclusion
Based on the analysis, AR (1) model, ππ‘ = 17.15413 + 0.94972ππ‘β1 ,provides a great
prediction of the Canadian Wheat price. The model has proven to provide a very close result
when compared to the real prices.
F. R Code
data = read.table("clipboard",header = TRUE)
Price = data$Price
plot(Price,xlab="Index",ylab="US Dollars per Metric Ton",
main="Canadian Wheat Monthly Price - US Dollars per Metric
Ton",type="o",col='gray',pch=21,bg="orange")
par(mfrow=c(3,1))
plot(diff(ts((Price)),1),type='o',main="First difference",pch=21,bg="blue")
plot(diff(ts((Price)),2),type='o',main="Seconde difference",pch=21,bg="blue")
plot(diff(ts((Price)),3),type='o',main="Third difference",pch=21,bg="blue")
par(mfrow=c(2,2))
acf(ts(Price),main="Autocorrelation",col="red")
acf(diff(ts(Price),1),main="Autocorrelation first difference",col="red")
acf(diff(ts((Price)),2),main="Autocorrelation seconde difference",col="red")
acf(diff(ts((Price)),3),main="Autocorrelation third difference",col="red")
par(mfrow=c(2,2))
acf(ts(Price),type='p',main="Partial Autocorrelation",col="green3")
acf(diff(ts(Price),1),type='p',main="Partial Autocorrelation First Difference",col="green3")
acf(diff(ts((Price)),2),type='p',main="Partial Autocorrelation Seconde Difference",col="green3")
acf(diff(ts((Price)),3),type='p',main="Partial Autocorrelation Third Difference",col="green3")
y <- ts(Price)
x1 <- zlag(ts((Price)),1)
x2 <- zlag(ts((Price)),2)
x3 <- zlag(ts((Price)),3)
modelreg1 <- lm(y~x1)
modelreg2 <- lm(y~x1+x2)
modelreg3 <- lm(y~x1+x2+x3)
summary(modelreg1)
summary(modelreg2)
summary(modelreg3)
BIC(modelreg1,modelreg2,modelreg3)
AIC(modelreg1,modelreg2,modelreg3)
library("car")
durbinWatsonTest(modelreg1)
Box.test(ts(Price), lag =10 , type = c("Box-Pierce"))
Box.test(ts(Price), lag =10 , type = c("Ljung-Box"))
par(mfrow=c(1,1))
plot(ts(Price),ylab="US Dollars per Metric Ton",xlab="Index",type="o",main="Canadian Wheat
Monthly Price",
pch=21,bg="blue",col="gray")
lines(fitted(modelreg1),type="o",pch=21,bg="orange")
legend(0,700,legend=c("US Dollars per Metric Ton","Fitted regression model AR(1)"),
pch=c(21,21),bg="wheat1",pt.bg=c("blue","orange"),
col=c("blue","orange"))
plot(ts(Price),ylab="US Dollars per Metric Ton",xlab="Index",type="o",main="Canadian Wheat
Monthly Price",
pch=21,bg="orange",col="gray")
lines(fitted(modelreg2),type="o",pch=21,bg="green")
legend(0,700,legend=c("US Dollars per Metric Ton","Fitted regression model AR(2)"),
pch=c(21,21),bg="wheat1",pt.bg=c("orange","green"),col=c("orange","green"))
plot(ts(Price),ylab="US Dollars per Metric Ton",xlab="Index",type="o",main="Canadian Wheat
Monthly Price",
pch=21,bg="orange",col="gray")
lines(fitted(modelreg3),type="o",pch=21,bg="red")
legend(0,700,legend=c("US Dollars per Metric Ton","Fitted regression model AR(3)"),
pch=c(21,21),bg="wheat1",pt.bg=c("orange","red"),
col=c("orange","red"))
© Copyright 2026 Paperzz