Say I have a portfolio of 100 stocks and want to find a subset of 20 stocks with minimum tracking error in respect to the original portfolio. I wonder if a solver to this problem is implemented in some R-based library.
Thanks! Alec [[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. |
Alec,
You could regress the returns of the 100-stock portfolio on the returns of the 100 stocks, using the Lasso or Elastic Net(there are R packages glmnet and elasticnet for these methods) to zero out most of the regression coefficients. Vivek RaoBoston, MA From: Alec Schmidt <[hidden email]> To: "[hidden email]" <[hidden email]> Sent: Wednesday, March 7, 2018 8:55 PM Subject: [R-SIG-Finance] Minimizing tracking error with restricted number of stocks Say I have a portfolio of 100 stocks and want to find a subset of 20 stocks with minimum tracking error in respect to the original portfolio. I wonder if a solver to this problem is implemented in some R-based library. Thanks! Alec [[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. [[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. |
In reply to this post by Alec Schmidt-2
On 03/07/2018 07:55 PM, Alec Schmidt wrote:
> Say I have a portfolio of 100 stocks and want to find a subset of 20 stocks with minimum tracking error in respect to the original portfolio. I wonder if a solver to this problem is implemented in some R-based library. PortfolioAnalytics can do this. -- 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. |
Thank you Brian. I searched PortfolioAnalytics.pdf for 'tracking' but didn't find one. Are there any implementation examples?
________________________________________ From: R-SIG-Finance <[hidden email]> on behalf of Brian G. Peterson <[hidden email]> Sent: Wednesday, March 7, 2018 9:14 PM To: [hidden email] Subject: Re: [R-SIG-Finance] Minimizing tracking error with restricted number of stocks On 03/07/2018 07:55 PM, Alec Schmidt wrote: > Say I have a portfolio of 100 stocks and want to find a subset of 20 stocks with minimum tracking error in respect to the original portfolio. I wonder if a solver to this problem is implemented in some R-based library. PortfolioAnalytics can do this. -- 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. |
On 03/07/2018 08:39 PM, Alec Schmidt wrote:
> Thank you Brian. I searched PortfolioAnalytics.pdf for 'tracking' but didn't find one. Are there any implementation examples? See Ross Bennett's tutorial from R/Finance 2017: https://rossb34.github.io/PortfolioAnalyticsPresentation2017/#1 Tracking Error example starts on slide 29, though you should find the rest of the tutorial useful. - Brian > ________________________________________ > From: R-SIG-Finance <[hidden email]> on behalf of Brian G. Peterson <[hidden email]> > Sent: Wednesday, March 7, 2018 9:14 PM > To: [hidden email] > Subject: Re: [R-SIG-Finance] Minimizing tracking error with restricted number of stocks > > On 03/07/2018 07:55 PM, Alec Schmidt wrote: >> Say I have a portfolio of 100 stocks and want to find a subset of 20 stocks with minimum tracking error in respect to the original portfolio. I wonder if a solver to this problem is implemented in some R-based library. > > PortfolioAnalytics can do this. > _______________________________________________ [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. |
Great presentation, thanks for sharing the link
Sent from my iPad > On Mar 7, 2018, at 10:00 PM, Brian G. Peterson <[hidden email]> wrote: > >> On 03/07/2018 08:39 PM, Alec Schmidt wrote: >> Thank you Brian. I searched PortfolioAnalytics.pdf for 'tracking' but didn't find one. Are there any implementation examples? > > See Ross Bennett's tutorial from R/Finance 2017: > > https://rossb34.github.io/PortfolioAnalyticsPresentation2017/#1 > > Tracking Error example starts on slide 29, though you should find the rest of the tutorial useful. > > - Brian > >> ________________________________________ >> From: R-SIG-Finance <[hidden email]> on behalf of Brian G. Peterson <[hidden email]> >> Sent: Wednesday, March 7, 2018 9:14 PM >> To: [hidden email] >> Subject: Re: [R-SIG-Finance] Minimizing tracking error with restricted number of stocks >>> On 03/07/2018 07:55 PM, Alec Schmidt wrote: >>> Say I have a portfolio of 100 stocks and want to find a subset of 20 stocks with minimum tracking error in respect to the original portfolio. I wonder if a solver to this problem is implemented in some R-based library. >> PortfolioAnalytics can do this. >> > > _______________________________________________ > [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. |
This is a very handy doc indeed. I'm not sure though that examples on #29 - #31 address the problem I'm looking into. Namely, I need minimum tracking error with explicit constraint on the number of stocks that is lower than in the benchmark portfolio. Coleman, Li, and Henniger (2004) state that it's NP-hard problem and review a few heuristic methods. Is there one implemented in PortfolioAnalytics?
Thanks much! Alec ________________________________________ From: R-SIG-Finance <[hidden email]> on behalf of Jason Hart <[hidden email]> Sent: Thursday, March 8, 2018 9:46 AM To: Brian G. Peterson Cc: R-SIG-Finance Subject: Re: [R-SIG-Finance] Minimizing tracking error with restricted number of stocks Great presentation, thanks for sharing the link Sent from my iPad > On Mar 7, 2018, at 10:00 PM, Brian G. Peterson <[hidden email]> wrote: > >> On 03/07/2018 08:39 PM, Alec Schmidt wrote: >> Thank you Brian. I searched PortfolioAnalytics.pdf for 'tracking' but didn't find one. Are there any implementation examples? > > See Ross Bennett's tutorial from R/Finance 2017: > > https://rossb34.github.io/PortfolioAnalyticsPresentation2017/#1 > > Tracking Error example starts on slide 29, though you should find the rest of the tutorial useful. > > - Brian > >> ________________________________________ >> From: R-SIG-Finance <[hidden email]> on behalf of Brian G. Peterson <[hidden email]> >> Sent: Wednesday, March 7, 2018 9:14 PM >> To: [hidden email] >> Subject: Re: [R-SIG-Finance] Minimizing tracking error with restricted number of stocks >>> On 03/07/2018 07:55 PM, Alec Schmidt wrote: >>> Say I have a portfolio of 100 stocks and want to find a subset of 20 stocks with minimum tracking error in respect to the original portfolio. I wonder if a solver to this problem is implemented in some R-based library. >> PortfolioAnalytics can do this. >> > > _______________________________________________ > [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. _______________________________________________ [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. |
Alec,
I do not believe that there is a closed form optimization solution for what you are trying to do. In other words, I am agreeing with Coleman et. al. That is not the same thing as saying that you can't solve it with PortfolioAnalytics. First, add a position_limit constraint setting the number of non-zero positions that you want in the portfolio Second, add a tracking error objective as described in Ross' presentation. (along with adding any other objectives or constraints you need in your portfolio specification) Third, utilize one of the global numerical solvers, e.g. DEoptim, random portfolios, genSA, or pso. The numerical solvers will not search the entire feasible space, but rather search a subset of the feasible space stochastically. You should get acceptably close to the global optimum portfolio using these methods in finite time. Regards, - Brian On Thu, 2018-03-08 at 16:04 +0000, Alec Schmidt wrote: > This is a very handy doc indeed. I'm not sure though that examples on > #29 - #31 address the problem I'm looking into. Namely, I need > minimum tracking error with explicit constraint on the number of > stocks that is lower than in the benchmark portfolio. Coleman, Li, > and Henniger (2004) state that it's NP-hard problem and review a few > heuristic methods. Is there one implemented in PortfolioAnalytics? > Thanks much! Alec > ________________________________________ > From: R-SIG-Finance <[hidden email]> on behalf > of Jason Hart <[hidden email]> > Sent: Thursday, March 8, 2018 9:46 AM > To: Brian G. Peterson > Cc: R-SIG-Finance > Subject: Re: [R-SIG-Finance] Minimizing tracking error with > restricted number of stocks > > Great presentation, thanks for sharing the link > > Sent from my iPad > > > On Mar 7, 2018, at 10:00 PM, Brian G. Peterson <[hidden email] > > > wrote: > > > > > On 03/07/2018 08:39 PM, Alec Schmidt wrote: > > > Thank you Brian. I searched PortfolioAnalytics.pdf for 'tracking' > > > but didn't find one. Are there any implementation examples? > > > > See Ross Bennett's tutorial from R/Finance 2017: > > > > https://rossb34.github.io/PortfolioAnalyticsPresentation2017/#1 > > > > Tracking Error example starts on slide 29, though you should find > > the rest of the tutorial useful. > > > > - Brian > > > > > ________________________________________ > > > From: R-SIG-Finance <[hidden email]> on > > > behalf of Brian G. Peterson <[hidden email]> > > > Sent: Wednesday, March 7, 2018 9:14 PM > > > To: [hidden email] > > > Subject: Re: [R-SIG-Finance] Minimizing tracking error with > > > restricted number of stocks > > > > On 03/07/2018 07:55 PM, Alec Schmidt wrote: > > > > Say I have a portfolio of 100 stocks and want to find a subset > > > > of 20 stocks with minimum tracking error in respect to the > > > > original portfolio. I wonder if a solver to this problem is > > > > implemented in some R-based library. > > > > > > PortfolioAnalytics can do this. > > > > > > > _______________________________________________ > > [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. > _______________________________________________ [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. |
Thank you Brian,
position_limit constraint - that's exactly what I needed. But then I guess that's how NP-hard problem looks like: it may need lots of resampling. Best, Alec ________________________________________ From: Brian G. Peterson <[hidden email]> Sent: Thursday, March 8, 2018 11:13 AM To: Alec Schmidt; Jason Hart Cc: R-SIG-Finance Subject: Re: [R-SIG-Finance] Minimizing tracking error with restricted number of stocks Alec, I do not believe that there is a closed form optimization solution for what you are trying to do. In other words, I am agreeing with Coleman et. al. That is not the same thing as saying that you can't solve it with PortfolioAnalytics. First, add a position_limit constraint setting the number of non-zero positions that you want in the portfolio Second, add a tracking error objective as described in Ross' presentation. (along with adding any other objectives or constraints you need in your portfolio specification) Third, utilize one of the global numerical solvers, e.g. DEoptim, random portfolios, genSA, or pso. The numerical solvers will not search the entire feasible space, but rather search a subset of the feasible space stochastically. You should get acceptably close to the global optimum portfolio using these methods in finite time. Regards, - Brian On Thu, 2018-03-08 at 16:04 +0000, Alec Schmidt wrote: > This is a very handy doc indeed. I'm not sure though that examples on > #29 - #31 address the problem I'm looking into. Namely, I need > minimum tracking error with explicit constraint on the number of > stocks that is lower than in the benchmark portfolio. Coleman, Li, > and Henniger (2004) state that it's NP-hard problem and review a few > heuristic methods. Is there one implemented in PortfolioAnalytics? > Thanks much! Alec > ________________________________________ > From: R-SIG-Finance <[hidden email]> on behalf > of Jason Hart <[hidden email]> > Sent: Thursday, March 8, 2018 9:46 AM > To: Brian G. Peterson > Cc: R-SIG-Finance > Subject: Re: [R-SIG-Finance] Minimizing tracking error with > restricted number of stocks > > Great presentation, thanks for sharing the link > > Sent from my iPad > > > On Mar 7, 2018, at 10:00 PM, Brian G. Peterson <[hidden email] > > > wrote: > > > > > On 03/07/2018 08:39 PM, Alec Schmidt wrote: > > > Thank you Brian. I searched PortfolioAnalytics.pdf for 'tracking' > > > but didn't find one. Are there any implementation examples? > > > > See Ross Bennett's tutorial from R/Finance 2017: > > > > https://rossb34.github.io/PortfolioAnalyticsPresentation2017/#1 > > > > Tracking Error example starts on slide 29, though you should find > > the rest of the tutorial useful. > > > > - Brian > > > > > ________________________________________ > > > From: R-SIG-Finance <[hidden email]> on > > > behalf of Brian G. Peterson <[hidden email]> > > > Sent: Wednesday, March 7, 2018 9:14 PM > > > To: [hidden email] > > > Subject: Re: [R-SIG-Finance] Minimizing tracking error with > > > restricted number of stocks > > > > On 03/07/2018 07:55 PM, Alec Schmidt wrote: > > > > Say I have a portfolio of 100 stocks and want to find a subset > > > > of 20 stocks with minimum tracking error in respect to the > > > > original portfolio. I wonder if a solver to this problem is > > > > implemented in some R-based library. > > > > > > PortfolioAnalytics can do this. > > > > > > > _______________________________________________ > > [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. > _______________________________________________ [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. |
In reply to this post by braverock
I have a sample of daily portfolio returns and would like to estimate the weights using 252-day periods, starting with the 1st day of the sample, and do rebalancing every 126 days. How do I define the following parameters:
rebalance_on, training_period, rolling_window Thank you, Alec _______________________________________________ [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. |
Free forum by Nabble | Edit this page |