[R] Time series example in Koop

Ravi Kulkarni ravi.kulk at gmail.com
Tue Apr 5 14:35:04 CEST 2011


I am trying to reproduce the output of a time series example in Koop's book
"Analysis of Financial Data". Koop does the example in Excel and I used the
ts function followed by the lm function. 
I am unable to get the exact coefficients that Koop gives - my coefficients
are slightly different.
After loading the data file and attaching the frame, my code reads:

> y = ts(m.cap)
> x = ts(oil.price)
> d = ts.union(y,x,x1=lag(x,-1),x2=lag(x,-2),x3=lag(x,-3),x4=lag(x,-4))
> mod1 = lm(y~x+x1+x2+x3+x4, data=d)
> summary(mod1)

Koop gives an intercept of 92001.51, while the code above gives 91173.32.
The other coefficients are also  slightly off.

This is the example in Table 8.3 of Koop. I also attach a plain text version
of the tab separated file "badnews.txt".
http://r.789695.n4.nabble.com/file/n3427897/badnews.txt badnews.txt 

Any light on why I do not get Koop's coefficients is most welcome...

Ravi

--
View this message in context: http://r.789695.n4.nabble.com/Time-series-example-in-Koop-tp3427897p3427897.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list