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: Overlaying several regression lines from level-2 units in a single graph
From
Love Hansson <[email protected]>
To
[email protected]
Subject
st: Overlaying several regression lines from level-2 units in a single graph
Date
Tue, 22 May 2012 13:06:32 +0200
Dear statalist,
I am currently working with a 2-level dataset containing level-1
dependent and independent variables and level-2 independent variables,
connected with a level-2 group variable. I have found that one way of
visualizing the difference between level-2 units is to plot a
regression line for the level-1 independent and dependent variables in
the following fashion (similar to a Trellis plot):
graph twoway (lfit depvar indepvar), by(grpvar)
Obviously, this results in a number of graphs being plotted next to
each other. However, I would prefer it if *all* of the regression
lines could be plotted in an overlaying fashion into the same graph.
Is there any convenient way of doing this? One way of solving the
problem might be to do a "graph twoway" and then add as many "lfit"
parts as there are level-2 units, but since there are fairly many
level-2 units in my dataset I would prefer it if I could find a more
convenient solution.
Thanks in advance,
Love
*
* 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/