简体   繁体   中英

Creating a Lorenz curve with the R convey package

I've been working with the convey package and have run into an issue that I'm not sure how to address.

I'm trying to create a Lorenz curve based on a svyrepdesign of 11 years of ACS PUMS data that I created, then ran convey_prep on before subsetting down to a single year. When I run the following line:

`svylorenz(~INCSIM, test, seq(0, 1, .1), alpha = 0.05, na.rm=TRUE)`

I get NAs in each quantile bin and the following warning:

There were 50 or more warnings (use warnings() to see the first 50)

`Warning messages:
1: In sum(weights[weights != 0] * x[weights != 0]) :
  integer overflow - use sum(as.numeric(.))
2: In sum(weights[weights != 0] * x[weights != 0]) :
  integer overflow - use sum(as.numeric(.))`

.....repeated 50 times

Not sure what I'm doing wrong but would appreciate any thoughts!

Ah - I discovered the problem. For some reason, the income variable in my data frame was stored as an integer, though most everything else is numeric. Changing it to numeric solved the problem.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM