[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Implementing restricted least squares (with hds97?)

From   Maarten buis <>
Subject   Re: st: Implementing restricted least squares (with hds97?)
Date   Mon, 9 Jul 2007 08:47:38 +0100 (BST)

--- Gray Kimbrough <> wrote:
> I am attempting to replicate the approach of Haisken-DeNew and
> Schmidt's 1999 Review of Economics and Statistics paper and use
> restricted least squares to, in effect, constrain the weighted mean
> of dummy variables to be 0. Through google I have found a
> presentation by Haisken-DeNew on an ado file, hds97.ado, to
> implement this approach in stata, but I have not been able to find
> the actual ado file either within stata (i.e. findit) or elsewhere on
> the Internet.

The most obvious person to ask is Haisken-DeNew, but here is my stab at

*------------- begin example -----------------
sysuse auto, clear

tempvar touse
gen byte `touse' = !missing(pri, mpg, foreign)

sum wei if `touse'
local tot = r(mean)*r(N)

sum wei if `touse' & foreign == 1
local wfor = r(mean)*r(N) /`tot'

sum wei if `touse' & foreign == 0
local wdom = r(mean)*r(N) / `tot'

gen domestic = !foreign if foreign < .

constraint 1 `wfor'*foreign + `wdom'*domestic = 0
cnsreg pri mpg foreign domestic, cons(1)
*------------------- end example --------------
(For more on how to use examples I sent to the Statalist, see )

Hope this helps,

Maarten L. Buis
Department of Social Research Methodology
Vrije Universiteit Amsterdam
Boelelaan 1081
1081 HV Amsterdam
The Netherlands

visiting address:
Buitenveldertselaan 3 (Metropolitan), room Z434

+31 20 5986715

Yahoo! Mail is the world's favourite email. Don't settle for less, sign up for
your free account today* 
*   For searches and help try:

© Copyright 1996–2017 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index