Fixed issue if parameter period was type haven::labelled in calc.stError().
Refactored code to make use of new data.table variable env. Makes code more readable and stable.
calc.stError() has new parameter group.diff. If group.diff=TRUE differences between values defined in group will also be calculated. For instance
library(surveysd)
set.seed(1234)
eusilc <- demo.eusilc(n = 4,prettyNames = TRUE)
dat_boot <- draw.bootstrap(eusilc, REP = 3, hid = "hid", weights = "pWeight",
strata = "region", period = "year")
dat_boot_calib <- recalib(dat_boot, conP.var = "gender", conH.var = "region")
# estimate weightedRatio for povertyRisk per period
err.est <- calc.stError(dat_boot_calib, var = "povertyRisk",
fun = weightedRatio, group = "gender",
group.diff = TRUE)
will produce difference in poverty rate between male and female, in addition to other estimates.
Updated vignette accordingly.
Fixed bug with parameter adjust.var and fun.adjust.var in function calc.stError().
Changed parameter national to relative.share in calc.stError() included a deprecate-message if national = TRUE is supplied.
Fixed issue with parameter looseH in function ipf().
Fixed bug that variables names created by internal functions where not properly cleaned up before returning data.table output.
Improved summary.ipf() and included print.summary.ipf() in order to make the output of ipf() as well as convergence issues when using ipf() more intuitive.
New parameter method in draw.bootstrap() and rescaled.bootstrap(). Can bei either "Preston" or "Rao-Wu", see ?draw.bootstrap() or the new vignette.
draw.bootstrap() can now be used to draw bootstrap replicates if bootstrap replicates where drawn for previous year with parameter already.selected. already.selected expects a list of data.tables indicating if a record was already included in a bootstrap replicates in the previous period
New function get.selection() to create input for parameter already.selected in draw.bootstrap().
Updated and included (more) unit tests.
rescaled.bootstrap() has additional parameter period which is identical to the one in draw.bootstrap. If period is not NULL the boostraps will be drawn such that in each period and strata/cluster only $\floor{\frac{n}{2}}$ records are drawn. This produces more consisten results and should make calibration afterwards easier.computeLinearG1 for use with ipf(). computeLinearG1 is now more stable when only numerical variables are used for weighting.numericalWeighting can be passed to recalib and will correctly be passed along to function ipfipf() to trim weightsipf()recalib() accepts conP and conH in the same way as ipfrecalib() has arguments epsP and epsH, to make convergence limits more transparantipf() when supplying hid="hid", see https://github.com/statistikat/surveysd/pull/20. Thanks @asiripanichdemo.eusilc() for all examples and unit tests in this packagerecalib() without specifying conP.vars or conH.varssimPop::ipu2() and some related functions to surveysd.
... argument in calc.stErrordraw.bootstrap to downstream functionsdraw.bootstrap and include prettyNames argument.
update documenentation examples to use new variable nameslaeken and data.table in examplesvignettes/TheoryWord.Rmd into a dynamic markdown file
describing the methodology of the package