Тест KPSS возвращает NA - PullRequest
       8

Тест KPSS возвращает NA

1 голос
/ 27 января 2020

Этот тест KPSS

urkpssTest(Total_TimeSeries, type = c("tau"), lags = c("short"),use.lag = NULL, doplot = TRUE)

возвращает:

Title:
 KPSS Unit Root Test

Test Results:
  NA

Description:
 Mon Jan 27 19:07:48 2020 by user: Dorian

И Total_TimeSeries - временной ряд с 2010 по 2020 год: enter image description here

Редактировать:

dput(Total_TimeSeries)
structure(c(54.565998, 51.842636, 51.931438, 50.598824, 48.574871, 
50.345829, 53.552467, 49.434525, 53.437279, 52.761509, 53.956108, 
51.889263, 48.825638, 52.035145, 54.832932, 59.555943, 58.029816, 
60.351376, 55.363148, 55.445427, 57.237236, 52.047546, 51.145355, 
52.381363, 49.218082, 50.348812, 49.609833, 47.011604, 45.711575, 
44.508175, 43.559517, 45.339302, 44.359692, 43.133011, 42.748051, 
43.252781, 43.034451, 40.239799, 40.307343, 39.701355, 39.742962, 
40.034271, 39.463467, 39.808048, 41.637642, 36.707565, 36.133751, 
35.818573, 35.807354, 39.392067, 38.420208, 35.062462, 36.387794, 
38.654194, 38.053482, 39.075058, 41.868896, 37.897301, 40.926952, 
39.309097, 38.524506, 41.857777, 45.063141, 47.914803, 49.037395, 
47.951973, 53.676476, 51.022629, 52.337696, 47.599995, 47.092079, 
41.483109, 43.845032, 43.165207, 43.780632, 40.871666, 39.0299, 
37.435116, 33.850685, 34.650036, 34.921112, 32.826305, 34.222004, 
37.143398, 35.045361, 33.79879, 33.960514, 33.297249, 33.137741, 
30.539099, 29.384655, 28.155655, 31.450399, 32.970413, 36.162968, 
34.163601, 32.473633, 32.873924, 33.229721, 27.397377, 30.626112, 
33.767406, 36.121822, 34.969234, 39.001106, 37.021599, 37.221977, 
35.685745, 32.473591, 28.909643, 32.294392, 30.587198, 27.652954, 
30.012209, 26.461485, 26.95772, 31.438154, 33.542507, 32.178139, 
33.293926), .Tsp = c(2010, 2019.91666666667, 12), class = "ts")

Поэтому у меня следующий вопрос: как мне интерпретировать это NA Результат?

1 Ответ

1 голос
/ 27 января 2020

Вот решение вашей проблемы NA.
Сначала установите пакет urca, используя install.packages("urca").
Затем используйте следующий код:

library(fUnitRoots)

my_urkpssTest <- function (x, type, lags, use.lag, doplot) {
    x <- as.vector(x)
    urca <- urca::ur.kpss(x, type = type[1], lags = lags[1], use.lag = use.lag)
    output = capture.output(urca::summary(urca))[-(1:4)]
    output = output[-length(output)]
    for (i in 1:length(output)) output[i] = paste(" ", output[i])
    ans = list(name = "ur.kpss", test = urca, output = output)
    if (doplot) 
        plot(urca)
    new("fHTEST", call = match.call(), data = list(x = x), 
        test = ans, title = "KPSS Unit Root Test", description = description())
}

my_urkpssTest(Total_TimeSeries, type = c("tau"), lags = c("long"),
           use.lag = NULL, doplot = TRUE)

Выходные данные is:

Title: KPSS Unit Root Test

Test Results:
  Test is of type: tau with 12 lags. 
  Value of test-statistic is: 0.0614 

  Critical value for a significance level of: 
                  10pct  5pct 2.5pct  1pct
  critical values 0.119 0.146  0.176 0.216

Проблема связана с функцией summary внутри команды urkpssTest.
Я изменил код urkpssTest setting urca::summary.

...