我正在尝试根据特定的风险水平优化投资组合。使用fPortfolio似乎很简单,但是我得到的结果没有意义。我花了几个小时试图解决这个问题,但没有任何运气。

基本案例(即非约束)

defaultSpec <- portfolioSpec()
lppAssets <- 100*LPP2005.RET[, c("SBI", "SPI", "LMI", "MPI")]
lppData <- portfolioData(data = lppAssets, spec = defaultSpec)
port <- efficientPortfolio(lppData, defaultSpec, constraints = "LongOnly")
port@portfolio

# $weights
#         SBI         SPI         LMI         MPI
# 0.396009510 0.002142136 0.547715368 0.054132986

# $covRiskBudgets
#         SBI         SPI         LMI         MPI
# 0.396009510 0.002142136 0.547715368 0.054132986

# $targetReturn
#        mean          mu
# 0.006422759 0.006422759

# $targetRisk
#       Cov     Sigma      CVaR       VaR
# 0.1038206 0.1038206 0.2186926 0.1684104

# $targetAlpha
# [1] 0.05

# $status
# [1] 0


# Slot "messages":
# list()


当我尝试将风险级别设置为0.09时,我会得到相同的答案。

defaultSpec <- portfolioSpec()
setTargetRisk(defaultSpec) <- 0.09 # **this doesn't seem to work**
lppAssets <- 100*LPP2005.RET[, c("SBI", "SPI", "LMI", "MPI")]
lppData <- portfolioData(data = lppAssets, spec = defaultSpec)
port <- efficientPortfolio(lppData, defaultSpec, constraints = "LongOnly")
port@portfolio

# An object of class "fPFOLIOVAL"
# Slot "portfolio":
# $weights
#         SBI         SPI         LMI         MPI
# 0.396009510 0.002142136 0.547715368 0.054132986

# $covRiskBudgets
#         SBI         SPI         LMI         MPI
# 0.396009510 0.002142136 0.547715368 0.054132986

# $targetReturn
#        mean          mu
# 0.006422759 0.006422759

# $targetRisk
#       Cov     Sigma      CVaR       VaR
# 0.1038206 0.1038206 0.2186926 0.1684104

# $targetAlpha
# [1] 0.05

# $status
# [1] 0


# Slot "messages":
# list()


“规范”说,目标是新的风险水平,但结果不会改变。我将风险设置为0.09还是0.12或任何其他值都没有关系。

defaultSpec

# Model List:
#  Type:                      MV
#  Optimize:                  maxReturn
#  Estimator:                 covEstimator
#  Params:                    alpha = 0.05 a = 1

# Portfolio List:
#  Portfolio Weights:         NA
#  Target Return:             NA
#  Target Risk:               0.09
#  Risk-Free Rate:            0
#  Number of Frontier Points: 50
#  Status:                    NA

# Optim List:
#  Solver:                    solveRquadprog
#  Objective:                 portfolioObjective portfolioReturn portfolioRisk
#  Options:                   meq = 2
#  Trace:                     FALSE


我究竟做错了什么?如何在R中使用fPortfolio设置风险级别?

最佳答案

从fPortfolio的帮助文件来看,如果您设置了风险目标,则可能需要使用maxreturnPortfolio。您可能还需要setOptimize(spec)
从R中的帮助文件复制:
“最大回报投资组合:

函数maxreturnPortfolio返回具有固定目标风险的最大收益的投资组合。”

关于r - 在R包fPortfolio中设置目标风险,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/30115443/

10-11 11:48