Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


[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 <maartenlbuis@gmail.com>
To   statalist@hsphsun2.harvard.edu
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/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index