R中多个时间序列数据帧的增广Dickey-Fuller测试/单位根测试

时间:2015-12-30 10:11:47

标签: r time-series

我有一个数据集/数据框,我在其中计算了五千家公司的每日日志回报,这些公司也是列。我想在这个数据帧上进行ADF测试。我已经找到了如何估计矢量上的ADF测试,但无法找到如何在数据帧或矩阵结构上计算它。另外,在估算公司的ADF测试时,如何省略日期栏。

structure(list(Price.Date..1. = structure(c(10961, 10962, 10963, 
10966, 10967, 10968, 10969, 10970, 10973, 10974, 10975, 10976, 
10977, 10980, 10981, 10982, 10983, 10984, 10987, 10988, 10989, 
10990, 10991, 10994, 10995, 10996, 10997, 10998, 11001, 11002, 
11003, 11004, 11005, 11008, 11009, 11010, 11011, 11012, 11015, 
11016, 11017, 11018, 11019, 11022, 11023, 11024, 11025, 11026, 
11029, 11030, 11031, 11032, 11033, 11036, 11037, 11038, 11039, 
11040, 11043, 11044, 11045, 11046, 11047, 11050, 11051, 11052, 
11053, 11054, 11057, 11058, 11059, 11060, 11061, 11064, 11065, 
11066, 11067, 11072, 11073, 11074, 11075, 11079, 11080, 11081, 
11082, 11085, 11086, 11087, 11088, 11089, 11092, 11093, 11094, 
11095, 11096, 11099, 11100, 11101, 11102, 11103), class = "Date"), 
    A.G.L.SJ.INVS...LON..DEAD...13.08.15...S. = c(0, 0, 0, 0, 
    0, 0, 0, 0, 0.172842812839411, 0.0105264129869873, -0.0105264129869873, 
    0.0312525435041042, 0, 0, 0, 0, 0, -0.0103093696588612, 0, 
    0.0505157901369016, 0.154854162093344, -0.0127390257774298, 
    0, 0, 0, 0, -0.0215991118034617, 0, -0.0310446216819606, 
    0, 0, 0, 0, 0.00896866998276025, -0.00896866998276025, 0.0695932917991957, 
    0.0491902441907719, 0, 0, 0, 0.0237165266173154, -0.0645385211375711, 
    0, 0.00829880281469553, -0.0208775850215552, -0.0475251418628453, 
    0, 0, -0.0406376457318265, -0.0233110788684474, -0.00947874395454384, 
    0, 0, 0, 0, 0, -0.0588405000229333, 0, 0, -0.0101523714640175, 
    0, 0, -0.119059360015989, -0.0115608224010764, -0.0537442760066904, 
    0, 0, 0, -0.0185763855729357, 0, 0, 0, -0.0125787822068597, 
    -0.0997504027670599, 0, 0, 0, 0, -0.0212022076506022, 0, 
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -0.0143887374520997, 
    -0.0597192347016229, 0, 0, -0.0553500950831642, 0), ABACUS.GROUP.DEAD...18.02.09...S. = c(-0.00772204609391025, 
    0.0153849188394792, 0, 0, 0, 0.0121397545506108, 0.00751318335078377, 
    0, 0.0467921615067581, 0.00427655676726069, 0.00284091100160389, 
    0, 0, 0, 0, 0, -0.00284091100160389, -0.00427655676726069, 
    0, 0, 0, 0, 0, -0.0974553361507127, -0.0126784582597708, 
    -0.00319489089651892, 0.0190180058357612, 0.0248074737042678, 
    0.0331355615960991, -0.00148257996022316, 0, -0.00744605078407812, 
    0, -0.00599701947237463, -0.00301205046999176, 0.00301205046999176, 
    0, 0.0527208463787359, 0, 0, 0.0554927382614965, 0.0147356986537535, 
    0, 0, -0.0255906220631887, -0.0109740470319766, 0.0204785313435405, 
    0.0266682470821618, 0.00655740054615883, 0, -0.013158084577511, 
    -0.0405460943943501, -0.00692044284457349, 0, -0.0210534091978323, 
    -0.00426439878645812, 0.136908873392753, 0.00371978110253224, 
    0, 0, -0.0012383902511468, -0.046933153422219, -0.00390371348047402, 
    -0.0065402456806094, -0.00922880643762181, -0.0200675630508096, 
    0.00269905696916517, 0.0147159846325131, 0.00265252144913131, 
    0.00264550418842369, 0, 0, -0.00662692948760846, -0.0504537812558326, 
    0.0138891121606672, 0.0204785313435405, 0, 0, 0, 0, 0, 0, 
    0.0067340321813445, 0.0133335308694651, 0.00264550418842369, 
    0.00658330224919812, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.054895721731917, 
    -0.00873367996875452, 0, -0.0012539186595939), ABB.R..IRS....S. = c(NA_real_, 
    NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, 
    NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, 
    NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, 
    NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, 
    NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, 
    NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, 
    NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, 
    NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, 
    NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, 
    NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, 
    NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, 
    NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, 
    NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, 
    NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, 
    NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, 
    NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, 
    NA_real_, NA_real_, NA_real_), ABBEY.NATIONAL.DEAD...T.O.SEE.702853...S. = c(-0.0167894814765495, 
    0.00738010729762184, -0.0116218952059857, 0.00529942946649875, 
    -0.0632708260597079, -0.0204785313435405, -0.0197336641569503, 
    -0.0225261451329324, -0.0428724565924723, -0.0369704309185455, 
    -0.00913248356327223, -0.0442134971420201, 0.0468312996840989, 
    -0.0291797891087766, -0.00810815252842279, 0.052852458178311, 
    0.0291713773002797, -0.038221212820198, -0.0303253297149118, 
    -0.0382038274117704, 0.00554786443771782, 0.0123712918025465, 
    -0.0840351843165834, -0.00297619267304583, -0.0089820963158278, 
    -0.0151518050206025, 0.0433226819872985, -0.0433226819872985, 
    -0.032586281198026, 0.0202973400636752, 0.0289433760394884, 
    0.0681917498739066, 0.0180685944104999, -0.0166670524852117, 
    -0.0893058330631531, 0.00762780204888625, -0.0184054275427155, 
    -0.0203290816384261, 0.0187798946515967, 0.0974221130074682, 
    0, -0.0416427719597783, 0.00584796988242253, -0.0554449110217945, 
    -0.00773399059973645, 0.00155159069141853, 0.00618239990831793, 
    -0.0186630611319272, -0.0238295628329839, 0.0501672587180195, 
    0.0404549546923132, 0.104479070030021, -0.00663572441539895, 
    0.00464962644376943, -0.0120001440031103, 0.0649157135730478, 
    -0.0293388390059404, 0.0729977860835476, 0.00420294824644163, 
    0.0370521654605449, 0.00403342523190275, -0.0495092265431198, 
    -0.00302572091653719, 0.0386377927054138, 0.0902616769864686, 
    -0.0792438792460217, -0.0532985817243619, -0.0184167267862305, 
    -0.00621506040343434, 0.00435459475051392, -0.0302480527554971, 
    -0.0154741965825975, -0.0250013022054176, -0.0161185491020817, 
    -0.00747540008478342, 0.00544219030268511, 0.00135593241113607, 
    0.0559909153550144, -0.0122463663921577, -0.0471378335218366, 
    -0.00545331958131356, 0.0395361374015071, -0.0239373131439269, 
    0.0421669846355881, -0.034124045836128, 0.0347689990993745, 
    0.0279738520424058, -0.0157981168765913, 0.0424003660706616, 
    0.0121360712822254, 0.0244277859766919, 0.0375441148948044, 
    -0.0698435733672644, 0.00847462699097257, -0.0551393918480914, 
    0.0362766482201318, 0.0266682470821618, 0.0312065358208127, 
    0.0274459766087478, -0.000564174909181148), ABBEY.PROTECTION.DEAD...20.01.14...S. = c(NA_real_, 
    NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, 
    NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, 
    NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, 
    NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, 
    NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, 
    NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, 
    NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, 
    NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, 
    NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, 
    NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, 
    NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, 
    NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, 
    NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, 
    NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, 
    NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, 
    NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, 
    NA_real_, NA_real_, NA_real_), ABBEYCREST.DEAD...10.10.14...S. = c(0, 
    0, 0.0326559629740526, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -0.01619468591998, 
    0, 0, 0, 0, 0, 0, 0, 0, -0.0164612770540726, 0, 0, 0, 0, 
    0, 0, 0, -0.00833338155914376, -0.00840341079637952, 0, -0.00847462699097257, 
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -0.00854706057845789, 
    -0.00862074304390781, 0, 0, 0.0340458414097178, -0.00840341079637952, 
    0, 0, -0.00847462699097257, -0.00854706057845789, 0, 0, -0.00862074304390781, 
    0, 0, 0, 0, 0, 0, 0, -0.0130720815673522, 0, 0, 0, -0.0221738574943222, 
    0, 0.00892863074430128, 0, 0, 0, -0.00892863074430128, 0, 
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.00892863074430128, 
    0, 0, 0, 0, 0, 0), ABBOT.GROUP.DEAD...07.03.08...S. = c(-0.00470589103741315, 
    0.0550597771830272, 0.0393924017106615, 0.02542509836581, 
    0.0124741742251757, 0, 0, -0.0208775850215552, 0, -0.00847462699097257, 
    -0.0302398851897179, -0.0221738574943222, 0, 0.0265502320941211, 
    -0.00877198607283702, -0.0088496152769828, -0.00892863074430128, 
    0, 0, 0, 0, -0.02267670867103, 0, 0, 0, 0, 0, -0.0138570346614264, 
    -0.0140517534556501, -0.0190481949706944, -0.00966191091173663, 
    -0.00975617494536518, -0.0198026272961789, -0.0943106794712421, 
    0.0163491380015302, 0, 0, 0, 0, 0, -0.0218587938124992, 0.0218587938124992, 
    0.0779615414697119, 0.00995033085316788, 0, -0.0200006667066699, 
    0, 0.010050335853502, 0.00995033085316788, 0.0530244683082204, 
    -0.038282186571017, 0, 0, 0, 0, -0.0147422817372034, 0, 0, 
    0, 0, 0, -0.00496278934212935, -0.00498754151103853, -0.0151136378100487, 
    0, -0.0153455696746603, -0.0208340869028421, 0, -0.0105821093305369, 
    0, 0.0262482260749364, -0.0104167608582557, 0, -0.037337670437644, 
    0.0215062052209634, 0.0210534091978323, 0, 0, 0, 0, 0.025708356710207, 
    0, 0.03980625040042, 0, 0, -0.0098040000966213, 0, -0.0557106070140057, 
    -0.0104712998672953, -0.0159154553058993, 0, 0.0315815720502988, 
    0, 0.0103093696588612, -0.00514139950041859, 0, 0, -0.0208340869028421, 
    0.0156661167443994, -0.0104167608582557), ABBOTT.LABS.GBP..LON..DEAD...DEAD...S. = c(NA_real_, 
    NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, 
    NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, 
    NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, 
    NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, 
    NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, 
    NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, 
    NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, 
    NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, 
    NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, 
    NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, 
    NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, 
    NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, 
    NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, 
    NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, 
    NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, 
    NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, 
    NA_real_, NA_real_, NA_real_), ABERDEEN.ASSET.MAN..FULLY.PAID.23.09.05...S. = c(NA_real_, 
    NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, 
    NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, 
    NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, 
    NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, 
    NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, 
    NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, 
    NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, 
    NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, 
    NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, 
    NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, 
    NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, 
    NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, 
    NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, 
    NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, 
    NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, 
    NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, 
    NA_real_, NA_real_, NA_real_)), .Names = c("Price.Date..1.", 
"A.G.L.SJ.INVS...LON..DEAD...13.08.15...S.", "ABACUS.GROUP.DEAD...18.02.09...S.", 
"ABB.R..IRS....S.", "ABBEY.NATIONAL.DEAD...T.O.SEE.702853...S.", 
"ABBEY.PROTECTION.DEAD...20.01.14...S.", "ABBEYCREST.DEAD...10.10.14...S.", 
"ABBOT.GROUP.DEAD...07.03.08...S.", "ABBOTT.LABS.GBP..LON..DEAD...DEAD...S.", 
"ABERDEEN.ASSET.MAN..FULLY.PAID.23.09.05...S."), row.names = c("4", 
"5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", 
"16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", 
"27", "28", "29", "30", "31", "32", "33", "34", "35", "36", "37", 
"38", "39", "40", "41", "42", "43", "44", "45", "46", "47", "48", 
"49", "50", "51", "52", "53", "54", "55", "56", "57", "58", "59", 
"60", "61", "62", "63", "64", "65", "66", "67", "68", "69", "70", 
"71", "72", "73", "74", "75", "76", "77", "78", "79", "80", "83", 
"84", "85", "86", "88", "89", "90", "91", "92", "93", "94", "95", 
"96", "97", "98", "99", "100", "101", "102", "103", "104", "105", 
"106"), class = "data.frame")

