- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我想将特定的外生变量分配给特定的回归。具体来说,请考虑下面的代码。如何将方程 dln_inv 的 beta.exog_only_for_inc_equation 系数限制为零,并将方程 dln_inc 的 beta.exog_only_for_inv_equation 系数限制为零?
import numpy as np
import pandas as pd
import statsmodels.api as sm
import matplotlib.pyplot as plt
dta = sm.datasets.webuse('lutkepohl2', 'https://www.stata-press.com/data/r12/')
dta.index = dta.qtr
endog = dta.loc['1960-04-01':'1978-10-01', ['dln_inv', 'dln_inc', 'dln_consump']]
endog['exog_only_for_inv_equation']=[endog.index[i].quarter for i in range(len(endog.index))]
endog['exog_only_for_inc_equation']=endog['dln_consump']
exog = endog[['exog_only_for_inv_equation','exog_only_for_inc_equation']]
mod = sm.tsa.VARMAX(endog[['dln_inv', 'dln_inc']], order=(2,0), trend='n', exog=exog)
res = mod.fit(maxiter=1000, disp=False)
print(res.summary())
Statespace Model Results
==================================================================================
Dep. Variable: ['dln_inv', 'dln_inc'] No. Observations: 75
Model: VARX(2) Log Likelihood 363.197
Date: Wed, 22 Apr 2020 AIC -696.394
Time: 22:49:07 BIC -661.631
Sample: 04-01-1960 HQIC -682.513
- 10-01-1978
Covariance Type: opg
===================================================================================
Ljung-Box (Q): 60.43, 38.85 Jarque-Bera (JB): 8.31, 4.57
Prob(Q): 0.02, 0.52 Prob(JB): 0.02, 0.10
Heteroskedasticity (H): 0.46, 0.42 Skew: 0.13, -0.55
Prob(H) (two-sided): 0.06, 0.04 Kurtosis: 4.61, 3.48
Results for equation dln_inv
===================================================================================================
coef std err z P>|z| [0.025 0.975]
---------------------------------------------------------------------------------------------------
L1.dln_inv -0.2468 0.094 -2.624 0.009 -0.431 -0.062
L1.dln_inc 0.2937 0.481 0.610 0.542 -0.649 1.237
L2.dln_inv -0.1873 0.152 -1.235 0.217 -0.485 0.110
L2.dln_inc -0.0805 0.413 -0.195 0.846 -0.891 0.730
beta.exog_only_for_inv_equation -0.0007 0.004 -0.172 0.863 -0.009 0.008
beta.exog_only_for_inc_equation 1.2446 0.639 1.947 0.052 -0.008 2.497
Results for equation dln_inc
===================================================================================================
coef std err z P>|z| [0.025 0.975]
---------------------------------------------------------------------------------------------------
L1.dln_inv 0.0606 0.033 1.830 0.067 -0.004 0.126
L1.dln_inc 0.0170 0.133 0.128 0.898 -0.243 0.277
L2.dln_inv 0.0116 0.035 0.333 0.739 -0.056 0.080
L2.dln_inc -0.0187 0.130 -0.143 0.886 -0.273 0.236
beta.exog_only_for_inv_equation 0.0018 0.001 1.756 0.079 -0.000 0.004
beta.exog_only_for_inc_equation 0.7046 0.111 6.321 0.000 0.486 0.923
Error covariance matrix
============================================================================================
coef std err z P>|z| [0.025 0.975]
--------------------------------------------------------------------------------------------
sqrt.var.dln_inv 0.0434 0.004 12.267 0.000 0.036 0.050
sqrt.cov.dln_inv.dln_inc 5.319e-06 0.002 0.003 0.998 -0.004 0.004
sqrt.var.dln_inc 0.0106 0.001 10.475 0.000 0.009 0.013
============================================================================================
Warnings:
[1] Covariance matrix calculated using the outer product of gradients (complex-step).
最佳答案
我不得不仔细阅读 statsmodels.tsa.statespace.dynamic_factor.DynamicFactor 上的文档。
在 mod 之后,使用以下几行更改代码
with mod.fix_params({'beta.exog_only_for_inc_equation.dln_inv': 0,'beta.exog_only_for_inv_equation.dln_inc':0}):
res = mod.fit()
print(res.summary())
Statespace Model Results
==================================================================================
Dep. Variable: ['dln_inv', 'dln_inc'] No. Observations: 75
Model: VARX(2) Log Likelihood 359.238
Date: Sat, 25 Apr 2020 AIC -692.475
Time: 00:52:20 BIC -662.348
Sample: 04-01-1960 HQIC -680.446
- 10-01-1978
Covariance Type: opg
===================================================================================
Ljung-Box (Q): 61.97, 39.25 Jarque-Bera (JB): 14.10, 2.67
Prob(Q): 0.01, 0.50 Prob(JB): 0.00, 0.26
Heteroskedasticity (H): 0.44, 0.39 Skew: 0.10, -0.40
Prob(H) (two-sided): 0.05, 0.02 Kurtosis: 5.11, 3.47
Results for equation dln_inv
===========================================================================================================
coef std err z P>|z| [0.025 0.975]
-----------------------------------------------------------------------------------------------------------
L1.dln_inv -0.2537 0.095 -2.663 0.008 -0.440 -0.067
L1.dln_inc 0.5490 0.442 1.243 0.214 -0.317 1.415
L2.dln_inv -0.1359 0.175 -0.778 0.436 -0.478 0.206
L2.dln_inc 0.4770 0.371 1.286 0.198 -0.250 1.204
beta.exog_only_for_inv_equation 0.0015 0.005 0.321 0.748 -0.008 0.011
beta.exog_only_for_inc_equation (fixed) 0 nan nan nan nan nan
Results for equation dln_inc
===========================================================================================================
coef std err z P>|z| [0.025 0.975]
-----------------------------------------------------------------------------------------------------------
L1.dln_inv 0.0615 0.035 1.737 0.082 -0.008 0.131
L1.dln_inc 0.0584 0.105 0.557 0.577 -0.147 0.264
L2.dln_inv 0.0091 0.031 0.289 0.773 -0.052 0.071
L2.dln_inc 0.0181 0.126 0.144 0.886 -0.229 0.265
beta.exog_only_for_inv_equation (fixed) 0 nan nan nan nan nan
beta.exog_only_for_inc_equation 0.8123 0.115 7.070 0.000 0.587 1.038
Error covariance matrix
============================================================================================
coef std err z P>|z| [0.025 0.975]
--------------------------------------------------------------------------------------------
sqrt.var.dln_inv 0.0445 0.003 14.175 0.000 0.038 0.051
sqrt.cov.dln_inv.dln_inc -5.595e-05 0.002 -0.028 0.978 -0.004 0.004
sqrt.var.dln_inc 0.0108 0.001 11.536 0.000 0.009 0.013
============================================================================================
Warnings:
[1] Covariance matrix calculated using the outer product of gradients (complex-step).
res.param_names
['L1.dln_inv.dln_inv',
'L1.dln_inc.dln_inv',
'L2.dln_inv.dln_inv',
'L2.dln_inc.dln_inv',
'L1.dln_inv.dln_inc',
'L1.dln_inc.dln_inc',
'L2.dln_inv.dln_inc',
'L2.dln_inc.dln_inc',
'beta.exog_only_for_inv_equation.dln_inv',
'beta.exog_only_for_inc_equation.dln_inv',
'beta.exog_only_for_inv_equation.dln_inc',
'beta.exog_only_for_inc_equation.dln_inc',
'sqrt.var.dln_inv',
'sqrt.cov.dln_inv.dln_inc',
'sqrt.var.dln_inc']
关于python - 在 Python 中使用不同的独立回归器运行 VARMAX 方程,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61353394/
我如何使用 CQLINQ 获取当前方法的输入参数集合?有像“参数”或“参数”这样的集合,只有“NbParamenter”不适合我的目的。 最佳答案 事实上,CQLinq 还没有这个功能。但是,在许多情
我想知道是否有人知道我的 makefile 中独立的 @ 符号和“dir”命令在这里(第二行和第三行)的作用: $(BUILD)/%.o: %.cpp @mkdir -p $(dir $@)
我想知道是否有人知道我的 makefile 中独立的 @ 符号和“dir”命令在这里(第二行和第三行)的作用: $(BUILD)/%.o: %.cpp @mkdir -p $(dir $@)
我的机器上有带有 4 个 cpu 的 Ubuntu 14.04(nproc 恢复了 4 个)。我安装并执行 Spark Standalone 后(本地),我可以自己定义不同数量的奴隶。例如我想要有4个
我看到所有这些 iPhone 应用程序都带有内置的独立 webDav 服务器。是否有可以集成到现有应用程序中的独立(如在其自己的 IIS 中)C# webDAV 项目。 最佳答案 至少有两个用于 .N
我如何在独立的 Django 应用程序上进行迁移(即不属于任何项目的应用程序)。 例如在以下之后:https://docs.djangoproject.com/en/1.8/intro/reusabl
我目前正在使用 tortoiseSVN 对本地编程文件进行版本控制。我不运行 SVN 服务器,因为可以直接使用 tortoiseSVN(例如 http://invalidlogic.com/2006/
我有一些 Bootstrap 代码,当用户查看它时,它可以很好地为进度条部分设置动画。 然而它动画 全部 页面中的进度条而不是动画仅限 该查看部分中的进度条。结果,当用户转到进度条的另一部分时,这些已
我认为我们在 iOS 13.2/13.3 中发现了关于在独立模式下运行的 PWA 的回归。 由于在 iOS PWA 上无法访问 getUserMedia() 我们依赖 capture HTML5 输入
我有一个每周从系统运行一次的报告,并将数据导出到 Excel 文档中。我已经设置了将数据导出到 Excel 的工具,以便在格式化方面做得很好,但是一旦数据进入 Excel,我还需要做更多的事情。 是否
//值数组的格式为 { "var1", "val1", "var2", "val2",.. } public static String replaceMethod(String template,
当我在 eclipse 中运行我的项目时,它工作正常,当我将它导出为独立 jar 时,它会滞后。我使用相同的 vmargs,在 Eclipse 中尝试了 3 种不同的导出设置,似乎没有任何帮助 最佳答
我了解到 Java EE 中我非常喜欢的注释基础配置(@Resource)功能。然后我注意到注释实际上是 Java SE 的一部分。 所以我想知道是否可以将它与 Java SE 一起使用。我当然可以在
我无法理解为什么这种关系没有被持久化,并且程序不会正常退出,但在 Eclipse 中继续运行。 下面是我的代码,排除了包名: 主要: import java.io.BufferedInputStrea
我有一个在 Linux + Java 6 上运行的独立 Java 应用程序,它似乎被卡住了(没有生成日志)我如何在不使用任何其他工具(例如 jstack)的情况下获取此线程转储 尝试了以下命令,但它们
我正在非节点环境中构建应用程序,但我想利用 Babel 的 ES6 转译,以便我可以编写更好的代码并且仍然支持 IE11。 所以我继续包含在这里找到的独立文件: https://github.com/
扩展我对 MySQL 的理解。 1) 是否需要 64 位帮助?我是安装还是单独使用? 2) 如果我打算在 MySQL Community Service 中使用 64 位,它会影响仅提供 32 位的
我有一个独立的 Java 应用程序,我必须为其集成一个规则引擎。我应该使用属性文件或 XML 文件定义规则。我需要规则引擎来读取属性或 XML 文件中定义的这些规则,并相应地在应用程序中实现代码。 任
我是wiremock新手,我正在尝试使用它来记录我负责集成测试的java应用程序的请求和响应。 我知道我的命令将类似于: java -jar wiremock-1.57-standalone.jar
我到处寻找我的问题的解决方案,但我的问题有点具体...我需要有关如何创建独立 radioGroup 列表的建议,例如图示: o item1 • item1' • item2 或 item2' o it
我是一名优秀的程序员,十分优秀!