Helper constructor for defining a single predictor entry inside a new_spec_ir()
specification.
Arguments
- name
Character scalar giving a valid R identifier for the predictor.
- level
Integer scalar (
1Lor2L) indicating the hierarchy level.- distribution
One of
"normal","binary","uniform", or"time"(for wave-indexed longitudinal time predictors).- mean
Numeric mean for
"normal"predictors (defaults to0).- sd
Positive numeric SD for
"normal"predictors (defaults to1).- prob
Numeric probability in
(0, 1)for"binary"predictors (defaults to0.5).- min
Numeric lower bound for
"uniform"predictors (defaults to0).- max
Numeric upper bound for
"uniform"predictors (defaults to1).- centering
One of
"none","grand_mean", or"group_mean".- role
One of
"covariate","focal", or"treatment".
Examples
spec_predictor("x1", level = 1L, distribution = "normal", mean = 0, sd = 1)
#> $name
#> [1] "x1"
#>
#> $level
#> [1] 1
#>
#> $distribution
#> [1] "normal"
#>
#> $mean
#> [1] 0
#>
#> $sd
#> [1] 1
#>
#> $prob
#> NULL
#>
#> $min
#> NULL
#>
#> $max
#> NULL
#>
#> $centering
#> [1] "none"
#>
#> $role
#> [1] "covariate"
#>
spec_predictor("trt", level = 2L, distribution = "binary", prob = 0.5, role = "treatment")
#> $name
#> [1] "trt"
#>
#> $level
#> [1] 2
#>
#> $distribution
#> [1] "binary"
#>
#> $mean
#> NULL
#>
#> $sd
#> NULL
#>
#> $prob
#> [1] 0.5
#>
#> $min
#> NULL
#>
#> $max
#> NULL
#>
#> $centering
#> [1] "none"
#>
#> $role
#> [1] "treatment"
#>
