向量自回归模型VS风险价值模型(VAR&VaR)

来源:转载

单从外观上看,VAR&VaR两个模型很容易混淆,但就模型方法和用处两者截然不同,R语言作为数据分析的有力工具,其函数包库中包含各种各样的统计模型。通过vars包可以调用向量自回归模型,通过PerformanceAnalytics包的VaR函数可以调用风险价值模型。

模型简介

  • library(vars)

    • 向量自回归模型(Vector Autoregression),简称VAR模型,是一种常用的计量经济模型,由克里斯托弗·西姆斯(Christopher Sims)提出。VAR模型是用模型中所有当期变量对所有变量的若干滞后变量进行回归。VAR模型用来估计联合内生变量的动态关系,而不带有任何事先约束条件。它是AR模型的推广,此模型目前已得到广泛应用。
  • library(PerformanceAnalytics)=>VaR()

    • 风险价值模型(Value at Risk),通常被称作VaR方法。VaR按字面的解释就是“处于风险状态的价值”,即在一定置信水平和一定持有期内,某一金融资产或其组合在未来资产价格波动下所面临的最大损失额。JP.Morgan定义为:VaR是在既定头寸被冲销(be neutraliged)或重估前可能发生的市场价值最大损失的估计值;而Jorion则把VaR定义为:“给定置信区间的一个持有期内的最坏的预期损失”。

向量自回归模型(Vector Autoregression)

VAR模型R语言实例:

library(vars)

library(astsa) #数据包

x = cbind(cmort, tempr, part)

plot.ts(x , main = "", xlab = "")

summary(VAR(x, p=1, type="both"))

##

## VAR Estimation Results:

## =========================

## Endogenous variables: cmort, tempr, part

## Deterministic variables: both

## Sample size: 507

## Log Likelihood: -5116.02

## Roots of the characteristic polynomial:

## 0.8931 0.4953 0.1444

## Call:

## VAR(y = x, p = 1, type = "both")

##

##

## Estimation results for equation cmort:

## ======================================

## cmort = cmort.l1 + tempr.l1 + part.l1 + const + trend

##

## Estimate Std. Error t value Pr(>|t|)

## cmort.l1 0.464824 0.036729 12.656 < 2e-16 ***

## tempr.l1 -0.360888 0.032188 -11.212 < 2e-16 ***

## part.l1 0.099415 0.019178 5.184 3.16e-07 ***

## const 73.227292 4.834004 15.148 < 2e-16 ***

## trend -0.014459 0.001978 -7.308 1.07e-12 ***

## ---

## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

##

##

## Residual standard error: 5.583 on 502 degrees of freedom

## Multiple R-Squared: 0.6908, Adjusted R-squared: 0.6883

## F-statistic: 280.3 on 4 and 502 DF, p-value: < 2.2e-16

##

##

## Estimation results for equation tempr:

## ======================================

## tempr = cmort.l1 + tempr.l1 + part.l1 + const + trend

##

## Estimate Std. Error t value Pr(>|t|)

## cmort.l1 -0.244046 0.042105 -5.796 1.20e-08 ***

## tempr.l1 0.486596 0.036899 13.187 < 2e-16 ***

## part.l1 -0.127661 0.021985 -5.807 1.13e-08 ***

## const 67.585598 5.541550 12.196 < 2e-16 ***

## trend -0.006912 0.002268 -3.048 0.00243 **

## ---

## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

##

##

## Residual standard error: 6.4 on 502 degrees of freedom

## Multiple R-Squared: 0.5007, Adjusted R-squared: 0.4967

## F-statistic: 125.9 on 4 and 502 DF, p-value: < 2.2e-16

##

##

## Estimation results for equation part:

## =====================================

## part = cmort.l1 + tempr.l1 + part.l1 + const + trend

##

## Estimate Std. Error t value Pr(>|t|)

## cmort.l1 -0.124775 0.079013 -1.579 0.115

## tempr.l1 -0.476526 0.069245 -6.882 1.77e-11 ***

## part.l1 0.581308 0.041257 14.090 < 2e-16 ***

## const 67.463501 10.399163 6.487 2.10e-10 ***

## trend -0.004650 0.004256 -1.093 0.275

## ---

## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

##

##

## Residual standard error: 12.01 on 502 degrees of freedom

## Multiple R-Squared: 0.3732, Adjusted R-squared: 0.3683

## F-statistic: 74.74 on 4 and 502 DF, p-value: < 2.2e-16

##

##

##

## Covariance matrix of residuals:

## cmort tempr part

## cmort 31.172 5.975 16.65

## tempr 5.975 40.965 42.32

## part 16.654 42.323 144.26

##

## Correlation matrix of residuals:

## cmort tempr part

## cmort 1.0000 0.1672 0.2484

## tempr 0.1672 1.0000 0.5506

## part 0.2484 0.5506 1.0000

风险价值模型(Value at Risk)

VaR模型R语言实例:

library(PerformanceAnalytics)

