| compute_model_space_stats | R Documentation |
Approximate standard deviations are computed for the models in the given model space. Two versions are computed.
compute_model_space_stats(
df,
dep_var_col,
timestamp_col,
entity_col,
params,
nested = TRUE,
exact_value = FALSE,
model_prior = "uniform",
cl = NULL
)
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 |
nested |
Logical. If |
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 |
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 the marginal
likelihood approximation used to weight the models, namely
exp((loglik - (k/2) * log(N * T)) / N); note that it is not a BIC.
Then there are rows with standard deviations for each parameter, followed by
rows with robust standard deviations. The last three rows hold
tr(H^-1 J), where H is the observed information and J
the outer product of the entity-level scores, the dimension of the
parameter vector, and the numerical rank of J. These are the
ingredients of the magnitude adjustment for misspecified likelihoods,
whose rate is rank(J) / tr(H^-1 J); see score_rank for
why J is typically rank deficient, and bma for why no
weighting option is built on it.
library(magrittr)
data_prepared <- badp::economic_growth[, 1:6] %>%
badp::feature_standardization(
excluded_cols = c(country, year, gdp)
) %>%
badp::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
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.