topBotCoding | R Documentation |
Function for Top and Bottom Coding.
topBotCoding(obj, value, replacement, kind = "top", column = NULL)
obj |
a numeric vector, a |
value |
limit, from where it should be top- or bottom-coded |
replacement |
replacement value. |
kind |
top or bottom |
column |
variable name in case the input is a |
Extreme values larger or lower than value
are replaced by a different value (replacement
in order to reduce the disclosure risk.
Top or bottom coded data or modified sdcMicroObj-class
.
top-/bottom coding of factors is no longer possible as of sdcMicro >=4.7.0
Matthias Templ and Bernhard Meindl
Templ, M. and Kowarik, A. and Meindl, B. Statistical Disclosure Control for Micro-Data Using the R Package sdcMicro. Journal of Statistical Software, 67 (4), 1–36, 2015. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.18637/jss.v067.i04")}
indivRisk
data(free1)
res <- topBotCoding(free1[,"DEBTS"], value=9000, replacement=9100, kind="top")
max(res)
data(testdata)
range(testdata$age)
testdata <- topBotCoding(testdata, value=80, replacement=81, kind="top", column="age")
range(testdata$age)
## for objects of class sdcMicro:
data(testdata2)
sdc <- createSdcObj(testdata2, keyVars=c('urbrur','roof','walls','water','electcon','relat','sex'),
numVars=c('expend','income','savings'), w='sampling_weight')
sdc <- topBotCoding(sdc, value=500000, replacement=1000, column="income")
testdataout <- extractManipData(sdc)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.