Announcement

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

  • how to draw a graph of distribution when x axis is continuous varible while y axis is categorical value

    Dear experts
    I am new to this forum and I want to thank you in advance for any help.
    Varible1 is categorical of yes or no, varible2 is continuous variable with 10000 values. I want to know the estimated rate of yes in each value of variable2 and make the curve smooth. I use "twoway fpfitci varible1 varible2" and it doesn' work.
    Thank you
    Kai-Lun
    Last edited by Kai-Lun Hu; 21 Apr 2020, 08:15.

  • #2
    Hi Kai
    two questions:
    1. Why do you think "twoway fpfitci varible1 varible2" does not work?
    2. If instead of 10000 variable 2 had only 100 values, how would you calculate what you need to do?
    One possible solution. Have you tried "lpoly". Or look into semiparametric regression analysis?
    Fernando

    Comment


    • #3
      Originally posted by FernandoRios View Post
      Hi Kai
      two questions:
      1. Why do you think "twoway fpfitci varible1 varible2" does not work?
      2. If instead of 10000 variable 2 had only 100 values, how would you calculate what you need to do?
      One possible solution. Have you tried "lpoly". Or look into semiparametric regression analysis?
      Fernando
      Hi Fernando
      Thank you for your response.
      Maybe the problem is that I don't know how to change the variable 1 into percentage. logic regression shows that variable 2 is significantly associated with variable1. But I want to use a graph to express.
      Kailun

      Comment


      • #4
        So something like this:
        Code:
        . webuse lbw
        two fpfit low age || lpoly low age
        which still raises the question, why does lpfit does not "work" for you?
        And what about my point 2. How would yo do this, if instead of 10000 values you had only 100, or 20?

        Comment


        • #5
          Originally posted by FernandoRios View Post
          So something like this:
          Code:
          . webuse lbw
          two fpfit low age || lpoly low age
          which still raises the question, why does lpfit does not "work" for you?
          And what about my point 2. How would yo do this, if instead of 10000 values you had only 100, or 20?
          If their were only 20, I think it is meaningless to do that. I would rather use variable1 as the x axis to compare the mean value of variable2. in your code, the problem still exists, that is y axis is the exact value of low. what i want is y axis should be the percentage of low birthweight in each value of age.

          Comment

          Working...
          X