best_models {bdsm} | R Documentation |
Table with the best models according to one of the posterior criteria
Description
This function creates a ranking of best models according to one of the possible criterion (PMP under binomial model prior, PMP under binomial-beta model prior, R^2 under binomial model prior, R^2 under binomial-beta model prior). The function gives two types of tables in three different formats: inclusion table (where 1 indicates presence of the regressor in the model and 0 indicates that the variable is excluded from the model) and estimation results table (it displays the best models and estimation output for those models: point estimates, standard errors, significance level, and R^2).
Usage
best_models(
bma_list,
criterion = 1,
best = 5,
round = 3,
estimate = TRUE,
robust = TRUE
)
Arguments
bma_list |
bma object (the result of the bma function) |
criterion |
The criterion that will be used for a basis of the model ranking: |
best |
The number of the best models to be considered |
round |
Parameter indicating the decimal place to which number in the tables should be rounded (default round = 3) |
estimate |
A parameter with values TRUE or FALSE indicating which table should be displayed when
TRUE - table with estimation to the results |
robust |
A parameter with values TRUE or FALSE indicating which type of stanrdard errors should be displayed
when the function finishes calculations. Works only if estimate = TRUE. Works well when best is small. |
Value
A list with best_models objects:
matrix with inclusion of the regressors in the best models
matrix with estimation output in the best models with regular standard errors
matrix with estimation output in the best models with robust standard errors
knitr_kable table with inclusion of the regressors in the best models (the best for the display on the console - up to 11 models)
knitr_kable table with estimation output in the best models with regular standard errors (the best for the display on the console - up to 6 models)
knitr_kable table with estimation output in the best models with robust standard errors (the best for the display on the console - up to 6 models)
gTree table with inclusion of the regressors in the best models (displayed as a plot). Use grid::grid.draw() to display.
gTree table with estimation output in the best models with regular standard errors (displayed as a plot). Use grid::grid.draw() to display.
gTree table with estimation output in the best models with robust standard errors (displayed as a plot). Use grid::grid.draw() to display.
Examples
library(magrittr)
data_prepared <- bdsm::economic_growth[, 1:6] %>%
bdsm::feature_standardization(
excluded_cols = c(country, year, gdp)
) %>%
bdsm::feature_standardization(
group_by_col = year,
excluded_cols = country,
scale = FALSE
)
bma_results <- bma(
model_space = bdsm::small_model_space,
df = data_prepared,
round = 3,
dilution = 0
)
best_5_models <- best_models(bma_results, criterion = 1, best = 5, estimate = TRUE, robust = TRUE)