ck_params_nums {cellKey} | R Documentation |
Set perturbation parameters for continuous variables
Description
This function allows to define perturbation parameters used to
perturb cells in magnitude tables.
Usage
ck_params_nums(
type = "top_contr",
top_k = NULL,
ptab,
mult_params,
mu_c = 0,
same_key = TRUE,
use_zero_rkeys = FALSE,
path = NULL
)
Arguments
type |
a character value defining the way to identify the magnifier ,
e.g which contributions/values in a cell should be the used in the
perturbation procedure. Possible choices are:
-
top_contr : the k largest contributions are used. In this case,
it is also required to specify argument top_k
-
mean : the (weighted) cellmean is used as starting point
-
range : the difference between largest and smallest contribution
is used.
-
sum : the (weighted) cellvalue itself is used as starting point
|
top_k |
it is ignored if variant is different from top_contr .
Otherwise, a scalar number >0 is expected.
|
ptab |
in this argument, one ore more perturbation tables are given as
input. the following choices are possible:
an object derived from ptable::create_ptable()
or ptable::create_num_ptable() : this case is the same as specifying a named
list with only a single element "all" (as described below)
a named list where the allowed names are shown below and each element
must be the output of [ptable::create_ptable())] or
ptable::create_num_ptable()
-
"all" : this ptable will be used for all cells; if specified, no
elements named "even" or "odd" must exist.
-
"even" : will be used to look up perturbation values for cells with an
even number of contributors. if specified, also list-element "odd" must
exist.
-
"odd" : will be used to look up perturbation values for cells with an
odd number of contributors; if specified, also list-element "even" must
exist.
-
"small_cells" : if specified, this ptable will be used to extract
perturbation values for very small cells
[ptable::create_ptable())]: R:ptable::create_ptable())
ptable::create_num_ptable() : R:ptable::create_num_ptable()
|
mult_params |
an object derived with ck_flexparams() or
ck_simpleparams() that contain required parameters for the computation of
the perturbation multiplier
|
mu_c |
fixed extra protection amount (>= 0) applied to the absolute of
the perturbation value of the first (largest) noise component if the cell is
sensitive. This value defaults to 0 (no additional protection). Please note
that sensitive cells can be defined according using the supp_freq() ,
supp_val , supp_p() , supp_nk() and supp_pq() methods. An examples is
given in ?cellkey_pkg .
|
same_key |
(logical) should original cell key (TRUE ) used for
for finding perturbation values of the largest contributor to a
cell or should a perturbation of the cellkey itself (FALSE ) take place.
|
use_zero_rkeys |
(logical) scalar defining if record keys of
units not contributing to a specific numeric variables should be
used (TRUE ) or ignored (FALSE ) when computing cell keys.
|
path |
a scalar character specifying a path to which the parameters
created with this functions should be written to (in yaml format)
|
Value
an object suitable as input to method $params_nums_set()
for the
perturbation of continous variables.
See Also
ck_flexparams()
Examples
# create a perturbation table using
# functionality from ptable-pkg; see help(pa = "ptable")
# this returns an extra ptable for very small cells
ptab <- ptable::pt_ex_nums(separation = TRUE)
# create parameters
ck_params_nums(
type = "top_contr",
top_k = 3,
ptab = ptab,
mult_params = ck_flexparams(
fp = 1000,
p = c(0.20, 0.03),
epsilon = c(1, 0.5, 0.2),
q = 2),
use_zero_rkeys = TRUE,
mu_c = 3)
[Package
cellKey version 1.0.2
Index]