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: RE: more graphing


From   Nick Cox <[email protected]>
To   "[email protected]" <[email protected]>
Subject   st: RE: more graphing
Date   Tue, 5 Apr 2011 18:44:10 +0100

In principle, you must redefine your grouping variable. The principle is simple: there must be a one-to-one correspondence between the distinct values of the grouping and the distinct lines (or curves) on the scatter plot. 

However, unless you have only a very few distinct values of -age- I think only spaghetti can result from plotting this model, as -fem_age- would have so many distinct values. 

But there is a simple way to test this: 

After -regress- you can go just 

predict thismodel 
scatter thismodel age

Do you get a sense of a moderate number of lines or curves? If so, you can plot them as such. If not, you have gone too far in complicating the model for this kind of plot to work.

Nick 
[email protected] 

Averett, Susan L

Thank Nick for helping with the graphing. I have implemented it successfully. Now, I have two follow up questions related to this course.
 
First, I would like to have three regression lines on the same graph (graphing fitted lahe against age holding female and bachelor constant)

My regressions are:
regress lahe age female bachelor
regress lahe lage female bachelor
gen age2=age*age
regress lahe age2 female bachelor


And, I think the following syntax is giving me the graph I want but I am not sure. Is it taking into account the interaction
between female and age and bachelor and age? If not, do I redefine my groups or how would I do that?

gen bach_fem=bachelor*female
gen fem_age=female*age

regress lahe age age2 female bachelor bach_age bach_age2 fem_age fem_age2
predict mypredict_2e
separate mypredict_2e, by(group) veryshortlabel
scatter lahe age if lahe>=225 & lahe<=3.1, xsc(r(24 37)) || line mypredict_2e? age, sort c(L ..)


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