Announcement

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

  • How to implement random draws from a dagum distribution?

    Hi Statalisters,

    I have grouped income data and used dagfit to fit a dagum distribution to this data. From this I get the the parameter estiamtes for a,b and p. Now I would like draw a random sample N from this the fitted dagum distribution. If I understand correctly this can be done using inverse transformation sampling. After I load the data into Stata my code looks as follows:

    dagfit nbtotal, z1(bracketbeg) z2(bracketend)

    gen b = e(bb)
    gen a = e(ba)
    gen p = e(bp)
    keep a b p
    duplicates drop

    expand 1000 // size of random sample
    gen runif=runiform()
    gen randomdagum = (1 + (runif/e(bb))^-1*e(ba))^e(bp) // inverse CDF of a Dagum Distribution

    Would you consider this to be the correct way to do this?

    Best regards,
    Florian

  • #2
    [duplicate post]. I haven't checked your specific code, but use of the inversion approach seems fine in principle to me

    Comment


    • #3
      Dear Florian,

      your formula for random Dagum variates wron uses a reciprocal of Dagum CDF, not the inverse of the CDF. The inverse, that is quantile function, is:
      F-1(u) = b(u-1/p -1)-1/a, where u is uniform variate generated by runiform().

      Hope this helps,
      Michal

      Comment

      Working...
      X