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: Catplot for svy


From   Harini Sarathy <[email protected]>
To   [email protected]
Subject   st: Catplot for svy
Date   Sat, 21 Jan 2012 10:45:53 -0500

I'm doing survey analysis with NHANES data from 1988-2008 and have
been trying to use "catplot" to show trends in abdominal obesity over
the survey years (sddsrvyr) across age groups (agegrp):

Abdominal obesity (abdobes) is a binary/discrete variable. (0 "Normal"
1 "Abdominal Obesity"

sddsrvyr
1988-1996: 1
1999-2000: 2
2001-02    : 3
2003-04    : 4
2005-06:   : 5
2006-07    : 6

For my analysis I created subpopulations for the age groups: sub_0812,
sub_1317, sub_1840 (These subpopulations had complete data on
variables of interest).

The big picture: I have one binary variable (abdobes), two categorical
variables (sub_0812/sub_1317/sub_1840 & sddsrvyr). I want to show the
increasing trend in abdominal obesity over the survey years within
each group - but I only want to show it for abdobes==1

Proportions of obesity

. svy: prop abdobes, sub(sub_0812) over(sddsrvyr)
. svy: prop abdobes, sub(sub_1317) over(sddsrvyr)
. svy: prop abdobes, sub(sub_1840) over(sddsrvyr)

sub_0812: Abd Obese==1

_sddsrvyr_1    .1099138
_sddsrvyr_2    .1972264
_sddsrvyr_3    .205952
_sddsrvyr_4    .2562671
_sddsrvyr_5    .2243748
_sddsrvyr_6    .2589271


sub_1318: Abd Obese==1

_sddsrvyr_1    .1288447
_sddsrvyr_2    .1717575
_sddsrvyr_3    .1773453
_sddsrvyr_4    .2003957
_sddsrvyr_5    .1790184
_sddsrvyr_6    .2129547


sub_1840: Abdo Obese==1

_sddsrvyr_1    .2576976
_sddsrvyr_2    .3403194
_sddsrvyr_3    .3599359
_sddsrvyr_4    .3894223
_sddsrvyr_5    .3934921
_sddsrvyr_6     .394528

For the purposes of a graph, I created a variable sub_all to represent
all age-groups

gen sub_all=0 if sub_0812==1
replace sub_all=1 if sub_1317==1
replace sub_all=2 if sub_1840==1

The catplot command I used does not give me the graph I expected. Can
you point out where I went wrong?


catplot sddsrvyr sub_all [aweight=wtmeccombined] if abdobes==1,
percent(sub_all) asyvars bar(1, bcolor(red)) bar(2, bcolor(midgreen))
bar(3, bcolor(sandb)) bar(4, bcolor(pink)) bar(5, bcolor(ebblue))
bar(6, bcolor(orange)) vertical title("Trends in Abdominal Obesity in
NHANES population from 1988 to 2008 across age-groups",
size(medsmall)) ytitle(%)

According to the graph, I'm putting down approximations here

sub_0812: Abd Obese==1

_sddsrvyr_1    .18
_sddsrvyr_2    .13
_sddsrvyr_3    .165
_sddsrvyr_4    .18
_sddsrvyr_5    .17
_sddsrvyr_6    .175


sub_1318: Abd Obese==1

_sddsrvyr_1    .22
_sddsrvyr_2    .135
_sddsrvyr_3    .1475
_sddsrvyr_4    .17
_sddsrvyr_5    .165
_sddsrvyr_6    .175

sub_1840: Abdo Obese==1

_sddsrvyr_1    .25
_sddsrvyr_2    .1475
_sddsrvyr_3    .145
_sddsrvyr_4    .15
_sddsrvyr_5    .16
_sddsrvyr_6    .15

Given the values from the analysis, I'd expect an increasing trend in
each age group. e.g. In age group 18-40, I expected it go from 25.7%
to 39.4 %, whereas the graph shows something different.

I know the problem lies in creating the variable "sub_all"and it does
not seem to capture the information for the individual age groups.
Does anyone have any ideas about what went wrong? And what is the way
to correct it?

Harini

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