Complex systems, such as brains, markets, and societies, exhibit internal dynamics influenced by external factors. Disentangling delayed external effects from internal dynamics within these systems is often challenging. We propose using a Vector Autoregressive model with eXogenous input (VARX) to capture delayed interactions between internal and external variables. While this model aligns with Granger's statistical formalism for testing "causal relations", the connection between the two is not widely understood. Here, we bridge this gap by providing fundamental equations, user-friendly code, and demonstrations using simulated and real-world data from neuroscience, physiology, sociology, and economics. Our examples illustrate how the model avoids spurious correlation by factoring out external influences from internal dynamics, leading to more parsimonious explanations of the systems. We also provide methods for enhancing model efficiency, such as L2 regularization for limited data and basis functions to cope with extended delays. Additionally, we analyze model performance under various scenarios where model assumptions are violated. MATLAB, Python, and R code are provided for easy adoption: https://github.com/lcparra/varx
翻译:复杂系统(如大脑、市场和社会)展现出受外部因素影响的内部动态。在这些系统中,将延迟的外部效应与内部动态分离通常具有挑战性。我们提出使用带外生输入的向量自回归模型(VARX)来捕捉内部变量与外部变量之间的延迟交互作用。虽然该模型符合格兰杰用于检验“因果关系”的统计形式化框架,但二者之间的联系尚未被广泛理解。本文通过提供基本方程、用户友好的代码,以及使用来自神经科学、生理学、社会学和经济学的模拟与真实数据进行演示,来弥合这一差距。我们的示例说明了该模型如何通过从内部动态中排除外部影响来避免虚假相关性,从而为系统提供更简洁的解释。我们还提供了提升模型效率的方法,例如针对有限数据的L2正则化以及处理长延迟的基函数。此外,我们分析了在模型假设被违反的各种场景下的模型性能。我们提供了MATLAB、Python和R代码以便于采用:https://github.com/lcparra/varx