freqCalc {sdcMicro}R Documentation

Frequencies calculation for risk estimation

Description

Fast computation and estimation of the sample and population frequency counts which is also needed for risk estimation.

Usage

freqCalc(x, keyVars = 1:3, w = 4)

Arguments

x data frame or matrix
keyVars key variables
w column index of the weight variable. Should be set to NULL if one deal with a population.

Details

The function considers the case of missing values in the data. A missing value stands for any of the possible categories of the variable considered. It is possible to apply this function to large data sets with many (catergorical) key variables, since the computation is done in C.

Value

Object from class freqCalc.

freqCalc data
keyVars keyVars
w index of weight vector. NULL if you do not a sample.
indexG
fk the frequency of equal observations in the key variables subset sample given for each observation.
Fk estimated frequency in the population
n1 amount of observations with fk=1
n2 amount of observations with fk=2

Author(s)

Bernhard Meindl and Matthias Templ

References

look e.g. in http://neon.vb.cbs.nl/casc/Deliv/12d1.pdf Templ, M. Statistical Disclosure Control for Microdata Using the R-Package sdcMicro, Transactions on Data Privacy, vol. 1, number 2, pp. 67-85, 2008. http://www.tdp.cat/issues/abs.a004a08.php

Templ, M. New Developments in Statistical Disclosure Control and Imputation: Robust Statistics Applied to Official Statistics, Suedwestdeutscher Verlag fuer Hochschulschriften, 2009, ISBN: 3838108280, 264 pages.

See Also

indivRisk

Examples

data(francdat)
f <- freqCalc(francdat, keyVars=c(2,4,5,6),w=8)
f
f$freqCalc
f$fk
f$Fk
## with missings:
x <- francdat
x[3,5] <- NA
x[4,2] <- x[4,4] <- NA
x[5,6]  <- NA
x[6,2]  <- NA
f2 <- freqCalc(x,  keyVars=c(2,4,5,6),w=8)
f2$Fk

[Package sdcMicro version 2.6.4 Index]