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]

RE: FW: st: Plotting several linear associations in one graph for comparison


From   Amal Khanolkar <[email protected]>
To   "[email protected]" <[email protected]>
Subject   RE: FW: st: Plotting several linear associations in one graph for comparison
Date   Mon, 16 Jul 2012 14:10:03 +0000

Hi again,

It worked perfectly! I got a beautiful graph - which is not modern art for sure :)  My main aim was to plot the association between systolic BP (syst) and birth weight (bwtgestage_sd) by different countries (motherland). My covariates include age (in years), birth year (byear), examination office, BMI, height, & maternal education.

This is what I did:

regress syst bwtgestage_sd age byear i.conscript_office bmi height_cons i.education if multibirth==1 & motherland2==1
est store white
regress syst bwtgestage_sd age byear i.conscript_office bmi height_cons i.education if multibirth==1 & motherland2==2
est store black
regress syst bwtgestage_sd age byear i.conscript_office bmi height_cons i.education if multibirth==1 & motherland2==3
est store blue
regress syst bwtgestage_sd age byear i.conscript_office bmi height_cons i.education if multibirth==1 & motherland2==4
est store green
regress syst bwtgestage_sd age byear i.conscript_office bmi height_cons i.education if multibirth==1 & motherland2==5
est store yellow
regress syst bwtgestage_sd age byear i.conscript_office bmi height_cons i.education if multibirth==1 & motherland2==6
est store red


preserve
replace age = 18
replace byear = 1987
replace examination_office = 3
replace bmi = 22.40
replace height = 180
replace education = 2
bys motherland bwtgestage_sd : keep if _n == 1

est restore white
predict yhat1 if motherland2 == 1
est restore black
predict yhat2 if motherland2 == 2
est restore blue
predict yhat3 if motherland2 == 3
est restore green
predict yhat4 if motherland2 == 4
est restore yellow
predict yhat5 if motherland2 == 5
est restore red
predict yhat6 if motherland2 == 6


twoway line yhat1 yhat2 yhat3 yhat4 yhat5 yhat6 bwtgestage_sd
restore

- I understand the need for the replace commands. But as above, I think I introduce bias by narrowing the study population down to a very small proportion of the true study population. I tried choosing for example, mean BMI, and height, and the largest category of maternal education with most number of subjects. Most of my subjects are aged 18 (around 90% of them), but restricting it to just one birth year, means I loose most of the population. Is it possible in my example above to select select a range of birth years (all birth years for example, from 1973 to 2008), maybe include more maternal educational categories?? I could then obtain a graph for a study population with greater variation right?

Thanks!

/Amal 
________________________________________
From: [email protected] [[email protected]] on behalf of Maarten Buis [[email protected]]
Sent: 16 July 2012 15:22
To: [email protected]
Subject: Re: FW: st: Plotting several linear associations in one graph for comparison

On Mon, Jul 16, 2012 at 3:10 PM, Amal Khanolkar wrote:
> how did you 'fix' the covariates, i.e how did you choose the 1, 40 & 15 in your example below?
>
> // the correct graph (again)
> preserve
> replace union = 1
> replace hours = 40
> replace ttl_exp = 15

You just choose reasonable values, e.g. I chose to look at a union
member who worked the regular (40) hours a week. For work experience I
looked for the closest "nice" number near the average amount of work
experience. So, in general you need to use your knowledge of the
context and use that to decide what values are interesting and/or
typical.

-- Maarten

--------------------------
Maarten L. Buis
Institut fuer Soziologie
Universitaet Tuebingen
Wilhelmstrasse 36
72074 Tuebingen
Germany


http://www.maartenbuis.nl
--------------------------
*
*   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/

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