This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.

When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:

summary(cars)
##      speed           dist       
##  Min.   : 4.0   Min.   :  2.00  
##  1st Qu.:12.0   1st Qu.: 26.00  
##  Median :15.0   Median : 36.00  
##  Mean   :15.4   Mean   : 42.98  
##  3rd Qu.:19.0   3rd Qu.: 56.00  
##  Max.   :25.0   Max.   :120.00

You can also embed plots, for example:

Note that the echo = FALSE parameter was added to the code chunk to prevent printing of the R code that generated the plot.

```

Note that the echo = FALSE parameter was added to the code chunk to prevent printing of the R code that generated the plot. #import the data on the growth rate of GDP, convert it into time series ts object install.packages(“Quandl”)

library(“Quandl”)

rcpg <- Quandl(“FRED/WCOILBRENTEU”, type=“zoo”)

summary(rcpg)

plot(rcpg)

str(rcpg)

head(rcpg)

tail(rcpg)

transformed data

g=log(rcpg)

Y=diff(g) Y plot(Y) # examine ACF and PACF of the transformed data to determine plausible models to be estimated acf(Y) acf(as.data.frame(Y),type=‘correlation’,lag=24) pacf(Y)

A=arima(Y,order=c(1,0,0),method=“ML”) A str(A) B=arima(Y,order=c(0,0,2),method=“ML”) B str(B)

tsdiag(A,gof.lag=24)

A2 <- arima(Y, order=c(2,0,0))

A2

tsdiag(A2,gof.lag=24)

A3 <- arima(Y, order=c(3,0,0))

A3

tsdiag(A3,gof.lag=24)

A3\(coef/sqrt(diag(A3\)var.coef))

(1-pnorm(abs(A3\(coef)/sqrt(diag(A3\)var.coef))))*2

A4 <- arima(Y, order=c(4,0,0)) A4 m <- ar(Y,method=“mle”)

str(m)

m

m$order

m$aic

BIC(A2)

BIC(A3)

BIC(A4)

A2.LB.lag12 <- Box.test(A2$residuals, lag=12, type=“Ljung”)

str(A2.LB.lag12)

A2.LB.lag12

1-pchisq(A2.LB.lag12$statistic,10)

A2.LB.lag16 <- Box.test(A2$residuals, lag=16, type=“Ljung”)

A2.LB.lag16

1-pchisq(A2.LB.lag16$statistic,14)