Return.portfolio issue

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Return.portfolio issue

ROUX, Nicolas
Hello all,

I am trying to backtest  a long/short portfolio using Return.Portfolio but am running into some sort of error, or I do not fully understand how to use return.portfolio.

For a quarterly rebalancing of shorts, I am providing monthly returns, a set of negative
weights in an xts format on quarter dates (created by to.period), the final argument is rebalance_on="quarters".

The result is an set of regular zigzags where the position changes too regularly. Inline images 2  
The code:
head(monthly.returns[,1:3])
            AXA.Returns Accor.Returns Air.Liquide.Returns
1987-01-31           NA            NA                  NA
1987-02-28 -0.039941766   -0.00311151         -0.03195942
1987-03-31  0.008723886    0.03936148          0.07320454
1987-04-30  0.005995543   -0.04579859         -0.01919371
1987-05-31 -0.055431515   -0.10515575         -0.03495027
1987-06-30 -0.145464190   -0.02607130         -0.04062429
head(weights$short.w[,1:3])
           Asset 1 Asset 2 Asset 3
1987-03-31      -1     0.0       0
1987-06-30       0    -0.5       0
1987-09-30       0     0.0       0
1987-12-31       0     0.0       0
1988-03-31       0     0.0       0
1988-06-30       0     0.0       0
head(Port.return[1:10])
           portfolio.returns
1987-04-30       -2.00599554
1987-05-31       -0.05543151
1987-06-30       -0.14546419
1987-07-31       -2.01670857
1987-08-31        0.09265071
1987-09-30       -0.09907100


I am not sure I understand how the short weights work? Perhaps I should just use positive weights and minus the returns afterwards?

Any help much appreciated.

Nicolas Roux


_______________________________________________
[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.
Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Return.portfolio issue

braverock
On 05/29/2017 02:32 AM, ROUX, Nicolas wrote:

> Hello all,
>
> I am trying to backtest  a long/short portfolio using Return.Portfolio
> but am running into some sort of error, or I do not fully understand how
> to use return.portfolio.
>
> For a quarterly rebalancing of shorts, I am providing monthly returns, a
> set of negative
> weights in an xts format on quarter dates (created by to.period), the
> final argument is rebalance_on="quarters".
>
> The result is an set of regular zigzags where the position changes too
> regularly. Inline images 2
> The code:
<...>

This isn't exactly a reproducible example.

Here is a reproducible example:

require(PerformanceAnalytics)
data(edhec)
data(weights)
sweights <- -1 * weights
pr <- Return.rebalancing(R=edhec, weights=sweights)
charts.PerformanceSummary(pr)

It is clearly a bug.  We'll take a look.

> **
>
> I am not sure I understand how the short weights work? Perhaps I should
> just use positive weights and minus the returns afterwards?
>
> Any help much appreciated.
>
> Nicolas Roux

_______________________________________________
[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.
Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Return.portfolio issue

Ilya Kipnis
Weights need to sum to 1 at every period. Create a dummy asset with return
of 0 and assign it a weight of 1 - rowSum(weights) and things will work.

On Mon, May 29, 2017 at 5:49 AM, Brian G. Peterson <[hidden email]>
wrote:

> On 05/29/2017 02:32 AM, ROUX, Nicolas wrote:
>
>> Hello all,
>>
>> I am trying to backtest  a long/short portfolio using Return.Portfolio
>> but am running into some sort of error, or I do not fully understand how
>> to use return.portfolio.
>>
>> For a quarterly rebalancing of shorts, I am providing monthly returns, a
>> set of negative
>> weights in an xts format on quarter dates (created by to.period), the
>> final argument is rebalance_on="quarters".
>>
>> The result is an set of regular zigzags where the position changes too
>> regularly. Inline images 2
>> The code:
>>
> <...>
>
> This isn't exactly a reproducible example.
>
> Here is a reproducible example:
>
> require(PerformanceAnalytics)
> data(edhec)
> data(weights)
> sweights <- -1 * weights
> pr <- Return.rebalancing(R=edhec, weights=sweights)
> charts.PerformanceSummary(pr)
>
> It is clearly a bug.  We'll take a look.
>
> **
>>
>> I am not sure I understand how the short weights work? Perhaps I should
>> just use positive weights and minus the returns afterwards?
>>
>> Any help much appreciated.
>>
>> Nicolas Roux
>>
>
> _______________________________________________
> [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.
Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Return.portfolio issue

ROUX, Nicolas
Hi,

So if all the assets are shorted in one period and sum of the weights
equals -1 (as was the case in my example but hidden columns), the dummy
variable's weight is 2?

Thanks,

Nicolas

On 29 May 2017 16:10, "Ilya Kipnis" <[hidden email]> wrote:

Weights need to sum to 1 at every period. Create a dummy asset with return
of 0 and assign it a weight of 1 - rowSum(weights) and things will work.

On Mon, May 29, 2017 at 5:49 AM, Brian G. Peterson <[hidden email]>
wrote:

> On 05/29/2017 02:32 AM, ROUX, Nicolas wrote:
>
>> Hello all,
>>
>> I am trying to backtest  a long/short portfolio using Return.Portfolio
>> but am running into some sort of error, or I do not fully understand how
>> to use return.portfolio.
>>
>> For a quarterly rebalancing of shorts, I am providing monthly returns, a
>> set of negative
>> weights in an xts format on quarter dates (created by to.period), the
>> final argument is rebalance_on="quarters".
>>
>> The result is an set of regular zigzags where the position changes too
>> regularly. Inline images 2
>> The code:
>>
> <...>
>
> This isn't exactly a reproducible example.
>
> Here is a reproducible example:
>
> require(PerformanceAnalytics)
> data(edhec)
> data(weights)
> sweights <- -1 * weights
> pr <- Return.rebalancing(R=edhec, weights=sweights)
> charts.PerformanceSummary(pr)
>
> It is clearly a bug.  We'll take a look.
>
> **
>>
>> I am not sure I understand how the short weights work? Perhaps I should
>> just use positive weights and minus the returns afterwards?
>>
>> Any help much appreciated.
>>
>> Nicolas Roux
>>
>
> _______________________________________________
> [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.

        [[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.
Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Return.portfolio issue

Ilya Kipnis
Correct.

On Mon, May 29, 2017 at 10:50 AM, ROUX, Nicolas <[hidden email]>
wrote:

> Hi,
>
> So if all the assets are shorted in one period and sum of the weights
> equals -1 (as was the case in my example but hidden columns), the dummy
> variable's weight is 2?
>
> Thanks,
>
> Nicolas
>
> On 29 May 2017 16:10, "Ilya Kipnis" <[hidden email]> wrote:
>
> Weights need to sum to 1 at every period. Create a dummy asset with return
> of 0 and assign it a weight of 1 - rowSum(weights) and things will work.
>
> On Mon, May 29, 2017 at 5:49 AM, Brian G. Peterson <[hidden email]>
> wrote:
>
> > On 05/29/2017 02:32 AM, ROUX, Nicolas wrote:
> >
> >> Hello all,
> >>
> >> I am trying to backtest  a long/short portfolio using Return.Portfolio
> >> but am running into some sort of error, or I do not fully understand how
> >> to use return.portfolio.
> >>
> >> For a quarterly rebalancing of shorts, I am providing monthly returns, a
> >> set of negative
> >> weights in an xts format on quarter dates (created by to.period), the
> >> final argument is rebalance_on="quarters".
> >>
> >> The result is an set of regular zigzags where the position changes too
> >> regularly. Inline images 2
> >> The code:
> >>
> > <...>
> >
> > This isn't exactly a reproducible example.
> >
> > Here is a reproducible example:
> >
> > require(PerformanceAnalytics)
> > data(edhec)
> > data(weights)
> > sweights <- -1 * weights
> > pr <- Return.rebalancing(R=edhec, weights=sweights)
> > charts.PerformanceSummary(pr)
> >
> > It is clearly a bug.  We'll take a look.
> >
> > **
> >>
> >> I am not sure I understand how the short weights work? Perhaps I should
> >> just use positive weights and minus the returns afterwards?
> >>
> >> Any help much appreciated.
> >>
> >> Nicolas Roux
> >>
> >
> > _______________________________________________
> > [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.
>
>
>

        [[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.
Loading...