| vimpute_spec | R Documentation |
vimpute()Bundles everything vimpute() can configure for a single variable –
method, learner parameters, formula or predictors, tune, PMM
settings, makeNA values and a donorcond donor condition – into one
object, instead of coordinating up to nine parallel per-variable
arguments. Pass a named list of specs as vimpute(spec = ); the reserved
name ".default" supplies the spec for variables not listed (its method,
learner parameters and tune/PMM knobs; formula/predictors/makeNA/
donorcond are variable-specific and not allowed in ".default").
vimpute_spec(
method,
...,
formula = NULL,
predictors = NULL,
tune = FALSE,
pmm = FALSE,
pmm_k = NULL,
pmm_k_method = NULL,
makeNA = NULL,
donorcond = NULL,
uncert = NULL
)
vs_ranger(...)
vs_xgboost(...)
vs_regularized(...)
vs_robust(...)
vs_gam(...)
vs_robgam(...)
## S3 method for class 'vimpute_spec'
print(x, ...)
method |
Single string: a registered imputation method (see
|
... |
Named learner parameters for the method's learners (e.g.
|
formula |
One-sided ( |
predictors |
Character vector of predictor columns (the
|
tune |
Logical: tune this variable's learner (see
|
pmm |
Logical: predictive mean matching for this (numeric) variable. |
pmm_k |
|
pmm_k_method |
|
makeNA |
|
donorcond |
|
uncert |
Not a spec knob – set |
x |
A |
Learner parameters in ... are validated eagerly against the
method's learner parameter sets, so a typo fails at the constructor call,
not in iteration 7 of the imputation. vs_ranger(), vs_xgboost(),
vs_regularized(), vs_robust(), vs_gam() and vs_robgam() are
shorthands for the built-in methods; methods added via
register_vimpute_method() use vimpute_spec("<name>", ...).
A variable with a spec uses that spec's settings exactly (no field-level
merging with ".default"). uncert remains a call-level argument of
vimpute() and is not a spec knob.
An object of class vimpute_spec.
vimpute(), register_vimpute_method()
## Not run:
data(sleep)
res <- vimpute(sleep,
spec = list(
Sleep = vs_ranger(num.trees = 300, tune = TRUE),
NonD = vs_robust(donorcond = ">= 0"),
.default = vs_ranger()
),
seed = 1)
# the same, as formula grammar:
res2 <- vimpute(sleep,
Sleep ~ . | ranger(num.trees = 300, tune = TRUE),
NonD ~ . | robust(donorcond = ">= 0"),
.default = vs_ranger(),
seed = 1)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.