i p.values under 5% level.
i tried use tseries package implement kpss test.
> dput(datsel) structure(list(oenb_dependent = c(142.8163942, 143.5711365, 145.3485827, 142.0577145, 139.4326176, 140.1236581, 138.6560282, 136.405036, 133.9337229, 133.8785538, 132.0608441, 130.0866307, 120.1320237, 119.6368882, 114.3312943, 117.5084111, 114.4960017, 112.9124518, 112.8185478, 112.3047916, 106.632639, 106.2107158, 106.8455028, 106.3879556, 104.3451786, 102.9085952, 101.0967783, 101.7858278, 101.0749044, 102.6441976, 102.0666152, 100, 97.14084104, 97.49972913, 96.91453836, 96.05132443, 94.98057971, 92.78373451, 92.67526281, 91.82430571, 91.4153859, 89.51740671, 89.01587176, 84.62259911, 91.48598494, 89.12053042, 90.02364352, 90.92496121, 89.42963565, 91.93886583, 88.83918306, 90.39513509, 87.54571761, 91.3386451, 87.7836994, 91.79178376, 87.56903138, 87.77875755, 89.29938784, 90.88084014), gdp = c(17703.7, 17599.8, 17328.2, 17044, 17078.3, 16872.3, 16619.2, 16502.4, 16332.5, 16268.9, 16094.7, 15956.5, 15785.3, 15587.1, 15460.9, 15238.4, 15230.2, 15057.7, 14888.6, 14681.1, 14566.5, 14384.1, 14340.4, 14383.9, 14549.9, 14843, 14813, 14668.4, 14685.3, 14569.7, 14422.3, 14233.2, 14066.4, 13908.5, 13799.8, 13648.9, 13381.6, 13205.4, 12974.1, 12813.7, 12562.2, 12367.7, 12181.4, 11988.4, 11816.8, 11625.1, 11370.7, 11230.1, 11103.8, 11037.1, 10934.8, 10834.4, 10701.3, 10639.5, 10638.4, 10508.1, 10472.3, 10357.4, 10278.3, 10031), employ = c(71.0619, 70.9383, 71.162, 71.138, 71.2286, 71.5095, 71.565, 71.3246, 71.4963, 71.3738, 71.4276, 71.3065, 71.0246, 71.3244, 71.0619, 70.9811, 71.2149, 70.8342, 70.5568, 70.5444, 70.3286, 70.179, 70.2555, 70.5103, 70.8038, 70.6748, 70.9769, 70.6988, 70.2125, 70.1661, 69.6284, 69.5613, 68.9837, 68.8606, 68.4223, 67.963, 67.6293, 67.5905, 67.1857, 67.1248, 66.7075, 66.5857, 66.4303, 66.2826, 68.7514, 68.8897, 69.0824, 68.9718, 68.7927, 68.6387, 68.8053, 68.7286, 68.4141, 68.2357, 68.4785, 68.4171, 68.4782, 68.3978, 68.5344, 68.4772)), .names = c("oenb_dependent", "gdp", "employ" ), row.names = c(na, -60l), class = "data.frame") > reskpss <- lapply(datsel,function(x){ kpss.test(x,"trend") }) > cv.kpss <- sapply(reskpss, function(x){ x@p.value < 0.05 } ) error in fun(x[[1l]], ...) : trying slot "p.value" object (class "htest") not s4 object however, cannot access p.value object. tried str(reskpss[1]) , got:
list of 1 $ variname1:list of 5 ..$ statistic: named num 0.693 .. ..- attr(*, "names")= chr "kpss trend" ..$ parameter: named num 1 .. ..- attr(*, "names")= chr "truncation lag parameter" ..$ p.value : num 0.01 ..$ method : chr "kpss test trend stationarity" ..$ data.name: chr "x" ..- attr(*, "class")= chr "htest" i tried $ operator, error s4 method.
any suggestions doing wrong?
there's no s4 object here slot from.
reskpss ordinary r list because output lapply. element of list use double-square brackets: reskpss[[1]] , reskpss[[2]] example.
each of list. component of list name use dollar signs - at-sign used parts of s4 class. so:
reskpss[[1]]$p.value [1] 0.01 your sapply needs dollar sign instead of at-sign:
> sapply(reskpss, function(x){ x$p.value < 0.05 } ) oenb_dependent gdp employ true true true
Comments
Post a Comment