面板数据出错(plm)crossprod中的错误(t(X),beta)

时间:2012-10-24 11:22:05

标签: r plm

我有一个df(一个pdata.frame对象):

head(df) :
        Company Year Kapitalinkomster Bank.o.kassa Obligationer      Lån       Aktier Placeringar.andra.ftg   Fodringar Reala.tillgångar
5-1948        5 1948         4.009780    0.8677505     40.12268 54.80897 1.4630271422           0.049855191 0.633959879     1.581139e+00
6-1948        6 1948         3.221688    0.9311173     71.16401 26.39038 0.4678139417           0.000000000 0.437931676     4.931845e-01
12-1948      12 1948         3.136025    0.7628832     46.10452 44.85120 4.1966304368           0.003740003 1.020092197     2.683785e+00
19-1948      19 1948         1.862666    0.1865510     16.82441 31.67412 0.7308074302          46.245334945 3.459693951     6.213455e-01
20-1948      20 1948         3.724516    1.7719721     70.98456 27.18631 0.0004305687           0.056565968 0.000165769     4.305687e-07
21-1948      21 1948        11.288744    1.1572048     64.21109 33.42962 0.2890377378           0.000000000 0.912175552     1.150518e-06
        Övriga.tillgångar
5-1948       0.4726258998
6-1948       0.1155685107
12-1948      0.3771504323
19-1948      0.2577362013
20-1948      0.0000000000
21-1948      0.0008697916

然后我尝试使用random包创建plm模型(Kapitalinkomster变量在剩余的变量上回归):

library(plm)
random <- plm(formula=Kapitalinkomster~ Bank.o.kassa+Obligationer+Lån+
  Aktier+Placeringar.andra.ftg+Fodringar+Reala.tillgångar+Övriga.tillgångar,data=df,index=c("Company","Year"), model="random")

我可以得到输出:

random

Model Formula: Kapitalinkomster ~ Bank.o.kassa + Obligationer + Obligationer + 
    Lån + Aktier + Placeringar.andra.ftg + Fodringar + Reala.tillgångar + 
    Övriga.tillgångar

Coefficients:
          (Intercept)          Bank.o.kassa          Obligationer                   Lån                Aktier Placeringar.andra.ftg 
            0.7204962             0.0441635             0.0297014             0.0618975             0.0023219             0.0142085 
            Fodringar      Reala.tillgångar 
            0.0341745            -0.0104192 

上面我可以在Övriga.tillgångar中看到Model Formula变量,但在Coefficients中却看不到..

问题还在于,当summary变量包括在内时,我无法获得Övriga.tillgångar

summary(random) :
Error in crossprod(t(X), beta) : non-conformable arguments

如果我将其排除,则summary(random)有效。

有什么建议吗?

0 个答案:

没有答案