Statalist


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

st: graphing results


From   Matthijs De Zwaan <[email protected]>
To   [email protected]
Subject   st: graphing results
Date   Wed, 9 Sep 2009 12:34:10 +0200

Dear Stata-listers,
I am trying to graph the results of my regression. I have estimated a
model with quadratic terms and an interaction, as in y=x1 + x1^2 + x2
+ x1*x2. I am trying to plot my results in a graph of y versus x1.
Using -adjust- to keep covariates doesn't do what I need, since it
also sets x1*x2 to the mean of the interaction, rather than x1*(mean
x2).

I can get what I want by plotting it using the -graph twoway function-
command. My current code looks like:
graph twoway scatter y x1 ///
|| function y = _b[_cons] + _b[x1]*x = _b[x1^2]*x^2 + _b[x2]*x2_bar +
_b[x1*x2]*x1*x2_bar ,

where x2_bar is the mean of x2 (in the estimation sample).

 However, when imported in a document, the final graph looks coarse:
more like a like a step-function than a smooth line, even when using
2500 points to graph the function instead of the default 300. Is there
a way to get a graph that produces the effect of x1 on y controlling
for covariates, but that looks better than what I have now?

Thanks for helping!
Matthijs
*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index