  # st: "Weighted" least squares

 From "Cruces,GA (pgr)" To Subject st: "Weighted" least squares Date Mon, 8 Sep 2003 19:53:37 +0100

```Dear All,

I am trying to solve a relatively simple estimation problem that implies
negative "weights" (more on my weights below), but as long as it is
possible I want to use some variable transformation to use Stata's
standard commands. My question, then, refers to the best way of
estimating this type of problems, with or without Stata's variations of
regress.

I have read Stata's documentation for weights, but I am a bit confused
about the distinction (if any) between "OLS with weights", which is what
Stata does, and "Weighted OLS", which is what I need... Regarding
Weighted OLS and my objective function for minimization, see for
instance:
http://www.itl.nist.gov/div898/handbook/pmd/section4/pmd432.htm

The problems I need to solve are variations of least squares of the
form:
(1) argmin(a,b)E[Ki(Yi-a-bXi)^2] (linear OLS if all Ki=1)
(2) argmin(a,b)E[Ki(Yi-F(a-bXi))^2] (probit if all Ki=1)
with Ki being positive and negative, and:
(3) argmin(a,b)E[Ki*So(Yi-a-bXi)^2] (qreg if Ki=1) (So is the objective
function for the qreg problem).
with positive Kis.

These Ki are what I (and the web reference above) call weights. My first
idea was a creative use of i/aweights, or variable transformations, but
after a discussion with Stata Support, and discussions from this list, I
think it does not work. Solving the problem for (1) is not too hard,
shouldn't be too hard for (2), and I don't know where to start with (3),
but ideally I would like to know if there is a general approach to
solving the problem of minimizing Ki*(y-Fi[x])^2...

Regarding the powerful "nl" procedure, although similar to what I want
to do, I have a problem because my weights can be negative:
nl finds b to minimize Sum_j (u_j^2), with:
y_j = f(X_j,b) + u_j

What I need to do is find b to minimize Sum_j [(Ki)*(u_j^2)]...

Thank you very much for your help

best,

guillermo

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
```