1 个答案:

答案 0 :(得分:2)

您可以使用apply为每列运行一个测试。 在this link,您可以找到apply的说明。 如果" date"是data.frame df的第一列,然后df[,-1]是没有" date"的data.frame柱:

library(tseries)

#----------------------------------------------------------------
# example data:

set.seed(1)
X <- matrix(NA,300,5)

for ( i in 1:ncol(X))
{
  X[,i] <- sample(-100:100,nrow(X),replace=TRUE) / 1000
}

df <- cbind( date = as.Date("2015-01-01") + (1:nrow(X))*as.difftime(1,units="days"),
             as.data.frame(X) )

#----------------------------------------------------------------

a = "stationary"
lagOrder = trunc((nrow(df)-1)^(1/3))

Test <- apply(df[,-1],2,adf.test, alternative=a, k=lagOrder )

结果:

> Test <- apply(df[,-1],2,adf.test, alternative=a, k=lagOrder )
Warning messages:
1: In FUN(newX[, i], ...) : p-value smaller than printed p-value
2: In FUN(newX[, i], ...) : p-value smaller than printed p-value
3: In FUN(newX[, i], ...) : p-value smaller than printed p-value
4: In FUN(newX[, i], ...) : p-value smaller than printed p-value
5: In FUN(newX[, i], ...) : p-value smaller than printed p-value
> Test
$V1

    Augmented Dickey-Fuller Test

