ajdamico / convey

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

svyrich na.rm=T not working for linearized designs #367

Closed ajdamico closed 1 year ago

ajdamico commented 1 year ago
library(convey)
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 )

# replicate-weighted design
des_eusilc_rep <- as.svrepdesign( des_eusilc , type = "bootstrap" )
des_eusilc_rep <- convey_prep( des_eusilc_rep )

# correctly NA
svyrich(~py010n, des_eusilc, type_measure = "FGTT1" , g=0,  abs_thresh=30000)
# correctly NA
svyrich(~py010n, des_eusilc_rep, type_measure = "FGTT1" , g=0,  abs_thresh=30000)

# incorrectly NA
svyrich(~py010n, des_eusilc, type_measure = "FGTT1" , g=0,  abs_thresh=30000,na.rm=T)
# correctly returns a value
svyrich(~py010n, des_eusilc_rep, type_measure = "FGTT1" , g=0,  abs_thresh=30000,na.rm=T)