I am not an expert on this, but I'll have a go....have you tried
downloading the nhanes3.dta, and then using the -table- syntax with
[pweight=wtpfhx6] that I previously posted? If that works okay, then it
rules out there being a problem with your version of Stata and its
handling of pweights. It would then narrow it down to being something
specific about the household survey data or mis-specification of the
weighting variable. If so, what household survey data are you using, and
is there a technical report that accompanies it giving information on
what weighting should be applied?
>>> ucb_gal <[email protected]> 8/03/2007 1:59 pm >>>
hmmm... i get an error from stata saying that pweights don't work. i
can run it with regular weights, st:
table var [weight=wtvar]
but then it assumes it's a frequency weight, not a probability weight.
when i try this with the downloaded command univar, st:
univar var [w=wtvar]
it assumes it's an analytic weight.
i can't seem to figure out how to use a probability weight!
----- Original Message ----
From: Jesia Berry <[email protected]>
To: [email protected]
Sent: Wednesday, March 7, 2007 6:57:45 PM
Subject: Re: st: Finding median when using svy
Yes, doing it the way I previously suggested doesn't apply the
weights,
but the table command does have a 'weight' option that you can use:
table hssex [pweight= wtpfhx6] , c(median hsageir count hsageir) row
format(%9.0f)
If you are not reporting the standard errors, this command should
suffice, however, it does not take into account the clustering and
stratification. The 'Survey data' stata manual says " it is important
to
use sampling weights in order to get the point estimates right. We
must
consider the weighting, clustering, and stratification of the survey
design to get the standard errors right."
My understanding is that if clustering is not taken into account, it
does not affect the point estimate (eg. the median is correct) but it
underestimates the standard errors resulting in a narrowing of the
width
of the CIs and an overstating of the statistical significance.
Ignoring
stratification will lead to an overestimating of the standard errors.
While the biases from ignoring stratification and clustering run in
different
directions, researchers have found that ignoring sample design
typically results in standard error estimates which are too small
(Kish,
L. and M. Fraukel, Balanced Repeated Replications for Standard Errors,
Journal of the American Statistical Association, 65(331), 1071-93,
1970).
-pctile- was previously suggested to be used to calculate medians in
survey data (see Statalist archives below), although it looks like
-pctile- doesn't account for survey design either. There was no
response
to Ssu Weng's request.
--------------------------------------------------------------------------------
Subject st: RE: survey median estimator
Date: Thu Nov 13 19:20:01 2003
The Nov. 12, 2002 Statalist posting (Clyde Schechter) suggests using
-pctile- and pweights to estimate the median with survey data.
However,
I would like standard errors that account for the survey design.
Does anyone know of a way to do this? Thank you in advance.
Ssu Weng, NM Dept. of Health, Santa Fe, NM, USA
--------------------------------------------------------------------------------
Subject st: RE: survey median estimator
Date Mon, 18 Nov 2002 10:54:52 -0500
As Nick Cox points out, -egen- can't be combined with pweights. But
-pctile- does accept pweights. Unfortunately, -pctile- is not
compatible with -by-. One possibility would be to hack the code of
-pctile- and make
it byable--I haven't looked to see how easy or hard that would be.
Another possibility is to loop on the values of the grouping variable
"type." The resulting medians should be properly estimated. The
standard errors would probably be incorrect because -pctile- will not
account for
the stratification and clustering--but based on the wished for model
of
-egen median=median(edpct) if salquart==3, by(type)- that is probably
not of concern here. Hope this helps.
Clyde Schechter
--------------------------------------------------------------------------------
>>> ucb_gal <[email protected]> 8/03/2007 10:51 am >>>
doing it that way doesn't apply the weights, right? i thought you had
to use the prefix "svy:" to apply the survey settings.
in which case, table doesn't work with svy...
----- Original Message ----
From: Jesia Berry <[email protected]>
To: [email protected]
Sent: Wednesday, March 7, 2007 3:45:46 PM
Subject: Re: st: Finding median when using svy
As an example, to get the median age by sex, you can use the 'table'
command.
nhanes3 dataset available at
http://www-unix.oit.umass.edu/~statdata/statdata/stat-logistic.html
use nhanes3.dta
svyset [pweight= wtpfhx6], strata(sdpstra6) psu(sdppsu6)
table hssex, c(median hsageir count hsageir) row
Jesia Berry
Research Officer
Research Centre for Injury Studies
(and AIHW National Injury Surveillance Unit)
Flinders University
GPO Box 2100
Adelaide SA 5001
Tel: +61 8 8201 7626
Fax: +61 8 8374 0702
[email protected]
>>> ucb_gal <[email protected]> 8/03/2007 4:47 am >>>
I'm using household survey data and using the svyset settings.
I can't figure out how to find the median value of a variable while
using svy:
I can theoretically use:
svy: tab variable
but my dataset is way to big and the variable has way to many values
to
attempt this.
Any suggestions?
____________________________________________________________________________________
The fish are biting.
Get more visitors on your site using Yahoo! Search Marketing.
http://searchmarketing.yahoo.com/arp/sponsoredsearch_v2.php
*
* 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/
*
* 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/
____________________________________________________________________________________
The fish are biting.
Get more visitors on your site using Yahoo! Search Marketing.
http://searchmarketing.yahoo.com/arp/sponsoredsearch_v2.php
*
* 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/
*
* 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/
____________________________________________________________________________________
8:00? 8:25? 8:40? Find a flick in no time
with the Yahoo! Search movie showtime shortcut.
http://tools.search.yahoo.com/shortcuts/#news
*
* 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/
*
* 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/