Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: Regression with subject-level means and aweights VS full regression


From   J Taylor <[email protected]>
To   [email protected]
Subject   st: Regression with subject-level means and aweights VS full regression
Date   Sun, 9 Sep 2012 22:32:21 -0400

If I have multiple observations per person, shouldnt it be the case
that running a regression on subject-level means weighted by
observations per person gives the same result as running a regression
on the full dataset?  Unfortunately, in the below, it seems that I am
getting different answers.

Any thoughts on why this is occurring?  I believe that I am using the
aweights correctly, weighting by the number of observations per
person?

Thank you,
JT

-------------------------

clear
set more off
set seed 1234

set obs 100

gen sid = _n
gen truex = uniform()
gen truey = .2 + .4*truex

gen obspersub = ceil(10*uniform())
expand obspersub

gen x = truex + uniform()
gen y = truey + uniform()

reg y x, cluster(sid)

preserve
	collapse y x obspersub, by(sid)
	reg y x [aw=obspersub]
restore

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index