Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: RE: Graphing ploynomial relationships after a regression


From   Tinna <statalist@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: RE: Graphing ploynomial relationships after a regression
Date   Tue, 18 Oct 2005 14:21:41 -0400

I wish I had as much to contribute as you guys, but I am just
learning... fast with your help, I might add. I hope to pay the list
back with serious contributions in the future... give me 2 years :)
Tinna

On 10/18/05, Nick Cox <n.j.cox@durham.ac.uk> wrote:
> That's good. Do join in.
>
> Nick
> n.j.cox@durham.ac.uk
>
> > -----Original Message-----
> > From: owner-statalist@hsphsun2.harvard.edu
> > [mailto:owner-statalist@hsphsun2.harvard.edu]On Behalf Of Tinna
> > Sent: 18 October 2005 19:02
> > To: statalist@hsphsun2.harvard.edu
> > Subject: Re: st: RE: Graphing ploynomial relationships after a
> > regression
> >
> >
> > Hello Maarten and Nick,
> >
> > I do not mean to stop your discussion, which I am learning a bunch
> > from, but I wanted to thank you and tell you that I have my desired
> > graph now.
> >
> > Tinna
> >
> > On  10/18/05, Nick Cox <n.j.cox@durham.ac.uk> wrote:
> > > As a model gets more complex, it is less likely that it can
> > > be presented by a graph. y = polynomial(x) is one exception, but
> > > in practice even cubics over a whole range are unlikely to be
> > > useful, in my experience.
> > >
> > > But, more to the point, a model gets more complex, you have _more_
> > > to type as you spell out each term as _b[varname] *
> > varname. -predict-
> > > does this all for you. And this is error-prone.
> > >
> > > Other than the occasional pedagogic advantage of underlining
> > > what is being done, i.e. plugging estimates into a model
> > > formula, I can't understand your preference here.
> > >
> > > Nick
> > > n.j.cox@durham.ac.uk
> > >
> > > Maarten Buis
> > >
> > > > True, though I find it easier to continue to use my approach
> > > > when my model gets more complex.
> > > >
> > > > n j cox wrote:
> > > >
> > > > > Even with Maarten's example, things can be made
> > > > > simpler. Starting as before,
> > > > >
> > > > > sysuse auto, clear
> > > > > gen weight2 = weight^2
> > > > > reg price weight weight2
> > > > >
> > > > > if you
> > > > >
> > > > > predict quad
> > > > > twoway mspline quad weight || scatter price weight
> > > > >
> > > > > you get the data shown as well.
> > > > >
> > > > > Alternatively, if you install the -modeldiag- package
> > > > > from either SSC or the Stata website, then
> > > > >
> > > > > predict quad
> > > > > regplot
> > > > >
> > > > > will give you the same graph. This is because -regplot-
> > > > > defaults to a plot of the observed and predicted response
> > > > > against the first predictor named.
> > > > >
> > > > > Maarten Buis
> > > > >
> > > > > sysuse auto, clear
> > > > > gen weight2 = weight^2
> > > > > reg price weight weight2
> > > > > sum weight
> > > > > twoway function y = _b[_cons]+_b[weight]*x+_b[weight2]*x^2,
> > > > range(1760
> > > > > 4840)
> > > > >
> > > > >
> > > > > Tinna
> > > > >
> > > > > I am using an independent variable in its regular and
> > > > squared forms in
> > > > > an OLS and 2SLS regressions.  Can I graph this polynomial
> > > > relationship
> > > > > as indicated by the regression in an easy way?
>
> *
> *   For searches and help try:
> *   http://www.stata.com/support/faqs/res/findit.html
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/
>

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



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