Learn R Programming

sdcMicro (version 2.0.4)

freqCalc: Frequencies calculation for risk estimation

Description

Fast computation of frequencies (counts) with which is 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 the whole population.

Value

  • Object from class freqCalc.
  • freqCalcdata
  • keyVarskeyVars
  • windex of weight vector. NULL if you do not a sample.
  • indexG
  • fkthe frequency of equal observations in the key variables subset sample given for each observation.
  • Fkestimated frequency in the population
  • n1amount of observations with fk=1
  • n2amount of observations with fk=2

Details

The function considers the case of missing values in the data. A missing value stands for any of the possible categories of the variables considered.

References

look e.g. in http://neon.vb.cbs.nl/casc/Deliv/12d1.pdf

See Also

indivRisk

Examples

Run this code
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

Run the code above in your browser using DataLab