Statalist


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

Re: st: SVY: tab with three variables


From   Austin Nichols <austinnichols@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: SVY: tab with three variables
Date   Fri, 1 May 2009 11:46:51 -0400

Adebola Odunlami <aodunlam@hsph.harvard.edu>:

In re Steven's point (2): If one group is not asked the question, it
is not a big deal IMHO.  Using subpop or not will give the same answer
when the variable is missing outside the subpop, in general.

In re Steven's point (3): you might want the se or ci option in
addition to row option, so that the row proportions are saved in e(b)
and you can test hypotheses across rows, e.g.

clear
webuse nhanes2
svyset
svy: tab black diab, row ci
test _b[p22]=_b[p12]
svy, subpop(if age>59): tab black diab, row ci
test _b[p22]=_b[p12]
replace diab=. if age<=59
svy: tab black diab, row ci
test _b[p22]=_b[p12]


On Fri, May 1, 2009 at 11:15 AM,  <sjsamuels@gmail.com> wrote:
> Welcome to Stata!  Reposting a question will not get it answered any
> faster.  See the Stata FAQ about why questions do not get answered.
> In your case, your post is hard to read. Your questions are mixed up
> with snippets of Stata code, and other  statements.
>
> Important! Something appears wrong with your survey set up.  You have
> n =  5,191 observations, but Stata reports that the total population
> size is only N = 3,061,  You could be using the wrong probability
> weight. Stop and fix this problem.
>
> To answer your questions.
>
> 1. If you have survey data, you must always -svyset- with the
> appropriate setting.  Consult your advisor if you do not understand
> why, or look at Sharon Lohr, "Sampling, Design and Analysis", Duxbury
> Books.
>
> 2. Your new race-ethnicity variable seems okay.  You can
> cross-tabulate it against the original variable to check.
>
> You have a potential problem if whites were not asked this question:
> the survey weights might give misleading results if applied to
> nonwhites alone.  This is not an elementary matter and you should
> consult someone who is knowledgeable about surveys for advice.  Bring
> the study documentation with you when you do this.
>
> 3.  -svy: tab- with the tab() option doesn't do what you think it
> does.   Read the -help- to see why.
>
> I'm assuming that the new race-thnic variable is recoded 1 & 2.
>
> svy, subpop(if racethn==1), tab sex psymps, row
> svy, subpop(if racethn==2), tab sex psymps, row
>
> -Steve
>
> On Fri, May 1, 2009 at 10:01 AM, Adebola Odunlami
> <aodunlam@hsph.harvard.edu> wrote:
>> Hi all,
>>
>> I was hoping someone would please address my question below. Any help/insight is greatly appreciated.
>> thanks in advance.
>>
>> I am relatively new to stata and I have a few related questions. I want to get proportion of units that answered a question( variable name = psysymps) by thier gender(sex) and race (race3cat) after I survey set the data. I tried "bysort race3cat: tab psysymps sex, row col chi2"  but then realized the percentages were off and I needed to use svy commands. I then tried "svy: tab racet3cat sex, tab (psysymps) row se ci" but got a response that the table contains 0 in the marginals and therefore statsitics cannot be computed. I realized that one of the race categories (e.g. White) was not asked the question. So I created a new race category ("blackethn) that sets Whites to missing and others to either 1 or 2. Then I proceeded with my primary objective to see proportions of 'psysymps' by race and sex and tried "svy: tab blackethn sex, tab (psysymps) row se ci". This gave me the table below.
>>
>> My questions are: 1) must I always svy set before each code e.g svy: tab instead of just tab?; 2) was it okay to set Whites to missing as they were not asked this question and I dont want them counted as a denominator in my proportion?; 3) the table below still does not give me tabs of my variable by race and sex. how do I do this? Instead the table gave me---of those who answered yes to psysymps, what proportion of race/blackethn =1 were men and what prop were women? I would like to know how to code to get----what proportion of race/blackethn==1 men answered 'yes' to psysymps, compared to race/blackethn== 1 female (and also the proportion of race/blackethn ==2 men that answered yes to to psysymps, compared to race/blackethn== 2 female and associated chi2)
>>

*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index