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

Margins - plotting the effect of income and income-squared simultaneously

$
0
0
I'm using margins to plot the results of a melogit model. I'm predicting individual voting outcomes, and think that the effect of income might not be monotonic. In order to address my concerns I've added in an income-squraed measure. Is there a way that I can use margins (or any other plotting command) to plot the combined effect of both of my income measures on one line? Below is a sample of the code that I've been running, but with a simplified model. The fam_inc_2012t and fam_inc_2012t_sq are the two measures that I want to plot simultaneously. Any help would be greatly appreciated!

set more off
svyset fips, weight1(vector) || _n, weight2(cces2012_weights)
svy: melogit ind_obama_vote_2012 c.fam_inc_2012t c.fam_inc_2012t_sq c.percent_white ///
if white_2012==0 || fips:
outreg2 using icome_melogit_sq.doc, replace

******calculates predited probabilities
margins, at(fam_inc_2012t =(1(1)14)) atmeans vsquish
mat b3=r(b)'
set more off
svyset fips, weight1(vector) || _n, weight2(cces2012_weights)


svy: melogit ind_obama_vote_2012 c.fam_inc_2012t c.fam_inc_2012t_sq c.percent_white ///
if white_2012==1 || fips:
outreg2 using income_melogit_sq.doc, append

******calculates predited probabilities
margins, at(fam_inc_2012t =(1(1)14)) atmeans vsquish
mat b4=r(b)'

****** Saves predicted probabilities as viariables
svmat b3
svmat b4

***** creates another variable for the x-axis
mat x=(1\2\3\4\5\6\7\8\9\10\11\12\13\14)
svmat x

Viewing all articles
Browse latest Browse all 72772

Trending Articles



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