title: How to predict using a multivariate regression function that is the sum of other regression functions
body: <p>I'm doing multivariate regression in python using the weighted least squares method.
  I have a dataset that is 10x4, in other words, for each sample in the data, there are 4 features.</p>
  
  <p>If my dataset is X, I can do the following to get the coefficients of the regression function:</p>
  
  <pre><code>import numpy as np
  import statsmodels.api as sm
  from statsmodels.sandbox.regression.predstd import wls_prediction_std
  
  mod_wls = sm.WLS(y, X)
  res_wls = mod_wls.fit()
  print res_wls.params
  </code></pre>
  
  <p>For my specific 10x4 dataset, this gives me the following output:</p>
  
  <pre><code>[ 0.06210193  5.24256099  0.15214974  0.12325115]
  </code></pre>
  
  <p>However, I've been told that I  need to build a regression function, <code>g(X)</code> by iterating over EACH <code>x[i]</code> in <code>X</code> and summing up the different regression functions. </p>
  
  <p>I'm <em>guessing</em> (but would love to be corrected if I've understood this wrongly), I'm guessing that this means that <code>g(x) = g(x1) + g(x2) + g(x3) + ... + g(x10)</code></p>
  
  <p>So for eg. let's say the function for the first row of data gives the following coefficients:</p>
  
  <pre><code>[ 0.11  1.22  0.33  0.88]
  </code></pre>
  
  <p>and for the second row of data I get </p>
  
  <pre><code>[ 1.22  0.55  0.44  0.11]
  </code></pre>
  
  <p>So after two iterations, my <code>g(x)</code> should give the following coefficients:</p>
  
  <pre><code>[ 1.33  1.77  0.77  0.99]
  </code></pre>
  
  <p>Because for the first coefficient, 0.11 + 1.22 = 1.33, and so on. 
  And so on until the tenth data sample.</p>
  
  <p>Now my question is - how can regression functions be added in scikit-learn? </p>
  
  <p>Iterating through each sample, grabbing the coefficients and adding them up individually - is that the only way to do this? </p>
  
  <p>Let's say I've gotten the final coefficients, how can I now declare a regression model using these final coefficients so that I can pass data to it to predict values?</p>