Statalist


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

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


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

--- Gray Kimbrough <[email protected]> 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
it:

*------------- 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
http://home.fsw.vu.nl/m.buis/stata/exampleFAQ.html )

Hope this helps,
Maarten


-----------------------------------------
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

http://home.fsw.vu.nl/m.buis/
-----------------------------------------


      ___________________________________________________________ 
Yahoo! Mail is the world's favourite email. Don't settle for less, sign up for
your free account today http://uk.rd.yahoo.com/evt=44106/*http://uk.docs.yahoo.com/mail/winter07.html 
*
*   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/



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