Learn R Programming

simPop (version 0.3.0)

utility: Utility measures

Description

Various utility measues that basically compares two data sets

Usage

utility(x, y, type = c("all", "compareColumns", "compareRows", "compareRowsHH", "compareNA"), hhid = NULL)
utilityModal(x, y, varx, vary = NULL)
utilityIndicator(x, y)

Arguments

x
a data.frame, typically the original data set. For utilityIndicator this should be a vector of length 1.
y
a data.frame, typically the corresponding synthetic data set. For utilityIndicator this should be a vector of length 1.
type
which measure
  • compareColumnscompares the intersection of variables
  • compareRowscompares the number of rows
  • compareRowsHHcompares the number of housholds
  • compareNAcompares the number of missings
hhid
index or name of variable containing the houshold ID
varx
name or index of a variable in data.frame x
vary
NULL or name or index of a variable in data.frame y corresponding to variable varx in data.frame x. If NULL, the names of the selected variable should be the same in both x and y.

Value

the measure(s) of interest

Functions

  • utility: comparisons of two data sets
  • utilityModal: comparison of number of categories
  • utilityIndicator: difference between two values

Examples

Run this code
data(eusilcS)
data(eusilcP)
## for fast caluclations, took a subsample
eusilcP <- eusilcP[1:15000, ]
utility(eusilcS, eusilcP)
data(eusilcS)
data(eusilcP)
utilityModal(eusilcS, eusilcP, "age")
utilityModal(eusilcS, eusilcP, "pl030", "ecoStat")
data(eusilcS)
data(eusilcP)
m1 <- meanWt(eusilcS$age, eusilcS$rb050) 
m2 <- mean(eusilcP$age)
utilityIndicator(m1, m2)

Run the code above in your browser using DataLab