[R-SIG-Finance] Some problems while reading Diethelm Würtz's Portfolio Optimization with R book
Brian G. Peterson
brian at braverock.com
Sun Aug 27 15:41:01 CEST 2017
Regrettably, Diethelm died in a car accident last year. He is missed by
many in this community who appreciated his advice, openness, and
fostering of the community.
fPortfolio has not been updated for some time. I would suggest looking
at Berhard Pfaff's excellent risk and portfolio management book, as well
as at packages such as PortfolioAnalytics for actually doing portfolio
optimization in R.
I still refer to Diethelm's book for ideas and visualizations, but I do
not use that code.
Regards,
Brian
On 08/27/2017 08:35 AM, Baki UNAL via R-SIG-Finance wrote:
> Hello
> I am reading Diethelm Würtz's Portfolio Optimization with R book. I encountered a problem at "17.2 How to Compute a Minimum Risk Efficient Portfolio" part. I entered the commands:
>
>> minriskSpec <- portfolioSpec()> targetReturn <- getTargetReturn(ewPortfolio at portfolio)["mean"]> setTargetReturn(minriskSpec) <- targetReturn
>> minriskPortfolio <- efficientPortfolio(data = lppData,spec = minriskSpec,constraints = "LongOnly")> print(minriskPortfolio)
>
>
>
> But I got the following output:
>
>
> Title: MV Efficient Portfolio Estimator: covEstimator Solver: solveRquadprog Optimize: minRisk Constraints: LongOnly
> Portfolio Weights:SBI SPI SII LMI MPI ALT 0 0 0 0 0 0
> Covariance Risk Budgets:SBI SPI SII LMI MPI ALT
> Target Returns and Risks:mean Cov CVaR VaR 0 0 0 0
> Description: Sun Aug 27 16:00:42 2017 by user: win7120
>
> As you notice R does not compute Portfolio Weights, Target Returns and Risks... etc.
> I also tried to run the code at "17.3 How to Compute the Global Minimum Variance Portfolio" which is:
>
>> globminSpec <- portfolioSpec()> globminPortfolio <- minvariancePortfolio(data = lppData,spec = globminSpec,constraints = "LongOnly")> print(globminPortfolio)
>
> But I got the following output:
>
> Title:
> MV Minimum Variance Portfolio
> Estimator: covEstimator
> Solver: solveRquadprog
> Optimize: minRisk
> Constraints: LongOnly
>
> Portfolio Weights:
> SBI SPI SII LMI MPI ALT
> 0 0 0 0 0 0
>
> Covariance Risk Budgets:
> SBI SPI SII LMI MPI ALT
>
>
> Target Returns and Risks:
> mean Cov CVaR VaR
> 0 0 0 0
>
> Description:
> Sun Aug 27 16:12:21 2017 by user: win7120
>
>
>
> As you see R does not make computations again.
>
> I also tried to run the code at "17.4 How to Compute the Tangency Portfolio" which is:
>
>> tgSpec <- portfolioSpec()> setRiskFreeRate(tgSpec) <- 0
>
>> tgPortfolio <- tangencyPortfolio(data = lppData,spec = tgSpec,constraints = "LongOnly")
>
> This time I got the following error:
>
>
> Error in if (STATUS != 0) { : argument is of length zero
>
> What may be the problem? Could you help?
> Thanks
>
>
>
>
>
>
>
> [[alternative HTML version deleted]]
>
> _______________________________________________
> R-SIG-Finance at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
> -- Subscriber-posting only. If you want to post, subscribe first.
> -- Also note that this is not the r-help list where general R questions should go.
>
--
Brian G. Peterson
http://braverock.com/brian/
Ph: 773-459-4973
IM: bgpbraverock
More information about the R-SIG-Finance
mailing list