View source: R/ck_cnt_measures.R
ck_cnt_measures | R Documentation |
This function computes utility/information loss measures based on two numeric vectors (original and perturbed)
ck_cnt_measures(orig, pert, exclude_zeros = TRUE)
orig |
a numeric vector holding original values |
pert |
a numeric vector holding perturbed values |
exclude_zeros |
a scalar logical value; if |
a list
containing the following elements:
overview
: a data.table
with the following three columns:
noise
: amount of noise computed as orig
- pert
cnt
: number of cells perturbed with the value given in column noise
pct
: percentage of cells perturbed with the value given in column noise
measures
: a data.table
containing measures of the distribution
of three different distances between original and perturbed values
of the unweighted counts. Column what
specifies the computed measure.
The three distances considered are:
d1
: absolute distance between original and masked values
d2
: relative absolute distance between original and masked values
d3
: absolute distance between square-roots of original and perturbed
values
cumdistr_d1
, cumdistr_d2
and cumdistr_d3
: for each distance d1
, d2
and d3
, a data.table
with the following three columns:
cat
: a specific value (for d1
) or interval (for distances d2
and d3
)
cnt
: number of records smaller or equal the value in column cat
for the
given distance
pct
: proportion of records smaller or equal the value
in column cat
for the selected distance
false_zero
: number of cells that were perturbed to zero
false_nonzero
: number of cells that were initially zero but
have been perturbed to a number different from zero
exclude_zeros
: were empty cells exluded from computation or not
orig <- c(1:10, 0, 0)
pert <- orig; pert[c(1, 5, 7)] <- c(0, 6, 9)
# ignore empty cells when computing measures `d1`, `d2`, `d3`
ck_cnt_measures(orig = orig, pert = pert, exclude_zeros = TRUE)
# use all cells
ck_cnt_measures(orig = orig, pert = pert, exclude_zeros = FALSE)
# for an application on a perturbed object, see ?cellkey_pkg
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.