Announcement

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

  • How to add observations into previously defined quantiles?

    Hello,

    I am working with a dataset with approximately 1.6 million observations, with the following variables: Year (1970, 1980, 1990, 2000), Nativity (native & foreign born), Education attainment (4 categories), and Weekly wages. Below is an example of what my data looks like.

    So far, I have cells for each year & education (eg. 1970 & education level 1). For each cell I have then created 20 quantiles and sorted my native population into each of the 20 quantiles based on the distribution of weekly wages (5% with lowest weekly wage in quantile 1, and 5% with highest weekly wage in quantile 20).

    To do so, I have used the -xtile- command in STATA: egen Qtile= xtile(wklyearn) if Nat==1, by(year Edu) nq(20)


    Year Edu Nat Qtile WklyEarn
    1970 1 1 14 177.5
    1980 2 1 3 79.4
    1990 1 1 4 89.2
    2000 3 2 . 106.8
    1970 1 2 . 148.0
    ... ... ... ... ...


    For each year and education cell, I am now attempting to calculate the number of foreign-borns that belong to each quantile, based on their weekly wages.

    To be clear, I am not trying to generate new quantiles for foreign-borns, but to insert them into the quantiles I have already calculated based on natives wages.

    My aim is to determine the supply shock of immigrants for each quantile (replicating Borjas (2003)).


    I have two questions:
    1) Which command can I use in STATA to determine the wage range of each quantile (min. and max)?

    2) How can I then sort each of my foreign born into quantiles, based on wages, and with respect to each year and education cell?

    I appreciate any advice,
    Thank you!

    Pauline

  • #2
    I'd treat this as an interpolation problem, with a proviso to check any fractional results. (In easy cases the interpolation between 7 and 7 (say) automatically yields 7, and so forth, once observations are ordered on earnings (within years).

    Code:
    sort Year WklyEarn 
    ipolate Qtile WklyEarn, gen(Qtile2)   by(Year) 
    edit if floor(Qtile2) != Qtile2 
    On terminology, see http://www.statalist.org/forums/foru...income-deciles especially comments #2 (@Stephen Jenkins) and #3.

    Comment

    Working...
    X