ssvs_mi | R Documentation |
This function performs Stochastic Search Variable Selection (SSVS) analysis on multiply imputed datasets for a given set of predictors and a response variable. It supports continuous response variables and calculates aggregated results across multiple imputations.
ssvs_mi(
data,
y,
x,
imp,
imp_num = 5,
interval = 0.9,
continuous = TRUE,
progress = FALSE
)
data |
A dataframe containing the variables of interest, including an |
y |
The response variable (character string). |
x |
A vector of predictor variable names. |
imp |
The imputation variable. |
imp_num |
The number of imputations to process (default is 5). |
interval |
Confidence interval level for summary results (default is 0.9). |
continuous |
If |
progress |
Logical indicating whether to display progress (default is FALSE). |
An ssvs_mi object containing aggregated results across imputations that can be
used in summary()
.
# example 1: continuous response variable
data(imputed_mtcars)
outcome <- 'qsec'
predictors <- c('cyl', 'disp', 'hp', 'drat', 'wt', 'vs', 'am', 'gear', 'carb','mpg')
imputation <- '.imp'
results <- ssvs_mi(data = imputed_mtcars, y = outcome, x = predictors, imp = imputation)
# example 2: binary response variable
data(imputed_affairs)
outcome <- "hadaffair"
predictors <- c("gender", "age", "yearsmarried", "children", "religiousness",
"education", "occupation", "rating")
imputation <- '.imp'
results <- ssvs_mi(data = imputed_affairs, x = predictors, y = outcome, continuous = FALSE, imp = imputation)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.