Some problems while reading Diethelm Würtz's Portfolio Optimization with R book

5 messages
Open this post in threaded view
|

Some problems while reading Diethelm Würtz's Portfolio Optimization with R book

 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@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]] _______________________________________________ [hidden email] 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.
Open this post in threaded view
|

Re: Some problems while reading Diethelm Würtz's Portfolio Optimization with R book

 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@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]] > > _______________________________________________ > [hidden email] 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 _______________________________________________ [hidden email] 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.
Open this post in threaded view
|

Re: Some problems while reading Diethelm Würtz's Portfolio Optimization with R book

 Two or three follow up questions to your reply:   1.  package PortfolioAnalytics date is 2015, so does not seem to have been updated for a while too. But still the package to go for optimization? 2. I am currently looking for a good package for backtesting strategies. I am still working through the recommended packages from the list in view "empirical finance" (excellent overview btw). Which package(s) would you recommend for backtesting?   My (prelimenary) assessment of     1. package "backtest": not to be used because not many functions, only basics of backtesting are covered.   2. package: "STI" : not to be used because difficult to install, almost no documentation, last update in 2012 3. package: "TTR" : very useful! 4. package: "quantstrat" : very useful     Any experience and/or evaluation of the following packages (that I still have on my work through list) would be highly appreciated:   package: "portfolioSim"  package: "pbo"  package: "portfolio":  package: "factorAnalytics"     It seems to me that "quantstrat" is the package to go for. However, documentation is sparse and spread around various sites. Any suggestions for additional sources (outside Guy Yollin) are welcome too.   Cheers, Oliver   Gesendet: Sonntag, 27. August 2017 um 15:41 Uhr Von: "Brian G. Peterson" <[hidden email]> An: [hidden email] Betreff: Re: [R-SIG-Finance] Some problems while reading Diethelm Würtz's Portfolio Optimization with R book 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@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]] > > _______________________________________________ > [hidden email] 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 _______________________________________________ [hidden email] 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. _______________________________________________ [hidden email] 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.