exogenous_matrix | R Documentation |
Create matrix which contains exogenous variables used in the Simultaneous Equations Model (SEM) representation. Currently these are: dependent variable from the lowest time stamp and regressors from the second lowest time stamp. The matrix is then used to compute likelihood for SEM analysis.
exogenous_matrix(df, timestamp_col, entity_col, dep_var_col)
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 |
Matrix of size N x k+1 where N is the number of entities considered and k is the number of chosen regressors
set.seed(1)
df <- data.frame(
entities = rep(1:4, 5),
times = rep(seq(1960, 2000, 10), each = 4),
dep_var = stats::rnorm(20), a = stats::rnorm(20), b = stats::rnorm(20)
)
exogenous_matrix(df, times, entities, dep_var)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.