compute_model_space_stats {bdsm} | R Documentation |
Approximate standard deviations for the models
Description
Approximate standard deviations are computed for the models in the given model space. Two versions are computed.
Usage
compute_model_space_stats(
df,
dep_var_col,
timestamp_col,
entity_col,
params,
exact_value = FALSE,
model_prior = "uniform",
cl = NULL
)
Arguments
df |
Data frame with data for the SEM analysis. |
dep_var_col |
Column with the dependent variable |
timestamp_col |
The name of the column with timestamps |
entity_col |
Column with entities (e.g. countries) |
params |
A matrix (with named rows) with each column corresponding to a model. Each column specifies model parameters. Compare with optim_model_space_params |
exact_value |
Whether the exact value of the likelihood should be
computed ( |
model_prior |
Which model prior to use. For now there are two options:
|
cl |
An optional cluster object. If supplied, the function will use this
cluster for parallel processing. If |
Value
Matrix with columns describing likelihood and standard deviations for each model. The first row is the likelihood for the model (computed using the parameters in the provided model space). The second row is almost 1/2 * BIC_k as in Raftery's Bayesian Model Selection in Social Research eq. 19 (see TODO in the code below). The third row is model posterior probability. Then there are rows with standard deviations for each parameter. After that we have rows with robust standard deviation (not sure yet what exactly "robust" means).
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
)
compute_model_space_stats(
df = data_prepared,
dep_var_col = gdp,
timestamp_col = year,
entity_col = country,
params = small_model_space$params
)