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
Minimizing tracking error with restricted number of stocks
10 messages · Vivek Rao, Alec Schmidt, Jason Hart +1 more
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 <aschmid1 at stevens.edu>
To: "r-sig-finance at r-project.org" <r-sig-finance at r-project.org>
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]]
_______________________________________________
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.
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
Thank you Brian. I searched PortfolioAnalytics.pdf for 'tracking' but didn't find one. Are there any implementation examples?
From: R-SIG-Finance <r-sig-finance-bounces at r-project.org> on behalf of Brian G. Peterson <brian at braverock.com>
Sent: Wednesday, March 7, 2018 9:14 PM
To: r-sig-finance at r-project.org
Subject: Re: [R-SIG-Finance] Minimizing tracking error with restricted number of stocks
Sent: Wednesday, March 7, 2018 9:14 PM
To: r-sig-finance at r-project.org
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 _______________________________________________ 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.
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 <r-sig-finance-bounces at r-project.org> on behalf of Brian G. Peterson <brian at braverock.com> Sent: Wednesday, March 7, 2018 9:14 PM To: r-sig-finance at r-project.org 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.
Great presentation, thanks for sharing the link Sent from my iPad
On Mar 7, 2018, at 10:00 PM, Brian G. Peterson <brian at braverock.com> 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 <r-sig-finance-bounces at r-project.org> on behalf of Brian G. Peterson <brian at braverock.com> Sent: Wednesday, March 7, 2018 9:14 PM To: r-sig-finance at r-project.org 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.
_______________________________________________ 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.
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 <r-sig-finance-bounces at r-project.org> on behalf of Jason Hart <jasonhart4 at icloud.com>
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
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 <brian at braverock.com> 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 <r-sig-finance-bounces at r-project.org> on behalf of Brian G. Peterson <brian at braverock.com> >> Sent: Wednesday, March 7, 2018 9:14 PM >> To: r-sig-finance at r-project.org >> 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. >> > > _______________________________________________ > 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. _______________________________________________ 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.
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 <r-sig-finance-bounces at r-project.org> on behalf of Jason Hart <jasonhart4 at icloud.com> 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 <brian at braverock.com 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 <r-sig-finance-bounces at r-project.org> on behalf of Brian G. Peterson <brian at braverock.com> Sent: Wednesday, March 7, 2018 9:14 PM To: r-sig-finance at r-project.org 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. _______________________________________________ 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. _______________________________________________ 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.
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 <brian at braverock.com>
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
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 <r-sig-finance-bounces at r-project.org> on behalf > of Jason Hart <jasonhart4 at icloud.com> > 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 <brian at braverock.com > > > 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 <r-sig-finance-bounces at r-project.org> on > > > behalf of Brian G. Peterson <brian at braverock.com> > > > Sent: Wednesday, March 7, 2018 9:14 PM > > > To: r-sig-finance at r-project.org > > > 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. > > > > > > > _______________________________________________ > > 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. > > _______________________________________________ > 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. >
12 days later
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