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]

# st: AW: Plotting graph for a cubic regression model

 From "Martin Weiss" To Subject st: AW: Plotting graph for a cubic regression model Date Tue, 20 Apr 2010 11:47:00 +0200

<>
Your code continues to work in Stata 11, though use of -adjust- is now
deprecated. There have been discussions about the claim "margins can do
everything that adjust did and more." (see -help adjust- in Stata 11
incarnation) on the list before (think
http://www.stata.com/statalist/archive/2009-11/msg00167.html). The first
part of your code would be

****
sysuse auto, clear
qui reg price c.mpg##c.mpg weight
****

The equivalent -margins- call to your -adjust- code should be -margins,
at((mean) weight)- from my point of view, but how one can -generate- the
variables using -margins- that -adjust- could continues to elude me... (I do
not see a -generate- option, for a start...)

HTH
Martin

-----Ursprüngliche Nachricht-----
Von: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] Im Auftrag von Sebastian van
Baal
Gesendet: Dienstag, 20. April 2010 10:44
An: statalist@hsphsun2.harvard.edu
Betreff: st: Plotting graph for a cubic regression model

Dear Stata Users:

I have a question concerning an old threat (please see below). It offers a
solution to the problem of plotting the partial effect of a predictor in a
quadratic regression model. My aim is to do the same for a cubic regression
model and the solution offered below works fine. However, since this threat
is rather old and since "adjust" seems to be out-of-use, I wonder if there
is an easier of "better" way to do it.

Any suggestions?

Thanks in advance
Sebastian

********************************************
>From   smerryman@kc.rr.com
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Plotting graph for a quadratic regression model
Date   Wed, 23 Mar 2005 06:25:53 -0600

How about something like this:

. sysuse auto
(1978 Automobile Data)

. gen mpg2 = mpg^2

. qui reg price mpg mpg2 weight

. qui adjust weight, gen(predicted)

. twoway line predicted mpg, sort || scatter price mpg

Scott

----- Original Message -----
From: Luigi Curini <luigi.curini@unimi.it>
Date: Wednesday, March 23, 2005 5:35 am
Subject: st: Plotting graph for a quadratic regression model

> Dear all,
>
> I have a question about the graph options of Stata. I have a quadratic
> regression model, and I want to graphs the estimated regression
> functionsrelating the DV and the IV of my interest for the
> quadratic specification,
> along with a scatterplot of the data. In other words, my graph
> should show
> the predicted value of the DV as a funcion of the IV of interest,
> holdingfixed other values of the IV in the regression at their
> sample averages.
> Using a normal mathematical software (I'm using MAPLE) I'm able to
> plot my
> quadratic curve, but I'm not able to superimpose into the graph
> the points
> of all my observations. Is it possible to get this graph using STATA8?
>
> I'd be really greatful for any help,
> Best regards,
> Luigi Curini
********************************************

*
*   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/

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