Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Cubic polynomial graph

    Dear All

    I run a cubic regression in stata like y=a+b*x+b*x^2+b*x^3

    I use this command to graph it twoway (qfitci y x) , but it provides only for squared variable. Can anyone help me on how to obtain graph for cubic form as x^3 is significant too in the regression.

    Thanks in advance.

  • #2
    Welcome to the Stata Forum / Statalist,

    I suggest you take a look at - margins - and - marginsplot - command, for there you'll get a helpful machinery concerning such graphics.
    Best regards,

    Marcos

    Comment


    • #3
      Thanks Marcos. I will have a look. As far I know from searching, I think there is no a simple way to do that. i.e. user-friendly stata thing.

      Comment


      • #4
        It's very very simple, as Marcos pointed out in #2:
        Code:
        regress y c.x##c.x##c.x
        margins, at(x = (0(1)10))
        marginsplot
        Note: the (0(1)10) part is just for illustration of the technique. You should replace it by an appropriate number list that covers the range of interest for variable x.

        Another very simple way is:
        Code:
        regress y c.x##c.x##c.x
        predict yhat
        graph twoway line yhat x, sort

        Comment


        • #5
          Many thank Clyde. That works very well now. appericate it..

          Comment

          Working...
          X