sdcTools / sdcMicro

sdcMicro
http://sdctools.github.io/sdcMicro/
79 stars 22 forks source link

data utility measures in sdcApp error #222

Closed matthias-da closed 6 years ago

matthias-da commented 7 years ago
require(sdcMicro)
inputdata <- readMicrodata(path="eusilc", type="rdf", convertCharToFac=FALSE, drop_all_missings=FALSE) # load first 
# library(laeken)
# data(eusilc)
# inputdata <- eusilc
inputdataB <- inputdata

inputdata <- varToFactor(obj=inputdata, var="hsize")
inputdata <- varToFactor(obj=inputdata, var="age")
## Set up sdcMicro object
sdcObj <- createSdcObj(dat=inputdata,
        keyVars=c("hsize","db040","age","rb090","pl030","pb220a"),
        numVars=c("eqIncome"),
        weightVar=c("rb050"),
        hhId=c("db030"),
        strataVar=NULL,
        pramVars=NULL,
        excludeVars=NULL,
        seed=0,
        randomizeRecords=FALSE,
        alpha=c(1))

## Recode variable
sdcObj <- groupAndRename(obj=sdcObj, var="pb220a", before=c("EU","Other"), after=c("EU_Other"), addNA=FALSE)
## Local suppression to obtain k-anonymity
sdcObj <- kAnon(sdcObj, importance=c(4,5,6,1,3,2), combs=NULL, k=c(3))

Now go to data utility (tabulations or any other): error.

bernhard-da commented 7 years ago

can't reproduce

matthias-da commented 7 years ago

Tried it with several data sets E.g. also with FIES

require(sdcMicro)
inputdata <- readMicrodata(path="fies06", type="rdf", convertCharToFac=FALSE, drop_all_missings=FALSE)
inputdataB <- inputdata

inputdata <- varToFactor(obj=inputdata, var="z2011_h_sex")
inputdata <- varToFactor(obj=inputdata, var="z2021_h_age")
inputdata <- varToFactor(obj=inputdata, var="z2041_h_educ")
## Set up sdcMicro object
sdcObj <- createSdcObj(dat=inputdata,
        keyVars=c("z2011_h_sex","z2021_h_age","z2041_h_educ"),
        numVars=c("wages"),
        weightVar=c("wsag"),
        hhId=NULL,
        strataVar=NULL,
        pramVars=NULL,
        excludeVars=NULL,
        seed=0,
        randomizeRecords=FALSE,
        alpha=c(1))

In Risk/Utility go now to "Tabulations" for example. Please try it once more to get sure. If you cannot reproduce, I will check further what is happen on my machine.

bernhard-da commented 7 years ago

ah ok, for plots I was able to reproduce. but not for tabulations. where is the fies06 data available?

bernhard-da commented 7 years ago

I can't reproduce the problem (e.g. tabulation) with the fies06 dataset either.

bernhard-da commented 6 years ago

@matthias-da i'll close this now. if you still can reproduce this, just repoen.