Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
294 views
in Technique[技术] by (71.8m points)

In R package fPortfolio, both risk options (Cov and Sigma) give the same results

When using the R package fPortfolio, I run the example below and get the same result with either risk="Cov" or risk="Sigma".

The reason might be related to the methods getCov and getSigma, but I don't have access to them.

Reproducible code - Note how "Cov" and "Sigma" produce the same plots. Partly, from "Portfolio Optimization with R/Rmetrics" (2015), pp. 198 ff


lppData <- 100 * LPP2005.RET[,1:6]
colnames(lppData)

lppSpec <- portfolioSpec()
setNFrontierPoints(lppSpec) <- 5
longFrontier <- portfolioFrontier(lppData, lppSpec)
print(longFrontier)

longFrontier <- portfolioFrontier(lppData)

par(mfrow = c(2,1))
tailoredFrontierPlot(longFrontier, risk = "Cov")
tailoredFrontierPlot(longFrontier, risk = "Sigma")

Using risk="Cov" or risk="Sigma" in tailoredFrontierPlot gives the same results.

This behavior can also be seen in the book "Portfolio Optimization with R/Rmetrics" (2015). As shown on pp. 151/2, the matrices "Cov" and "Sigma" are identical.

$Cov

           SBI       SPI        LMI       MPI
SBI  0.0158996 -0.012741  0.0098039 -0.015888
SPI -0.0127414  0.584612 -0.0140747  0.411598
LMI  0.0098039 -0.014075  0.0149511 -0.02332
MPI -0.0158884  0.411598 -0.0233222  0.535033

$Sigma

           SBI       SPI        LMI       MPI
SBI  0.0158996 -0.012741  0.0098039 -0.015888
SPI -0.0127414  0.584612 -0.0140747  0.411598
LMI  0.0098039 -0.014075  0.0149511 -0.02332
MPI -0.0158884  0.411598 -0.0233222  0.535033

If we could have access to the routines getCov and getSigma we could see how to fix it (assuming the problem is there).

Thanks

question from:https://stackoverflow.com/questions/65925186/in-r-package-fportfolio-both-risk-options-cov-and-sigma-give-the-same-results

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...