Announcement

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

  • how to derive variables containing percents to graph demand curves

    Hello all, I am trying to graph demand curves in Stata 16. I have found a few code examples using lpolyci and twoway line or qfit. The code for these examples require I create a variable that contains a percent with the pctile command or something like gen lexp_pct=normal(lexp_std) * 100 and use that variable in conjunction with the variable that measured demand, in my case prem18, a continuous variable. I have been able to create the the variable that contains percents with these options but when I run the demand curve code and use the percent variable I created I get a curve that is inverted. So instead of running from top left to bottom right as I expect a demand curve to look like it produces a curve that rungs from top right to bottom left. Any suggestions on what I am doing wrong in creating the variable containing the percent or the demand curve?

    /// creates var containing percent
    egen prem18 = std(Prem) if SurveyRound==1
    sort prem18
    gen prem18_pct=normal(prem18) * 100

    /// creates demand curve
    twoway qfit prem2018 prem18_pct


Working...
X