Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You want a fast weighted least squares model that returns the covariance matrix without additional overhead? In general, the right covariance matrix will depend on the data generating process (DGP) because different DGP (say Heteroscedasticity of errors) imply different distributions of parameter estimates (think White vs. OLS standard errors). But if you can assume WLS is the right way to do it, and I believe you would use the asymptotic variance estimate for beta for WLS, (1/n X'V^-1X)^-1, where V is the weighting matrix created from Yerrs. That's a pretty simple formula if numpy.polynomial.polynomial.polyfit is working for you. </p> <p>I looked for an online reference but couldn't find one. But see Fumio Hayashi's Ecomometrics, 2000, Princeton University press, p. 133 - 137 for a derivation and discussion. </p> <p>Update 12/4/12: There is another stack overflow question that comes close: <a href="https://stackoverflow.com/questions/10261972/numpy-polyfit-has-no-keyword-cov">numpy.polyfit has no keyword 'cov'</a> that has a nice explanation (with code) of how to use scikits.statsmodels to do what you want. I believe you'll want to replace the line:</p> <pre><code>result = sm.OLS(Y,reg_x_data).fit() </code></pre> <p>to </p> <pre><code>result = sm.WLS(Y,reg_x_data, weights).fit() </code></pre> <p>Where you define weights as a function of Yerr as before with numpy.polynomial.polynomial.polyfit. More details on using statsmodels with WLS over at the <a href="http://statsmodels.sourceforge.net/stable/regression.html#introduction" rel="nofollow noreferrer">statsmodels website</a>.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload