title: Multiple linear regression in pandas statsmodels: ValueError
body: <p>Data: <a href="https://courses.edx.org/c4x/MITx/15.071x_2/asset/NBA_train.csv" rel="nofollow">https://courses.edx.org/c4x/MITx/15.071x_2/asset/NBA_train.csv</a></p>
  
  <p>I know how to fit these data to a multiple linear regression model using <code>statsmodels.formula.api</code>:</p>
  
  <pre><code>import pandas as pd
  NBA = pd.read_csv("NBA_train.csv")
  import statsmodels.formula.api as smf
  model = smf.ols(formula="W ~ PTS + oppPTS", data=NBA).fit()
  model.summary()
  </code></pre>
  
  <p>However, I find this R-like formula notation awkward and I'd like to use the usual pandas syntax:</p>
  
  <pre><code>import pandas as pd
  NBA = pd.read_csv("NBA_train.csv")    
  import statsmodels.api as sm
  X = NBA['W']
  y = NBA[['PTS', 'oppPTS']]
  X = sm.add_constant(X)
  model11 = sm.OLS(y, X).fit()
  model11.summary()
  </code></pre>
  
  <p>Using the second method I get the following error:</p>
  
  <pre><code>ValueError: shapes (835,2) and (835,2) not aligned: 2 (dim 1) != 835 (dim 0)
  </code></pre>
  
  <p>Why does it happen and how to fix it?</p>