Error with panel data (plm) Error in crossprod(t(X), beta)
Asked Answered
M

0

9

I have a df (a pdata.frame object):

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

I then try to do a random model with plm package (Kapitalinkomster variable is regressed on the remaining variabler):

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")

I can get the output :

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 

Above I can see the Övriga.tillgångar variable in Model Formula but not in Coefficients..

The problem is also that I cant get the summary when Övriga.tillgångar variable is included:

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

If I exclude it, the summary(random) works.

Any suggestions?

Monkeypot answered 24/10, 2012 at 11:22 Comment(7)
Why did you use Obligationer twice in the model formula?Done
Copy paste error. But I got an answer actually. I need to omit one variable from formula in plm.Monkeypot
You maybe know some nice way to save the summary(random) output? I use textplot( capture.output(summary(random)), valign="top")Monkeypot
You can save an R representation of the model fit with save(random, file = "filename.RData").Done
Is the problem variable perfectly correlated with company or whatever your id variable is?Hiroshima
Hi, have you made any progress on that? I've encountered very similar problem and would like to see if this was solved.Padraig
@Konrad: this should be solved for plm >= 1.6-4 (Dec 2016)Devoted

© 2022 - 2024 — McMap. All rights reserved.