data:  newX[, i]
Dickey-Fuller = -6.9796, Lag order = 6, p-value = 0.01
alternative hypothesis: stationary


$V2

    Augmented Dickey-Fuller Test

data:  newX[, i]
Dickey-Fuller = -6.6985, Lag order = 6, p-value = 0.01
alternative hypothesis: stationary


$V3

    Augmented Dickey-Fuller Test

data:  newX[, i]
Dickey-Fuller = -6.5085, Lag order = 6, p-value = 0.01
alternative hypothesis: stationary


$V4

    Augmented Dickey-Fuller Test

data:  newX[, i]
Dickey-Fuller = -6.9839, Lag order = 6, p-value = 0.01
alternative hypothesis: stationary


$V5

    Augmented Dickey-Fuller Test

data:  newX[, i]
Dickey-Fuller = -7.0185, Lag order = 6, p-value = 0.01
alternative hypothesis: stationary

我不确定警告的来源。也许我的示例数据不合理。 Test[n]是对第n家公司的测试。

NA中缺少值(x)可能是个问题。如果xna.omit(x)替换,则时间序列不再等距。一个想法是通过插值填充NA - 间隙。在以下示例中,我们使用线性插值:

library(tseries)

#----------------------------------------------------------------
# example data:

set.seed(1)
X <- matrix(NA,300,5)

