我试图在 plm 包中使用 cipstest() 函数对 Pesaran 2007 进行面板单位根测试。由于 << Im K, Pesaran H, Shin Y. 2003,CIPS 代表横截面增强 IPS(2003) 测试。异质面板中单位根的测试。计量经济学杂志 115:53-74.>>。
setwd("/Users/xx/Desktop/mm/tt")
library(tidyverse)
library(plm)
#>
#> Attaching package: 'plm'
#> The following objects are masked from 'package:dplyr':
#>
#> between, lag, lead
last_data <- read_rds("last_data.rds")
panel <- last_data %>% select(1:6, upop,POP,pl_m,xr,open,everything()) %>%
mutate_at(.vars = vars(3:8),.funs = list(~log(.)))
panel <- panel %>% pdata.frame(index = c("country","year"))
cipstest(panel$Y, lags = 2,type = "drift",model = "cmg")
#> Error in approx(nintv, cvals[nintl:ninth, tintl, i], n =
max(nintv) - : need at least two non-NA values to interpolate
由reprex 包(v0.3.0)于 2019 年 7 月 4 日创建
# dput(as.data.frame(split(panel$Y,panel$country)))
structure(list(Burundi = c(22.2687268413421, 22.317469248461,
22.2930357721571, 22.2264405912204, 22.2441592730786, 22.1579453555664,
22.0854949231434, 22.063160850374, 22.161337780685, 22.1703898769821,
22.1305319223586, 22.1471244309012, 22.1989226604059, 22.2552350129827,
22.3107341959166, 22.3111632534901, 22.370670295987, 22.4086361583573,
22.4807552868384, 22.5055144002444, 22.5776422740586, 22.6734624055849,
22.7222915239494, 22.8336166935376, 22.8721799202094, 22.8369034466608
), Djibouti = c(20.8614286540855, 20.8416021049582, 21.0646727772789,
21.2698592118487, 20.9711725966822, 21.1407072814231, 20.9937265559008,
21.0827955644149, 21.1043963107814, 21.1700065085719, 21.1927367926085,
21.1804102692525, 21.1831982456163, 21.274644176793, 21.3156753854491,
21.3707863318071, 21.5346728275086, 21.5891857517805, 21.6930404065511,
21.4134584005738, 21.3160266148602, 21.427412179815, 21.4882632286886,
21.585345576365, 21.702681646449, 21.704778602648), Ethiopia = c(24.2706112031906,
24.1740567554243, 24.0702212280161, 24.1658536765229, 24.1020231436468,
24.2246598776034, 24.2468812138179, 24.3348340870619, 24.2548853717465,
24.2923589561941, 24.2771961528379, 24.4339620115638, 24.3196679017542,
24.3889783134133, 24.5599518099471, 24.7452116225588, 24.7686061495844,
24.9590646361601, 25.0610678849476, 25.125533689915, 25.2937012578536,
25.4024748297499, 25.467712181575, 25.5880892842206, 25.7264627010567,
25.798448929481), Kenya = c(24.6229881069521, 24.6474032130481,
24.6219212998109, 24.6786696852481, 24.8229187458703, 24.7906184475319,
24.8347821048777, 24.8493861621396, 24.85312301133, 24.8643868183639,
24.8495452068726, 24.8882903016792, 24.8646264210333, 24.8461769769152,
24.8898794000145, 24.9651253837082, 25.06926730352, 25.1401164200229,
25.1820897442834, 25.2529576290086, 25.3559731379186, 25.4430270946901,
25.5057932596275, 25.5522599677286, 25.598287930101, 25.6561841542592
), Rwanda = c(22.6935691199549, 22.5642581581815, 22.6289420085534,
22.5341163215727, 21.7678045340621, 21.9932146815405, 22.1742699844444,
22.3259084479025, 22.4006576959552, 22.4243505332445, 22.4994183082623,
22.5957273517255, 22.7566999966392, 22.7678265120448, 22.8615351204763,
22.9606013227077, 23.0861013089427, 23.1405880990123, 23.1760172037594,
23.2713378426116, 23.373438960701, 23.4779319031381, 23.5479299878125,
23.6040349964922, 23.6834693938453, 23.7880831652383), Tanzania = c(24.0635954520005,
24.0679550069443, 24.0019861264464, 23.9671353723631, 23.9271478613669,
23.9989151274396, 24.0367702883916, 24.1299028889263, 24.2011027260946,
24.2707397868631, 24.3363802375708, 24.4206905123751, 24.5176595351357,
24.5904007310663, 24.6496125632042, 24.77956239916, 24.8747543995655,
24.9895793990449, 25.0642595783976, 25.0999302691123, 25.2119509238907,
25.3477436594832, 25.3586742817931, 25.3989689683153, 25.5052797784113,
25.6076709954433), Uganda = c(23.3687893113393, 23.3898287425121,
23.4273133766183, 23.4726641441479, 23.7649918646371, 23.7810950853729,
23.7847879541202, 23.8327010456612, 23.9210713907725, 23.9750173176474,
24.0294120091748, 24.0946780482998, 24.1546923690332, 24.2090683989912,
24.2688884106071, 24.3787884455312, 24.4455968782359, 24.5145662267114,
24.5959341139916, 24.7021978670768, 24.7936852507912, 24.8846308231871,
24.8984566300846, 24.935160537336, 24.9644151906894, 25.0396585590939
)), class = "data.frame", row.names = c("Burundi-1990", "Burundi-1991",
"Burundi-1992", "Burundi-1993", "Burundi-1994", "Burundi-1995",
"Burundi-1996", "Burundi-1997", "Burundi-1998", "Burundi-1999",
"Burundi-2000", "Burundi-2001", "Burundi-2002", "Burundi-2003",
"Burundi-2004", "Burundi-2005", "Burundi-2006", "Burundi-2007",
"Burundi-2008", "Burundi-2009", "Burundi-2010", "Burundi-2011",
"Burundi-2012", "Burundi-2013", "Burundi-2014", "Burundi-2015"
))
我面临的问题是,当我为我的 pSeries Y 计算 CIPS 测试(GDP 的对数转换)时,会弹出上述错误。但是,该系列中没有 na 值。我真的很感谢你的帮助。