Guest User

Untitled

a guest
Oct 28th, 2016
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.20 KB | None | 0 0
  1. 64.19749
  2. 65.19011
  3. 64.03281
  4. 64.99111
  5. 65.43837
  6. 65.51817
  7. 65.22061
  8. 65.43191
  9. 65.0221
  10. 65.44038
  11. 64.41756
  12. 64.65764
  13. 64.7486
  14. 65.11544
  15. 64.12437
  16. 64.49148
  17. 64.89215
  18. 64.72688
  19. 64.97553
  20. 64.6361
  21. 64.29038
  22. 65.31076
  23. 64.2114
  24. 65.37864
  25. 65.49637
  26. 65.3289
  27. 65.38394
  28. 65.39384
  29. 65.0984
  30. 65.32695
  31. 65.28
  32. 64.31041
  33. 65.20193
  34. 65.78063
  35. 65.17604
  36. 66.16412
  37. 65.85091
  38. 65.46718
  39. 65.75551
  40. 65.39994
  41. 66.36175
  42. 65.37125
  43. 65.77763
  44. 65.48623
  45. 64.62135
  46. 65.77237
  47. 65.84289
  48. 65.80289
  49. 66.78865
  50. 65.56931
  51. 65.29913
  52. 64.85516
  53. 65.56866
  54. 64.75768
  55. 65.95956
  56. 65.64745
  57. 64.77283
  58. 65.64165
  59. 66.64309
  60. 65.84163
  61. 66.2946
  62. 66.10482
  63. 65.72736
  64. 65.56701
  65. 65.11096
  66. 66.0006
  67. 66.71783
  68. 65.35595
  69. 66.44798
  70. 65.74924
  71. 65.4501
  72. 65.97633
  73. 65.32825
  74. 65.7741
  75. 65.76783
  76. 65.88689
  77. 65.88939
  78. 65.16927
  79. 64.95984
  80. 66.02226
  81. 66.79225
  82. 66.75573
  83. 65.74074
  84. 66.14969
  85. 66.15687
  86. 65.81199
  87. 66.13094
  88. 66.13194
  89. 65.82172
  90. 66.14661
  91. 65.32756
  92. 66.3979
  93. 65.84383
  94. 65.55329
  95. 65.68398
  96. 66.42857
  97. 65.82402
  98. 66.01003
  99. 66.25157
  100. 65.82142
  101. 66.08791
  102. 65.78863
  103. 66.2764
  104. 66.00948
  105. 66.26236
  106. 65.40246
  107. 65.40166
  108. 65.37064
  109. 65.73147
  110. 65.32708
  111. 65.84894
  112. 65.82043
  113. 64.91447
  114. 65.81062
  115. 66.42228
  116. 66.0316
  117. 65.35361
  118. 66.46407
  119. 66.41045
  120. 65.81548
  121. 65.06059
  122. 66.25414
  123. 65.69747
  124. 65.15275
  125. 65.50985
  126. 66.66216
  127. 66.88095
  128. 65.81281
  129. 66.15546
  130. 66.40939
  131. 65.94115
  132. 65.98144
  133. 66.13243
  134. 66.89761
  135. 66.95423
  136. 65.63435
  137. 66.05837
  138. 66.71114
  139.  
  140. library(urca)
  141. library(foreign)
  142. library(zoo)
  143.  
  144. tsInv <- as.zoo(ts(as.data.frame(read.table(
  145. "http://www.jmulti.de/download/datasets/US_investment.dat", skip=8, header=TRUE)),
  146. frequency=4, start=1947+2/4))
  147. png("USinvPlot.png", width=6,
  148. height=7, units="in", res=100)
  149. par(mfrow=c(2, 1))
  150. plot(tsInv$USinvestment)
  151. plot(diff(tsInv$USinvestment))
  152. dev.off()
  153.  
  154. # ADF with intercept
  155. adfIntercept <- ur.df(tsInv$USinvestment, lags = 3, type= 'drift')
  156. summary(adfIntercept)
  157.  
  158. # using the (log) consumption series
  159. tsConsump <- zoo(read.dta("http://www.stata-press.com/data/r12/lutkepohl2.dta"), frequency=1)
  160. png("logConsPlot.png", width=6,
  161. height=7, units="in", res=100)
  162. par(mfrow=c(2, 1))
  163. plot(tsConsump$ln_consump)
  164. plot(diff(tsConsump$ln_consump))
  165. dev.off()
  166.  
  167. # ADF with trend
  168. adfTrend <- ur.df(tsConsump$ln_consump, lags = 4, type = 'trend')
  169. summary(adfTrend)
  170.  
  171. # using the given data
  172. tsTemp <- read.table(textConnection("temp
  173. 64.19749
  174. 65.19011
  175. 64.03281
  176. 64.99111
  177. 65.43837
  178. 65.51817
  179. 65.22061
  180. 65.43191
  181. 65.0221
  182. 65.44038
  183. 64.41756
  184. 64.65764
  185. 64.7486
  186. 65.11544
  187. 64.12437
  188. 64.49148
  189. 64.89215
  190. 64.72688
  191. 64.97553
  192. 64.6361
  193. 64.29038
  194. 65.31076
  195. 64.2114
  196. 65.37864
  197. 65.49637
  198. 65.3289
  199. 65.38394
  200. 65.39384
  201. 65.0984
  202. 65.32695
  203. 65.28
  204. 64.31041
  205. 65.20193
  206. 65.78063
  207. 65.17604
  208. 66.16412
  209. 65.85091
  210. 65.46718
  211. 65.75551
  212. 65.39994
  213. 66.36175
  214. 65.37125
  215. 65.77763
  216. 65.48623
  217. 64.62135
  218. 65.77237
  219. 65.84289
  220. 65.80289
  221. 66.78865
  222. 65.56931
  223. 65.29913
  224. 64.85516
  225. 65.56866
  226. 64.75768
  227. 65.95956
  228. 65.64745
  229. 64.77283
  230. 65.64165
  231. 66.64309
  232. 65.84163
  233. 66.2946
  234. 66.10482
  235. 65.72736
  236. 65.56701
  237. 65.11096
  238. 66.0006
  239. 66.71783
  240. 65.35595
  241. 66.44798
  242. 65.74924
  243. 65.4501
  244. 65.97633
  245. 65.32825
  246. 65.7741
  247. 65.76783
  248. 65.88689
  249. 65.88939
  250. 65.16927
  251. 64.95984
  252. 66.02226
  253. 66.79225
  254. 66.75573
  255. 65.74074
  256. 66.14969
  257. 66.15687
  258. 65.81199
  259. 66.13094
  260. 66.13194
  261. 65.82172
  262. 66.14661
  263. 65.32756
  264. 66.3979
  265. 65.84383
  266. 65.55329
  267. 65.68398
  268. 66.42857
  269. 65.82402
  270. 66.01003
  271. 66.25157
  272. 65.82142
  273. 66.08791
  274. 65.78863
  275. 66.2764
  276. 66.00948
  277. 66.26236
  278. 65.40246
  279. 65.40166
  280. 65.37064
  281. 65.73147
  282. 65.32708
  283. 65.84894
  284. 65.82043
  285. 64.91447
  286. 65.81062
  287. 66.42228
  288. 66.0316
  289. 65.35361
  290. 66.46407
  291. 66.41045
  292. 65.81548
  293. 65.06059
  294. 66.25414
  295. 65.69747
  296. 65.15275
  297. 65.50985
  298. 66.66216
  299. 66.88095
  300. 65.81281
  301. 66.15546
  302. 66.40939
  303. 65.94115
  304. 65.98144
  305. 66.13243
  306. 66.89761
  307. 66.95423
  308. 65.63435
  309. 66.05837
  310. 66.71114"), header=T)
  311. tsTemp <- as.zoo(ts(tsTemp, frequency=1))
  312.  
  313. png("tempPlot.png", width=6,
  314. height=7, units="in", res=100)
  315. par(mfrow=c(2, 1))
  316. plot(tsTemp$temp)
  317. plot(diff(tsTemp$temp))
  318. dev.off()
  319.  
  320. # ADF with trend
  321. adfTrend <- ur.df(tsTemp$temp, type = 'trend')
  322. summary(adfTrend)
Add Comment
Please, Sign In to add comment