data(edhec)

# first do normal VaR calc

VaR(edhec, p=.95, method="historical")

## Convertible Arbitrage CTA Global Distressed Securities

## VaR -0.01916 -0.0354 -0.018875

## Emerging Markets Equity Market Neutral Event Driven

## VaR -0.044605 -0.006385 -0.02254

## Fixed Income Arbitrage Global Macro Long/Short Equity Merger Arbitrage

## VaR -0.00929 -0.01624 -0.02544 -0.013455

## Relative Value Short Selling Funds of Funds

## VaR -0.013175 -0.07848 -0.021265

# now use Gaussian

VaR(edhec, p=.95, method="gaussian")

## Convertible Arbitrage CTA Global Distressed Securities

## VaR -0.02645782 -0.03471098 -0.0221269

## Emerging Markets Equity Market Neutral Event Driven

## VaR -0.05498927 -0.008761813 -0.02246202

## Fixed Income Arbitrage Global Macro Long/Short Equity Merger Arbitrage

## VaR -0.01900198 -0.02023018 -0.02859264 -0.01152478

## Relative Value Short Selling Funds of Funds

## VaR -0.01493049 -0.08617027 -0.02393888

# now use modified Cornish Fisher calc to take non-normal distribution into account

VaR(edhec, p=.95, method="modified")

## Convertible Arbitrage CTA Global Distressed Securities

## VaR -0.03247395 -0.03380228 -0.0274924

## Emerging Markets Equity Market Neutral Event Driven

## VaR -0.06363081 -0.01134637 -0.02812515

## Fixed Income Arbitrage Global Macro Long/Short Equity Merger Arbitrage

## VaR -0.0246791 -0.01548247 -0.03037494 -0.01486869

## Relative Value Short Selling Funds of Funds

## VaR -0.01926435 -0.07431463 -0.02502852

# now use p=.99

VaR(edhec, p=.99)

## Convertible Arbitrage CTA Global Distressed Securities

## VaR -0.1009223 -0.04847019 -0.06533764

## Emerging Markets Equity Market Neutral Event Driven

## VaR -0.1397195 -0.04404136 -0.06385154

## Fixed Income Arbitrage Global Macro Long/Short Equity Merger Arbitrage

## VaR -0.05850228 -0.02437999 -0.05508705 -0.03630211

## Relative Value Short Selling Funds of Funds

## VaR -0.050531 -0.122236 -0.05500037

# or the equivalent alpha=.01

VaR(edhec, p=.01)

## Convertible Arbitrage CTA Global Distressed Securities

## VaR -0.1009223 -0.04847019 -0.06533764

## Emerging Markets Equity Market Neutral Event Driven

## VaR -0.1397195 -0.04404136 -0.06385154

## Fixed Income Arbitrage Global Macro Long/Short Equity Merger Arbitrage

## VaR -0.05850228 -0.02437999 -0.05508705 -0.03630211

## Relative Value Short Selling Funds of Funds

## VaR -0.050531 -0.122236 -0.05500037

# now with outliers squished

VaR(edhec, clean="boudt")

## Convertible Arbitrage CTA Global Distressed Securities

## VaR -0.0192821 -0.03380228 -0.02281122

## Emerging Markets Equity Market Neutral Event Driven

## VaR -0.05335613 -0.006583541 -0.02588255

## Fixed Income Arbitrage Global Macro Long/Short Equity Merger Arbitrage

## VaR -0.01947099 -0.01612116 -0.02997413 -0.01255334

## Relative Value Short Selling Funds of Funds

## VaR -0.0147671 -0.07881339 -0.02474761

# add Component VaR for the equal weighted portfolio

VaR(edhec, clean="boudt", portfolio_method="component")

## $MVaR

## [,1]

## [1,] 0.01206124

##

## $contribution

## Convertible Arbitrage CTA Global Distressed Securities

## 1.189614e-03 7.392667e-05 1.380388e-03

## Emerging Markets Equity Market Neutral Event Driven

## 3.044882e-03 3.255042e-04 1.633369e-03

## Fixed Income Arbitrage Global Macro Long/Short Equity

## 1.122597e-03 9.551128e-04 1.725166e-03

## Merger Arbitrage Relative Value Short Selling

## 5.594788e-04 9.422577e-04 -2.647415e-03

## Funds of Funds

## 1.756359e-03

##

## $pct_contrib_MVaR

## Convertible Arbitrage CTA Global Distressed Securities

## 0.098631120 0.006129276 0.114448260

## Emerging Markets Equity Market Neutral Event Driven

## 0.252451840 0.026987629 0.135422963

## Fixed Income Arbitrage Global Macro Long/Short Equity

## 0.093074804 0.079188612 0.143033874

## Merger Arbitrage Relative Value Short Selling

## 0.046386511 0.078122792 -0.219497771

## Funds of Funds

## 0.145620091

反馈与建议

分享给朋友:
您可能感兴趣的文章:
随机阅读: