将数据帧插入R中的VAR模型

时间:2017-08-06 17:11:44

标签: r database var

我想插入我的数据以查看我的预测如何在我的原始数据中执行,但除了手动之外我不知道该怎么做。

我的模特给了我预测:

Var_model1 = VAR(model1, p = 1, type = c("both"),
    season = NULL, exogen = NULL, lag.max = 7,
    ic = c("AIC"))
model2 =subset(data_div, select=c("Returns", "Emo"))
Var_model2 = VAR(model2, p = 1, type = c("both"),
                 season = NULL, exogen = NULL, lag.max =7,
                 ic = c("AIC"))
summary(Var_model1)
summary(Var_model2)

然后我得到了我的结果:

VAR Estimation Results:
========================= 
Endogenous variables: Returns, Emo 
Deterministic variables: both 
Sample size: 469 
Log Likelihood: 3387.106 
Roots of the characteristic polynomial:
0.4225 0.006472
Call:
VAR(y = model2, p = 1, type = c("both"), exogen = NULL, lag.max = 7, 
    ic = c("AIC"))


Estimation results for equation Returns: 
======================================== 
Returns = Returns.l1 + Emo.l1 + const + trend 

             Estimate Std. Error t value Pr(>|t|)
Returns.l1  7.268e-03  4.635e-02   0.157    0.875
Emo.l1      8.895e-02  7.736e-02   1.150    0.251
const      -1.112e-02  9.366e-03  -1.187    0.236
trend       3.426e-06  3.124e-06   1.097    0.273


Residual standard error: 0.008902 on 465 degrees of freedom
Multiple R-Squared: 0.004532,   Adjusted R-squared: -0.00189 
F-statistic: 0.7057 on 3 and 465 DF,  p-value: 0.549 


Estimation results for equation Emo: 
==================================== 
Emo = Returns.l1 + Emo.l1 + const + trend 

             Estimate Std. Error t value Pr(>|t|)    
Returns.l1  3.714e-03  2.525e-02   0.147  0.88314    
Emo.l1      4.217e-01  4.215e-02  10.005  < 2e-16 ***
const       6.968e-02  5.103e-03  13.656  < 2e-16 ***
trend      -5.190e-06  1.702e-06  -3.049  0.00242 ** 
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1


Residual standard error: 0.00485 on 465 degrees of freedom
Multiple R-Squared: 0.2199, Adjusted R-squared: 0.2148 
F-statistic: 43.68 on 3 and 465 DF,  p-value: < 2.2e-16 

我想看看它如何与其他数据一起执行,但我不知道如何插入新数据以查看预测?

0 个答案:

没有答案