ajdamico / convey

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

svyzenga na.rm=F gives error instead of returning NAs #366

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)

svyzenga( ~eqincome , design = des_eusilc )

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

# works
svyzenga( ~ py010n , design = des_eusilc_rep , na.rm = TRUE )

# should return NA not error
svyzenga( ~ py010n , design = des_eusilc_rep )