getEffectiveSubspace {fkbma} | R Documentation |
Get Effective Subspace
Description
This function identifies the "effective subspace" where exposure is effective based on posterior inference results from the FK-BMA model. It analyzes interaction terms between exposure and covariates, allowing for both binary and continuous variables.
Usage
getEffectiveSubspace(results, newdata = NULL, alpha = 0.05, pip_cutoff = 0.1)
Arguments
results |
A fitted model object from |
newdata |
Optional. A new dataset for evaluating the effective subspace.
If |
alpha |
Numeric. The alpha level used for computing quantiles. Default is |
pip_cutoff |
Numeric. The minimum Posterior Inclusion Probability (PIP)
threshold for selecting covariates. Default is |
Details
The function computes the posterior exposure effect for each observation in the dataset using the
fittedExposureEff
function and evaluates its quantiles at the specifiedalpha
level.Binary variables with high posterior inclusion probabilities (PIP) are used to define subgroups, and the corresponding effective subspaces for a continuous variable are identified by checking where the exposure effect quantiles are strictly positive.
If the number of binary variables is
<= 3
and there is exactly one continuous variable, the function describes the effective subspace in terms of disjoint intervals.For more complex cases, a warning is issued suggesting alternative methods such as Bayesian regression trees for interpretation.
Value
A list with the following components:
quantiles |
A vector of quantile values for the exposure effect in the new dataset. |
is_effective_subspace |
A logical vector indicating whether the exposure effect is positive in the effective subspace. |
Examples
# Example dataset
data("simulated_data")
candsplinevars <- c("X_1")
candbinaryvars <- paste0("Z_", 1:5)
candinter <- c(candsplinevars, candbinaryvars)
results <- rjMCMC(simulated_data, candsplinevars, candbinaryvars, candinter,
outcome = "Y", factor_var = "trt")
getEffectiveSubspace(results)