SEM_dep_var_matrix: Matrix with dependent variable data for SEM representation

View source: R/SEM_matrices.R

SEM_dep_var_matrixR Documentation

Matrix with dependent variable data for SEM representation

Description

Create matrix which contains dependent variable data used in the Simultaneous Equations Model (SEM) representation on the left hand side of the equations. The matrix contains the data for time periods greater than or equal to the second lowest time stamp. The matrix is then used to compute likelihood for SEM analysis.

Usage

SEM_dep_var_matrix(df, timestamp_col, entity_col, dep_var_col)

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

Value

Matrix of size N x T where N is the number of entities considered and T is the number of periods greater than or equal to the second lowest time stamp.

Examples

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)
)
SEM_dep_var_matrix(df, times, entities, dep_var)

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