Skip to content

linearhypothesis using sunab produces "Error in L %*% V : non-conformable arguments" #606

@mkhaledahmed

Description

@mkhaledahmed

Hello,

I need to submit my paper in a week or so, so it would be greatly appreciated if I could get some swift help.

Background

I am testing the impact of OPEC membership on oil production for 3 countries. They joined in 2017, 2018 and 2007. Now I want to preface this by saying I DO NOT get this error when looking at OPEC+ joiners, all of whom joined effectively in 2017. But I do get this error in a staggered entry event-study approach. The model is as follows:

log_model_joiner1 <- feols(
  lprod ~ sunab(period = year, cohort = entry_year, ref.p = -1) + lcons | country_id + year,
  data = opec,
  cluster = ~country_id
)

The summary statistics is as follows:

> summary(log_model_joiner1)
OLS estimation, Dep. Var.: lprod
Observations: 259
Fixed-effects: country_id: 5,  year: 54
Standard-errors: Clustered (country_id) 
           Estimate   Std. Error       t value   Pr(>|t|)    
year::-47 -4.032053 2.270119e-01 -1.776141e+01 5.9036e-05 ***
year::-46 -1.789031 3.106697e-01 -5.758626e+00 4.5107e-03 ** 
year::-45  0.081865 4.422778e-01  1.850990e-01 8.6216e-01    
year::-44  0.406775 4.291075e-01  9.479570e-01 3.9683e-01    
year::-43  0.185592 5.537971e-01  3.351270e-01 7.5437e-01    
year::-42  0.138390 5.717080e-01  2.420640e-01 8.2063e-01    
year::-41  0.076439 4.919464e-01  1.553800e-01 8.8405e-01    
year::-40  0.420765 5.372831e-01  7.831350e-01 4.7732e-01    
year::-39  0.619827 5.043358e-01  1.228998e+00 2.8643e-01    
year::-38  0.731866 3.127170e-01  2.340345e+00 7.9348e-02 .  
year::-37  0.488922 1.354406e-01  3.609861e+00 2.2559e-02 *  
year::-36 -0.045735 1.708788e-01 -2.676450e-01 8.0221e-01    
year::-35 -0.466530 6.800595e-02 -6.860130e+00 2.3641e-03 ** 
year::-34 -0.365779 4.398395e-02 -8.316189e+00 1.1421e-03 ** 
year::-33 -0.437062 1.177675e-01 -3.711225e+00 2.0632e-02 *  
year::-32 -0.329918 1.237642e-01 -2.665694e+00 5.6057e-02 .  
year::-31 -0.286081 3.845198e-01 -7.439970e-01 4.9821e-01    
year::-30 -0.127780 3.827599e-01 -3.338380e-01 7.5527e-01    
year::-29 -0.326228 3.821983e-01 -8.535580e-01 4.4145e-01    
year::-28 -0.713668 3.677513e-01 -1.940626e+00 1.2429e-01    
year::-27 -0.739846 2.721991e-01 -2.718032e+00 5.3095e-02 .  
year::-26 -0.778004 1.741358e-01 -4.467799e+00 1.1093e-02 *  
year::-25 -0.633025 1.352370e-01 -4.680856e+00 9.4417e-03 ** 
year::-24 -0.401337 3.950999e-02 -1.015787e+01 5.2892e-04 ***
year::-23 -0.051479 4.314873e-02 -1.193058e+00 2.9877e-01    
year::-22 -0.109959 9.717463e-02 -1.131562e+00 3.2106e-01    
year::-21  0.533801 2.980457e-01  1.791006e+00 1.4778e-01    
year::-20  1.025934 3.574256e-01  2.870343e+00 4.5453e-02 *  
year::-19  1.165392 4.428597e-01  2.631516e+00 5.8094e-02 .  
year::-18  0.788173 4.482076e-01  1.758500e+00 1.5349e-01    
year::-17  0.787695 3.429790e-01  2.296629e+00 8.3247e-02 .  
year::-16  0.882499 2.366733e-01  3.728767e+00 2.0319e-02 *  
year::-15  0.609773 1.523508e-01  4.002427e+00 1.6098e-02 *  
year::-14  0.495395 1.156723e-01  4.282747e+00 1.2820e-02 *  
year::-13  0.675594 9.513295e-02  7.101581e+00 2.0768e-03 ** 
year::-12  0.606047 1.202241e-01  5.040976e+00 7.2771e-03 ** 
year::-11  0.456071 1.225700e-01  3.720906e+00 2.0458e-02 *  
year::-10  0.413073 1.705448e-01  2.422081e+00 7.2600e-02 .  
year::-9   0.494458 3.064148e-01  1.613689e+00 1.8189e-01    
year::-8   0.195415 4.557965e-01  4.287320e-01 6.9020e-01    
year::-7   0.060418 4.274210e-01  1.413550e-01 8.9442e-01    
year::-6  -0.061843 3.792886e-01 -1.630510e-01 8.7838e-01    
year::-5  -0.126059 3.911446e-01 -3.222820e-01 7.6338e-01    
year::-4  -0.239663 3.670527e-01 -6.529400e-01 5.4942e-01    
year::-3  -0.260880 2.968020e-01 -8.789700e-01 4.2905e-01    
year::-2   0.101273 1.253681e-01  8.078050e-01 4.6450e-01    
year::0    0.008152 3.454505e-02  2.359780e-01 8.2504e-01    
year::1    0.011847 3.191678e-02  3.711990e-01 7.2931e-01    
year::2   -0.382679 7.742544e-02 -4.942550e+00 7.8026e-03 ** 
year::3   -0.285714 1.798254e-02 -1.588841e+01 9.1716e-05 ***
year::4   -0.265468 1.156655e-01 -2.295137e+00 8.3384e-02 .  
year::5   -0.470540 1.497406e-01 -3.142366e+00 3.4768e-02 *  
year::6   -0.770355 1.289073e-01 -5.976036e+00 3.9399e-03 ** 
year::7   -1.068978 2.293195e-02 -4.661522e+01 1.2668e-06 ***
year::8   -1.664253 3.883217e-01 -4.285760e+00 1.2789e-02 *  
year::9   -1.558972 3.158682e-02 -4.935512e+01 1.0084e-06 ***
year::10  -1.473114 1.022351e-01 -1.440908e+01 1.3483e-04 ***
year::11  -1.587707 5.255092e-02 -3.021272e+01 7.1487e-06 ***
year::12  -1.763376 2.373927e-02 -7.428094e+01 1.9684e-07 ***
year::13  -1.458294 1.524139e-02 -9.567991e+01 7.1541e-08 ***
year::14  -1.699165 2.909517e-01 -5.840024e+00 4.2858e-03 ** 
year::15  -1.756428 3.788617e-01 -4.636067e+00 9.7627e-03 ** 
year::16  -2.019122 3.959559e-01 -5.099362e+00 6.9857e-03 ** 
year::17  -1.960993 4.408764e-01 -4.447944e+00 1.1265e-02 *  
lcons      1.782241 1.990000e-13  8.940642e+12  < 2.2e-16 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
RMSE: 0.111971     Adj. R2: 0.979494
                 Within R2: 0.979713

The command for the tests are as follows:

post_treat_model_joiner1 <- linearHypothesis(log_model_joiner1, c(
  "year::1 = 0",
  "year::2 = 0",
  "year::3 = 0",
  "year::4 = 0",
  "year::5 = 0",
  "year::6 = 0",
  "year::7 = 0"
))

post_treat_model_joiner1

pre_treat_model_joiner1 <- linearHypothesis(log_model_joiner1, c(
  "year::-2 = 0",
  "year::-3 = 0",
  "year::-4 = 0",
  "year::-5 = 0",
  "year::-6 = 0",
  "year::-7 = 0",
  "year::-8 = 0",
  "year::-9 = 0"
))

pre_treat_model_joiner1

Gives the following error

Error in L %*% V : non-conformable arguments

If it is possible, please give some recommendations to do pre- and post- treatment tests as I am tight on time.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions