title: How calculate OLS regression with Survey Weights in Python.
body: <p>I want to do a linear regression on survey data with survey weights.</p>
  
  <p>The survey data is from the EU and each observation has a weight. (.4 for an one respondent, 1.5 for another.) </p>
  
  <p>This weight is described as: </p>
  
  <blockquote>
    <p>"The European Weight, variable 6, produces a representative sample of
    the European Community as a whole when used in analysis. This variable
    adjusts the size of each national sample according to each nation's
    contribution to the population of the European Community."</p>
  </blockquote>
  
  <p>To do my calculation I'm using sklearn.</p>
  
  <pre><code>from sklearn import linear_model
  regr = linear_model.LinearRegression()
  regr.fit(X,y, sample_weight = weights)
  </code></pre>
  
  <p>X is a pandas DataFrame. y is a numpy.ndarray.  weights is a pandas    Series.</p>
  
  <p>Am I using 'sample_weight' correctly, does is this the correct way to handle survey weights in scikit?</p>