for ( i in 1:ncol(X))
{
  X[,i] <- sample(-100:100,nrow(X),replace=TRUE) / 1000
}

for ( i in 1:ncol(X))
{
  X[sample(1:nrow(X),floor(nrow(X)/10),replace=FALSE),i] <- NA
}

df <- cbind( date = as.Date("2015-01-01") + (1:nrow(X))*as.difftime(1,units="days"),
             as.data.frame(X) )

#----------------------------------------------------------------

a = "stationary"
lagOrder = trunc((nrow(df)-1)^(1/3))


Test <- apply(df[,-1], 2,
              function(x){
                tryCatch(
                  {
                    n <- which.max(!is.na(x))
                    m <- nrow(df)-which.max(!is.na(rev(x)))+1
                    return(adf.test(approx(n:m,x[n:m],xout=n:m)$y, alternative=a, k=lagOrder ))
                  },
                  error = function(e)
                  {
                    message(e)
                    writeLines("")
                    return(NA)
                  } )
                }
              )    

缺少值的示例数据:

> head(df,15)
         date     V1     V2     V3     V4     V5
1  2015-01-02 -0.047     NA  0.063  0.067 -0.027
2  2015-01-03 -0.026 -0.081  0.086     NA  0.049
3  2015-01-04  0.015 -0.001 -0.071 -0.046     NA
4  2015-01-05  0.082 -0.008  0.050 -0.063  0.035
5  2015-01-06 -0.060 -0.025  0.096 -0.055  0.040
6  2015-01-07  0.080  0.099  0.095 -0.088  0.070
7  2015-01-08     NA -0.065 -0.030 -0.088  0.041
8  2015-01-09  0.032  0.063 -0.021 -0.071  0.072
9  2015-01-10  0.026 -0.087  0.091 -0.086 -0.011
10 2015-01-11 -0.088 -0.020 -0.079     NA     NA
11 2015-01-12 -0.059 -0.072  0.087  0.005 -0.075
12 2015-01-13 -0.065 -0.062 -0.031     NA  0.047
13 2015-01-14  0.038  0.069  0.007  0.039     NA
14 2015-01-15 -0.023     NA     NA     NA     NA
15 2015-01-16  0.054 -0.047  0.043 -0.097 -0.018

