Learn R Programming

bdsm (version 0.1.1)

likelihoods_summary: 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

likelihoods_summary(
  df,
  dep_var_col,
  timestamp_col,
  entity_col,
  model_space,
  exact_value = TRUE,
  model_prior = "uniform",
  run_parallel = FALSE
)

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).

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)

model_space

A matrix (with named rows) with each column corresponding to a model. Each column specifies model parameters. Compare with optimal_model_space

exact_value

Whether the exact value of the likelihood should be computed (TRUE) or just the proportional part (FALSE). Check SEM_likelihood for details.

model_prior

Which model prior to use. For now there are two options: 'uniform' and 'binomial-beta'. Default is 'uniform'.

run_parallel

If TRUE the optimization is run in parallel using the parApply function. If FALSE (default value) the base apply function is used. Note that using the parallel computing requires setting the default cluster. See README.

Examples

Run this code
# \donttest{
  data_centered_scaled <-
    feature_standardization(df = bdsm::economic_growth[,1:7],
                            timestamp_col = year, entity_col = country)
  data_cross_sectional_standarized <-
    feature_standardization(df = data_centered_scaled, timestamp_col = year,
                            entity_col = country, time_effects = TRUE,
                            scale = FALSE)

    likelihoods_summary(df = data_cross_sectional_standarized,
                        dep_var_col = gdp, timestamp_col = year,
                        entity_col = country, model_space = economic_growth_ms)
# }

Run the code above in your browser using DataLab