Build Counterfactual Scenario Array
get_scen_array.RdConstructs a 4D array of covariate values for counterfactual prediction, varying one variable across its empirical range while holding others at their mean.
Arguments
- var_to_vary
Character string naming the variable to vary.
- scen_vals
Named list produced by
get_scen_vals.- node_names
Character vector of node names (used for the first two array dimensions).
- var_names
Character vector of all variable names (third dimension of the output).
Value
A four-dimensional array of dimension
m x m x p x S, where S is the number of
unique quantile values for the varying variable. Each slice
along the fourth dimension holds one scenario. Off-diagonal
entries for the varying variable take its quantile value, while
all other variables are set to their mean. Diagonals are zero.
Examples
if (FALSE) { # \dontrun{
vals <- get_scen_vals(W)
scen <- get_scen_array("proximity", vals,
node_names = rownames(W),
var_names = dimnames(W)[[3]])
} # }