Announcement

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

  • Help with Quantile comparison

    Good afternoon,
    Thanks for the support and for welcoming me into this community.

    As an assignment I am supposed to replicate the creation of a variable in Stata, which represents the probability a wife earns more than her husband, as per method used in the paper.

    To fulfill the assigment we split the sample into 72 different groups based in demographic characterics. For each of those 72 different groups we have to find 10 quantiles of logarithmetic household income for the wife, and we have to find the average for each quantile.

    The average of logarithmetic for the wage of the quantile is then compared to the logarithmetic of the individual salary of each man in the demographic function,


    PrWifeEarnsMorei = 1/n SUM (1) if average quantile of wife salary > ln husband incomei

    I have no idea in how I can replicate this variable.

    I have done the quantiles and the individual husband for the salary but I have no idea in how to do the sum
    . gen quant=.
    forvalues i=1/72 {
    capture drop xq
    xtile xq=REND_MENS_TOT if GRUP_DEMO_WF==`i', nq(10)
    replace quant=xq if GRUP_DEMO_WF==`i'
    }

    . egen SAL_MED_WIF_QUANT = mean(REND_MENS_TOT), by(quant)

    . egen LN_SAL_MED_WIF_QUANT = log (SAL_MED_WIF_QUANT)

    . egen LN_SAL_HOMEM = log (REND_MENS_TOT) if (SEXO==1 & ESTADO_CIVIL==1 & VIVE_C_CONJ==1 & IDADE_ANOS >=18 & IDADE_ANOS <= 65)
    I then have to compare LN_SAL_HOMEM as husband income, for each demographic group (GRUP_DEMO) with the average logarithmetic income of each of the 10 different quantile. I then have to sum all of the quantiles that have a larger average income, and divide by the total number of quantiles (10 in this case), to form this new variable PrWifeEarnMore.

    I am desperate as I have no idea in how I can accomplish this feat.

    Attached Files
    Last edited by Pedro Camargo; 09 Mar 2020, 10:26.
Working...
X