Hello,
I am working with simulated income distributions, and I need density values for every level of income. I have 10,000 observations and I want to use 1,000 evaluation points for my density estimation. I used the following command:
kdensity Z, n(1000) gen(x1 x2)
Where x2 is the kernal density at income level x1. Now, the problem is that this gives me 1,000 density values for 1,000 levels of income, but I need to transform this to 10,000 density values for each of my 10,000 observations of income. I do not know how to do this transformation in Stata.
I was thinking of generating a variable which equals the relevant value of x2, for every level of income below each level of x1, but I would not know how to do so in Stata.
Could anyone help me with this please?
I am working with simulated income distributions, and I need density values for every level of income. I have 10,000 observations and I want to use 1,000 evaluation points for my density estimation. I used the following command:
kdensity Z, n(1000) gen(x1 x2)
Where x2 is the kernal density at income level x1. Now, the problem is that this gives me 1,000 density values for 1,000 levels of income, but I need to transform this to 10,000 density values for each of my 10,000 observations of income. I do not know how to do this transformation in Stata.
I was thinking of generating a variable which equals the relevant value of x2, for every level of income below each level of x1, but I would not know how to do so in Stata.
Could anyone help me with this please?
Comment