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 on April 23, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: Margins and Marginsplot


From   Masha Zakharova <mzakharo@sfu.ca>
To   statalist@hsphsun2.harvard.edu
Subject   st: Margins and Marginsplot
Date   Thu, 23 May 2013 23:55:33 -0700 (PDT)

Dear StataList,

I have a question on creating a plot for interaction of continuous and dummy variables. I have a linear model with two covariates and their interaction. I would like to get a plot that is NOT a straight line (i.e., that would show me what happens at given values of continuous variable). So in one model, the non-dummy variable is integer, and when I run following command:

reg valence subj  subj_cross subj_cross#subj if election==7, cluster(id)
margins subj#subj_cross
marginsplot

(where subj is a variable that denotes distance and it only has integer values, and subj_cross is a dummy variable)

- I get the plot that I need - 2 lines for each value of the dummy variable, and the lines are not straight  so they show at which level of distance the effect starts to change.

However, when I try running a command for a model where distance variable contains non-integer values, I get only straight lines.
So when I run this command:

reg valence c.obj cross cross#c.obj if election==7, cluster(id)
margins cross, at(obj=(0(1)11))
marginsplot

It just gives me two straight lines with different slopes. So my question is, is there any way to create a plot for this second model that would show me NON-STRAIGHT lines (so that I can see at which value of distance the effect starts to change)

Thanks a lot,
Masha
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


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