initialize_model_space: Initialize model space matrix

View source: R/model_space.R

initialize_model_spaceR Documentation

Initialize model space matrix

Description

This function builds a representation of the model space, by creating a dataframe where each column represents values of the parameters for a given model. Real value means that the parameter is included in the model. A parameter not present in the model is marked as NA.

Usage

initialize_model_space(
  df,
  timestamp_col,
  entity_col,
  dep_var_col,
  init_value = 1
)

Arguments

df

Data frame with data for the SEM analysis.

timestamp_col

Column which determines time periods. For now only natural numbers can be used as timestamps

entity_col

Column which determines entities (e.g. countries, people)

dep_var_col

Column with dependent variable

init_value

Initial value for parameters present in the model. Default is 1.

Details

Currently the set of features is assumed to be all columns which remain after excluding timestamp_col, entity_col and dep_var_col.

A power set of all possible exclusions of linear dependence on the given feature is created, i.e. if there are 4 features we end up with 2^4 possible models (for each model we independently decide whether to include or not a feature).

Value

matrix of model parameters

Examples

library(magrittr)

data_prepared <- economic_growth[,1:7] %>%
  feature_standardization(timestamp_col = year, entity_col = country) %>%
  feature_standardization(timestamp_col = year, entity_col = country,
                        time_effects = TRUE, scale = FALSE)

initialize_model_space(data_prepared, year, country, gdp)

bdsm documentation built on April 4, 2025, 1:06 a.m.