Learn R Programming

simPop (version 2.1.3)

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)

Value

the measure(s) of interest

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

compareColumns

compares the intersection of variables

compareRows

compares the number of rows

compareRowsHH

compares the number of housholds

compareNA

compares 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.

Functions

  • utility(): comparisons of two data sets

  • utilityModal(): comparison of number of categories

  • utilityIndicator(): difference between two values

Author

Matthias Templ, Maxime Bergeaut

Examples

Run this code
data(eusilcS)
data(eusilcP)
## for fast caluclations, took a subsample
# \donttest{
eusilcP <- eusilcP[1:15000, ]
utility(eusilcS, eusilcP)
# }
# \donttest{
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