在插补数据上运行Zelig'arima'时,“维数不正确”

时间:2016-08-22 12:30:04

标签: r time-series r-zelig

当我尝试使用arima包运行zelig模型时出现错误。我正在使用MI数据和20个用Amelia创建的插补。以下是我的id和响应变量的简短摘要:

 $ imp20:'data.frame':  442 obs. of  50 variables:
  ..$ region                     : Factor w/ 4 levels "Central Africa",..: 3     3 3 3 3 3 3 3 3 3 ...
  ..$ subregionid                : Factor w/ 4 levels "FC","FE","FS",..: 3 3     3 3 3 3 3 3 3 3 ...
  ..$ country                    : Factor w/ 34 levels "Angola","Benin",..: 1 1 1 1 1 1 1 1 1 1 ...
  ..$ ISO2                       : Factor w/ 34 levels "AO","BF","BJ",..: 1 1 1 1 1 1 1 1 1 1 ...
  ..$ ISO3                       : Factor w/ 34 levels "AGO","BEN","BFA",..: 1 1 1 1 1 1 1 1 1 1 ...
  ..$ year                       : num [1:442] 2002 2003 2004 2005 2006 ...
  ..$ cap.lat                    : num [1:442] -8.5 -8.5 -8.5 -8.5 -8.5 -8.5 -8.5 -8.5 -8.5 -8.5 ...
  ..$ cap.long                   : num [1:442] 13.2 13.2 13.2 13.2 13.2 ...
  ..$ NGDP_RPCH                  : num [1:442] 14.53 5.25 10.88 18.26 20.73 ...
  ..$ NGDPD                      : num [1:442] 3.18 3.31 3.38 3.44 3.48 ...
  ..$ NGDPDPC                    : num [1:442] 2.68 2.69 2.72 2.75 2.78 ...
  ..$ NGSD_NGDP                  : num [1:442] 10.62 7.77 12.63 26.98 40.94     
...
 ..$ PIKE.regional              : num [1:442] 0.225 0.295 0.287 0.358 0.357 ...
  ..$ Definite.Probable          : num [1:442] 36 36 36 36 36.1 ...
  ..$ Elephant.range             : num [1:442] 406006 433613 511662 456046 459418 ...
  ..$ Change.by.year             : num [1:442] 0.000463 0.000463 0.000463 0.000463 0.000463 ...
  ..$ Diff.from.expected         : num [1:442] -0.0415 -0.0415 -0.0415 -0.0415 -0.0415 ...

Diff.from.expected是我的响应变量。这是我运行的代码和我得到的错误。

z1 <- zarima$new()
> z1$zelig(Diff.from.expected~GNI, order=c(1,0,1), model="arima",

+                data = a.coVarsTrans.more, ts="year", cs="country")

Error in data[, cs] : incorrect number of dimensions

所以在我看来cs='country'电话存在问题,但我不确定问题是什么。我打算添加更多自变量,但是要确保基本模型首先运行,但显然不是。

以下是指向saved Amelia .Rdata file的链接。

0 个答案:

没有答案