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
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
Comment