Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

okay so now we are up and plotting. Let’s dive into some analysis.

First we want to see if we can use the series so we have to see if its covariance stationary and that means that its mean is constant and also we can’t be able to predict the errors.

we do this by plotting the difference of the terms to get the errors and if we have crazy up and downlines with no distinguishable pattern then we can can fit the errors to a line of some sort. thats a great and beautiful thing.
1. To do this plot type the following
plot.ts(diff(log(GDP)),main=”Logged and Diffed”)

Mission accomplished. We have an up and down picasso beauty.

We can now get fancy and smooth the series with a 2-way moving average.

fGDP(t) = ⅛GDP(t-2) + ¼GDP(t-1) + ¼GDP(t) + ¼GDP(t+1) + ⅛GDP(t+2)

To do this fancy maneuvering type the following:

k=c(.5,1,1,1,.5)
k=k/sum(k)

fGDP=filter(GDP,sides=2,k)
plot(GDP)

lines(fGDP,col=”red”)
lines(lowess(GDP),col=”blue”,lty=”dashed”)

that was beautiful right?
Now to test the normality via plot type in:

dlGDP=diff(log(GDP))
plot(dlGDP)

To do a formal test for normality type in:

shapiro.test(dlGDP)

This is called the Shapiro-Wilk normality test

data:  dlGDP
W = 0.9642, p-value = 5.015e-06

the closer the W is to one the better and with an extremely small p-value we can reject the null hypothesis that the series is not normal and accept the alternative that it is!

Keep dancin’ ladies and gents we have more on the way!

Steven J.