ajdamico / convey

variance of distribution measures estimation of survey data
GNU General Public License v3.0
17 stars 7 forks source link

proofread of 1.7 #441

Closed ajdamico closed 8 months ago

ajdamico commented 9 months ago

20231110_105101

ajdamico commented 9 months ago

also talk about this

https://www.ft.com/content/41470ec0-845b-11db-87e0-0000779e2340

ajdamico commented 8 months ago

@guilhermejacob do you agree with this calculation?

https://www.ft.com/content/41470ec0-845b-11db-87e0-0000779e2340

Personal wealth is distributed so unevenly across the world that the richest two per cent of adults own more than 50 per cent of the world’s assets while the poorest half hold only 1 per cent of wealth.

richest_two_percent_cutoff <- svyquantile( ~ variable , design , 0.02 )

svyratio( ~ ifelse( variable >= coef( richest_two_percent_cutoff ) , variable , 0 ) , ~ variable , design )

poorest_half_cutoff <- svyquantile( ~ variable , design , 0.5 )

svyratio( ~ ifelse( variable < coef( poorest_half_cutoff ) , variable , 0 ) , ~ variable , design )

table showing these results (importantly with confidence intervals!!) using cps hhincome & worker earnings, pnadc per capita income & worker earnings, scf hh income & net worth

ajdamico commented 8 months ago
library(survey)
library(laeken)
data(eusilc) ; names( eusilc ) <- tolower( names( eusilc ) )

# linearized design
des_eusilc <- svydesign( ids = ~rb030 , strata = ~db040 ,  weights = ~rb050 , data = eusilc )
des_eusilc <- convey_prep( des_eusilc )

(result <- svylorenz( ~eqincome , des_eusilc, 0.98 , plot= FALSE))

# for each dataset for each variable:
1 - coef( result )
SE( result )
confint(result)
ajdamico commented 8 months ago

any edits to https://github.com/guilhermejacob/context/pull/37 ? thaaaanks

guilhermejacob commented 8 months ago

nah, it looks ok

ajdamico commented 8 months ago

thank you!