Advertisement
Guest User

Untitled

a guest
Feb 20th, 2017
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
R 0.91 KB | None | 0 0
  1. #Question 2
  2.  
  3. #part a
  4.  
  5. #Question 1
  6. data1 = read.table("TPdata.txt",header=TRUE)
  7. time = ts(data1$YER, frequency=4, start=c(1970,1))
  8.  
  9. #Part a
  10.  
  11. LYER <- log(data1$YER)
  12. DLYER <- diff(LYER)
  13. LPCR <- log(data1$PCR)
  14. DLPCR <- diff(LPCR)
  15. plot(DLYER, type="l") #YES
  16. plot(DLPCR, type="l") #YES
  17.  
  18. #Part b
  19.  
  20. time2 = ts(LYER, frequency=4, start=c(1970,1))
  21. time3 = ts(LPCR, frequency=4, start=c(1970,1))
  22. time2
  23. time3
  24. library(urca)
  25. adf2 = ur.df(time2, type="drift", selectlags="BIC")
  26. summary(adf2) # -1.66 and test stat: -2.88. unit root at 1% sign level for LYER
  27. adf3 = ur.df(time3, type="drift", selectlags="BIC")
  28. summary(adf3) # -3.5787 and test stat: -2.88.(reject) no unit root at 1% sign levelfor LPCR
  29.  
  30.  
  31. # Part c
  32. reg= lm(LPCR~LYER)
  33. summary(reg)
  34. e = reg$residuals
  35. adf4 = ur.df(e, type="drift", selectlags="BIC")
  36. summary(adf4) # -2.7343 and test statistic -2.88. no cointegration (reject) the nul at 10% sing level
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement