In summary:
Brent Fulton <[email protected]> asked How can one "compare the
survey-based means" for a subpop to the whole pop?
I <[email protected]> advised him to compare the subpop to the
balance of the pop.
Michael Frone <[email protected]> wrote "How about -suest-
followed by -test-"
But note that the various options outlined can lead to different
answers, as demonstrated below. I reiterate my original concern and
ask if there is no "statistical difference between MI and non-MI," but
there is a "statistical difference between MI and the nation" (the
USA, being the one that contains Statacorp) or vice versa, what should
we conclude?
webuse nhanes2
local m=35
svy, subpop(if age<=`m'): tab diab bl, col se
gen p21=.
gen p22=.
mat li e(b)
mat b1=e(b)
local a1=b1[1,3]
local b1=b1[1,4]
test p21=p22
local p1=r(p)
svy, subpop(if age<=`m'): reg diab
estimates store a1
svy, subpop(if age<=`m' & bl==1): reg diab
estimates store a2
suest a1 a2
mat b2=e(b)
local a2=b2[1,1]
local b2=b2[1,2]
test [a1]_cons=[a2]_cons
local p2=r(p)
svy, subpop(if age<=`m'): logit diab
estimates store a3
svy, subpop(if age<=`m' & bl==1): logit diab
estimates store a4
suest a3 a4
mat b3=e(b)
local a3=invlogit(b3[1,1])
local b3=invlogit(b3[1,2])
test [a3]_cons=[a4]_cons
local p3=r(p)
foreach v in a b p {
if "`v'"=="a" di "Diabetes" in gr " svy: tab svy: reg svy:logit" _c
if "`v'"=="a" di in gr _n " NB/All " _c
if "`v'"=="b" di in gr _n " Black " _c
if "`v'"=="p" di in gr _n " p-value" _c
forv i=1/3 {
di in ye _col(`=`i'*10') ``v'`i'' _c
}
}
*
* 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/