此问题与此链接中的问题高度相关。 How to extract p-value in var package?
我只想从VARS包中调整R平方..
即使有类似的问题,我也没有任何想法修改以调整r方..请帮助我。
我只是按照上一个例子。
library(vars)
symbols=c('^N225','^FTSE','^GSPC')
getSymbols(symbols,src='yahoo', from="2003-04-28", to="2007-10-29")
period="daily"
A1=periodReturn(N225$N225.Adjusted,period=period)
B1=periodReturn(FTSE$FTSE.Adjusted,period=period)
C1=periodReturn(GSPC$GSPC.Adjusted,period=period)
datap_1<-cbind(A1,B1,C1)
datap_1<-na.omit(datap_1)
datap_1<-(datap_1)^2
vardatap_3<-VAR(datap_1,p=3,type="none")
summary(vardatap_3)
然后摘要可以显示为..
VAR Estimation Results:
=========================
Endogenous variables: N225, FTSE, SP500
Deterministic variables: none
Sample size: 1055
Log Likelihood: 23637.848
Roots of the characteristic polynomial:
0.8639 0.6224 0.6224 0.5711 0.5711 0.5471 0.5471 0.4683 0.4683
Call:
VAR(y = datap_1, p = 3, type = "none")
Estimation results for equation N225:
=====================================
N225 = N225.l1 + FTSE.l1 + SP500.l1 + N225.l2 + FTSE.l2 + SP500.l2 + N225.l3 + FTSE.l3 + SP500.l3
Estimate Std. Error t value Pr(>|t|)
N225.l1 0.03436 0.03116 1.103 0.270
FTSE.l1 0.47025 0.06633 7.089 2.48e-12 ***
SP500.l1 0.60717 0.07512 8.083 1.74e-15 ***
N225.l2 0.14938 0.03057 4.886 1.19e-06 ***
FTSE.l2 -0.05440 0.06744 -0.807 0.420
SP500.l2 -0.09024 0.07782 -1.160 0.246
N225.l3 0.16809 0.02924 5.749 1.18e-08 ***
FTSE.l3 0.04480 0.06597 0.679 0.497
SP500.l3 -0.01007 0.07941 -0.127 0.899
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 0.0002397 on 1046 degrees of freedom
Multiple R-Squared: 0.3099, Adjusted R-squared: 0.304
F-statistic: 52.2 on 9 and 1046 DF, p-value: < 2.2e-16
答案 0 :(得分:1)
可以在函数summary()
和列表元素varresult
的输出中访问调整后的r平方值。 varresult
包含每日返回的汇总表。
> lapply(summary(vardatap_3)$varresult, "[", "adj.r.squared")
$daily.returns
$daily.returns$adj.r.squared
[1] 0.3039812
$daily.returns.1
$daily.returns.1$adj.r.squared
[1] 0.3201587
$daily.returns.2
$daily.returns.2$adj.r.squared
[1] 0.1972104