title: Panel regression gives error "exog does not have full column rank"
body: <p>I am trying to estimate a panel regression (see: <a href="https://bashtage.github.io/linearmodels/doc/panel/examples/examples.html" rel="nofollow noreferrer">https://bashtage.github.io/linearmodels/doc/panel/examples/examples.html</a>)</p>
  <p>My data is formatted like that (thats just an example snippet; in the orginal file there are 11 columns plus the timestamp and thousands of rows):</p>
  <p><strong>What I have</strong></p>
  <pre><code>Timestamp   Country Dummy   Pre Post    All_Countries   Timestamp
  1993-11-01  1               0   1       6.18    1993-11-01
  1993-11-02  1               0   1       6.18    1993-11-02
  1993-11-03  1               0   1       6.17    1993-11-03
  1993-11-04  1               1   0       6.17    1993-11-04
  1993-11-15  1               1   0       6.40    1993-11-15
  1993-11-01  2               0   1       7.05    1993-11-01
  1993-11-02  2               0   1       7.05    1993-11-02
  1993-11-03  2               0   1       7.20    1993-11-03
  1993-11-04  2               1   0       7.50    1993-11-04
  1993-11-15  2               1   0       7.60    1993-11-15
  1993-11-01  3               0   1       7.69    1993-11-01
  1993-11-02  3               0   1       7.61    1993-11-02
  1993-11-03  3               0   1       7.67    1993-11-03
  1993-11-04  3               1   0       7.91    1993-11-04
  1993-11-15  3               1   0       8.61    1993-11-15
  </code></pre>
  <p><strong>How you can re-create it</strong></p>
  <pre><code>import numpy as np
  import pandas as pd
  df = pd.DataFrame({&quot;Timestamp&quot; : ['1993-11-01' ,'1993-11-02', '1993-11-03', '1993-11-04','1993-11-15'], &quot;Pre&quot; : [0 ,0, 0, 1, 1], &quot;Post&quot; : [1 ,1, 1, 0, 0],  &quot;Austria&quot; : [6.18 ,6.18, 6.17, 6.17, 6.40],&quot;Belgium&quot; : [7.05, 7.05, 7.2, 7.5, 7.6],&quot;France&quot; : [7.69, 7.61, 7.67, 7.91, 8.61]},index = [1, 2, 3,4,5])
  df
  
  
   index_data = df.melt(['Timestamp','Pre','Post'], var_name='Country Dummy', value_name='All_Countries')
  
  index_data['Country Dummy'] = index_data['Country Dummy'].factorize()[0] + 1
                       # pd.Categorical(out['Country Dummy']).codes + 1
  timestamp = pd.Categorical(index_data['Timestamp'])
  index_data = index_data.set_index(['Timestamp', 'Country Dummy'])
  index_data['Timestamp'] = timestamp
  index_data
  </code></pre>
  <p>**What I do **</p>
  <pre><code>!pip install linearmodels
  from linearmodels.panel import PooledOLS
  import statsmodels.api as sm
  exog_vars = ['Pre','Post']
  exog = sm.add_constant(index_data[exog_vars])
  mod = PooledOLS(index_data.All_Countries, exog)
  pooled_res = mod.fit()
  print(pooled_res)
  </code></pre>
  <p>**What I get **</p>
  <p>&quot;ValueError: exog does not have full column rank.&quot;</p>
  <p><strong>Question</strong></p>
  <p>Anyone an idea what could cause that problem?</p>
  <p><strong>Idea</strong></p>
  <p>Is it because my data should be formatted like that (see example in link at the top):
  --&gt; and if yes, how could I get that</p>
  <pre><code>Timestamp   Country Dummy   Pre Post    All_Countries   Timestamp
  1993-11-01  1               0   1       6.18    1993-11-01
  1993-11-02                  0   1       6.18    1993-11-02
  1993-11-03                  0   1       6.17    1993-11-03
  1993-11-04                  1   0       6.17    1993-11-04
  1993-11-15                  1   0       6.40    1993-11-15
  1993-11-01  2               0   1       7.05    1993-11-01
  1993-11-02                  0   1       7.05    1993-11-02
  1993-11-03                  0   1       7.20    1993-11-03
  1993-11-04                  1   0       7.50    1993-11-04
  1993-11-15                  1   0       7.60    1993-11-15
  1993-11-01  3               0   1       7.69    1993-11-01
  1993-11-02                  0   1       7.61    1993-11-02
  1993-11-03                  0   1       7.67    1993-11-03
  1993-11-04                  1   0       7.91    1993-11-04
  1993-11-15                  1   0       8.61    1993-11-15
  </code></pre>