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: graphing results from multilevel model [Was: Re: st: Thread-index: AQHNYz]
From
Maarten Buis <[email protected]>
To
[email protected]
Subject
Re: graphing results from multilevel model [Was: Re: st: Thread-index: AQHNYz]
Date
Mon, 16 Jul 2012 13:47:51 +0200
On Mon, Jul 16, 2012 at 12:40 PM, Brendan Churchill wrote:
> xtmixed atwkwrl[attitude variable] age cohort agexcohort i.educationhistory
> i.employment sex || pid: age, cov(un) variance mle
> I've heard about the -marginsplot- command, but I have unsuccessfully been
> able to execute that….
You did not say what you typed when you tried -marginsplot- and you
did not say what Stata told you in return, so it is hard to comment on
what you did wrong. However, in order to use -marginsplot- correctly
you should not create the interaction terms yourself, but use the
factor variable notation, see: -help fvvarlist-.
> To produce a graph from the model. I use the 'predict' function and I try
> produce a line graph, I'm interested in the how the cohorts differ in their
> attitudinal scores
>
> twoway (line prediction age if cohort==1, sort) (line prediction age if
> cohort==2, sort) etc….
>
> When the graph is produced, the lines are connected and look like odd tree
> branches. I've tried to sort the data before producing the graph and
> sometimes that makes it a little clearer, but it's still connected like odd
> tree branches
As for the "tree-like" appearance of your graph, it seems to me that
you did not fix the values of the other covariates. See e.g.:
<http://www.hsph.harvard.edu/cgi-bin/lwgate/STATALIST/archives/statalist.1207/date/article-535.html>
-- 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/