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: graphing results from multilevel model [Was: Re: st: Thread-index: AQHNYz]


From   Brendan Churchill <[email protected]>
To   "<[email protected]>" <[email protected]>
Subject   Re: graphing results from multilevel model [Was: Re: st: Thread-index: AQHNYz]
Date   Mon, 16 Jul 2012 10:40:52 +0000

Thanks Maarten again for your reply :)


I'm using the 'xtmixed' function for a growth curve model to measure attitudinal change (higher score = more conservative, lower score= more egalitarian) across age and cohorts. For example:

xtmixed atwkwrl[attitude variable] age cohort agexcohort i.educationhistory i.employment sex || pid: age, cov(un) variance mle
 
educationhistory and employment are categorical variables that I use the i. function to turn the responses into individual dummy variables. 

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

I think what affects this is the use of the dummy variables etc….as in that the graph shows up the prediction results for both sexes - men and women 

I've heard about the -marginsplot- command, but I have unsuccessfully been able to execute that….

Does that assist, or more information needed???

Thanks again Maarten! 

Brendan 


On 16/07/2012, at 8:14 PM, Maarten Buis wrote:

On Mon, Jul 16, 2012 at 11:28 AM, Brendan Churchill wrote:
What is the best way to graph results from a multilevel model in Stata? I’ve tried the *predict* command but because I am using binaries and centred variables when I try to produce a graph – it looks a total mess. I have tried graphing by generating a variable made up of the coefficients, which yields better results (or rather better looking results) but when I add in binary variable coefficients or categorical coefficients again I have similar issues.

Any advice? Or do you need more information?

Yes, we need a lot more information. From this question it is really
hard to determine what you are trying to achieve, what you did exactly
(which multi-level model, which graph command, etc. etc.), and what
you consider a "total mess". So that makes this question virtually
impossible to answer. You might want to look into -marginsplot-, or
rephrase the question.

-- 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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index