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. |
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. |
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. |
Although the last release to CRAN was in 2015 for PortfolioAnalytics, it is
still in active use and we are committed to maintaining it. In my opinion, PortfolioAnalytics is the goto package for portfolio optimization... I am a coauthor of the package so my opinion is biased. For a backtesting package, I highly recommend quantstrat. It was built by and is used by professional traders. The demos are a good place to start for learning how to use the package. Regards, Ross On Fri, Sep 8, 2017 at 5:27 AM, <[hidden email]> wrote: > 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 <(773)%20459-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. > [[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. |
Good morning all, I agree with the prior message on all counts but I am also a big fan of SIT package. Here are the steps to install SIT, with the repo sit file (248 KB) attached below. # https://github.com/systematicinvestor/SIT install.packages('C:/Dropbox/QUANTstudio/R/sit', repos = NULL, type='source') ?`SIT-package` Regards, Darius From: Ross Bennett <[hidden email]> To: "[hidden email]" <[hidden email]> Sent: Friday, September 8, 2017 6:56 AM Subject: Re: [R-SIG-Finance] Some problems while reading Diethelm Würtz's Portfolio Optimization with R book Although the last release to CRAN was in 2015 for PortfolioAnalytics, it is still in active use and we are committed to maintaining it. In my opinion, PortfolioAnalytics is the goto package for portfolio optimization... I am a coauthor of the package so my opinion is biased. For a backtesting package, I highly recommend quantstrat. It was built by and is used by professional traders. The demos are a good place to start for learning how to use the package. Regards, Ross On Fri, Sep 8, 2017 at 5:27 AM, <[hidden email]> wrote: > 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([hidden email])["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 <(773)%20459-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. > [[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. _______________________________________________ [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. sit (339K) Download Attachment |
Free forum by Nabble | Edit this page |