结果:

> Test
$V1

    Augmented Dickey-Fuller Test

data:  approx(n:m, x[n:m], xout = n:m)$y
Dickey-Fuller = -6.5244, Lag order = 6, p-value = 0.01
alternative hypothesis: stationary


$V2

    Augmented Dickey-Fuller Test

data:  approx(n:m, x[n:m], xout = n:m)$y
Dickey-Fuller = -6.4918, Lag order = 6, p-value = 0.01
alternative hypothesis: stationary


$V3

    Augmented Dickey-Fuller Test

data:  approx(n:m, x[n:m], xout = n:m)$y
Dickey-Fuller = -6.519, Lag order = 6, p-value = 0.01
alternative hypothesis: stationary


$V4

    Augmented Dickey-Fuller Test

data:  approx(n:m, x[n:m], xout = n:m)$y
Dickey-Fuller = -7.2095, Lag order = 6, p-value = 0.01
alternative hypothesis: stationary


$V5

    Augmented Dickey-Fuller Test

data:  approx(n:m, x[n:m], xout = n:m)$y
Dickey-Fuller = -7.2067, Lag order = 6, p-value = 0.01
alternative hypothesis: stationary


> 

使用问题中给出的数据的示例:

> a = "stationary"

> lagOrder = trunc((nrow(df)-1)^(1/3))

> Test <- apply(df[,-1], 2,
+               function(x){
+                 tryCatch(
+                   {
+                     n <- which.max(!is.na .... [TRUNCATED] 
need at least two non-NA values to interpolate
need at least two non-NA values to interpolate
need at least two non-NA values to interpolate
need at least two non-NA values to interpolate
Warning messages:
1: In adf.test(approx(n:m, x[n:m], xout = n:m)$y, alternative = a,  :
  p-value smaller than printed p-value
2: In adf.test(approx(n:m, x[n:m], xout = n:m)$y, alternative = a,  :
  p-value smaller than printed p-value
3: In adf.test(approx(n:m, x[n:m], xout = n:m)$y, alternative = a,  :
  p-value smaller than printed p-value
4: In adf.test(approx(n:m, x[n:m], xout = n:m)$y, alternative = a,  :
  p-value smaller than printed p-value
5: In adf.test(approx(n:m, x[n:m], xout = n:m)$y, alternative = a,  :
  p-value smaller than printed p-value
> 

结果:

> Test
$A.G.L.SJ.INVS...LON..DEAD...13.08.15...S.

    Augmented Dickey-Fuller Test

data:  approx(n:m, x[n:m], xout = n:m)$y
Dickey-Fuller = -4.4222, Lag order = 4, p-value = 0.01
alternative hypothesis: stationary


$ABACUS.GROUP.DEAD...18.02.09...S.

    Augmented Dickey-Fuller Test

data:  approx(n:m, x[n:m], xout = n:m)$y
Dickey-Fuller = -6.4671, Lag order = 4, p-value = 0.01
alternative hypothesis: stationary


$ABB.R..IRS....S.
[1] NA

$ABBEY.NATIONAL.DEAD...T.O.SEE.702853...S.

    Augmented Dickey-Fuller Test

data:  approx(n:m, x[n:m], xout = n:m)$y
Dickey-Fuller = -4.4337, Lag order = 4, p-value = 0.01
alternative hypothesis: stationary


$ABBEY.PROTECTION.DEAD...20.01.14...S.
[1] NA

$ABBEYCREST.DEAD...10.10.14...S.

    Augmented Dickey-Fuller Test

data:  approx(n:m, x[n:m], xout = n:m)$y
Dickey-Fuller = -5.7007, Lag order = 4, p-value = 0.01
alternative hypothesis: stationary


$ABBOT.GROUP.DEAD...07.03.08...S.

    Augmented Dickey-Fuller Test

data:  approx(n:m, x[n:m], xout = n:m)$y
Dickey-Fuller = -4.5546, Lag order = 4, p-value = 0.01
alternative hypothesis: stationary


$ABBOTT.LABS.GBP..LON..DEAD...DEAD...S.
[1] NA

$ABERDEEN.ASSET.MAN..FULLY.PAID.23.09.05...S.
[1] NA

> which(is.na(Test))
                            ABB.R..IRS....S. 
                                           3 
       ABBEY.PROTECTION.DEAD...20.01.14...S. 
                                           5 
      ABBOTT.LABS.GBP..LON..DEAD...DEAD...S. 
                                           8 
ABERDEEN.ASSET.MAN..FULLY.PAID.23.09.05...S. 
                                           9 
>