Quantcast
Channel: Statalist
Viewing all articles
Browse latest Browse all 73258

Multi-nominal regression interactions with margins and margin plots

$
0
0
Hi everyone,

Does anyone know how to do the margin command for multinominal regression for a certain outcome?

I'm trying to get margins to plot school year's use of energy drinks over time using repeated cross-sectional data.

The mlogit command is (I want sugar2=0 to be the reference category):
Code:
mlogit sugar2 i.schlyear##c.year gender ethnic2 ses, base(0)
Code:
margins, at(year=(1998 2000 2002 2004 2006 2009 2013 2014 2015 2017) schlyear=(1 2 3 4 5 6 7))
Code:
 marginsplot
But this gives me the margins for outcomes 0, 1 and 2. I just would like outcome 1 and 2 to be separate graphs as it is too much in one graph.

I have tried various ways of plotting margins but stata has returned errors.

e.g.

1)
Code:
margins, at(year=(1998 2000 2002 2004 2006 2009 2013 2014 2015 2017) schlyear=(1 2 3 4 5 6 7)), predict(outcome(#1))
invalid 'predict' 
2)
Code:
. margins schlyear##year, predict(outcome(#1))
factor 'year' not found in list of covariates
3)
Code:
margins i.schlyear##c.year, predict(outcome(#1))
only factor variables and their interactions are allowed
4)
Code:
 . margins schlyear year, predict(outcome(#1))
factor 'year' not found in list of covariates


P.S.
Details of variables:
sugar2 = sugary drinks (never, weekly, daily) 0=base/reference category
schlyear = school year (1-7)
year = wave of data (1998 - 2017)
gender = boy (1) girl (2)
ethnic2 = white (1) BAME (2)
ses = high (0) low (1)

Any help would be greatly appreciated! Thanks in advance.

Viewing all articles
Browse latest Browse all 73258

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>