dynamic window size in rolling linear regression?

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

dynamic window size in rolling linear regression?

LosemindL
Hi all,

In application of linear regression to financial time series, we always
have a parameter which is the window size.

It's clear that a lot of results are sensitive to this parameter...

Is there a way to make this parameter dynamic, or are there statistical
procedures to select such parameter dynamically and/or "optimally"?

From a trading strategy perspective, is there a way to make this parameter
dynamically chosen?

Thanks a lot!

        [[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.
Reply | Threaded
Open this post in threaded view
|

Re: dynamic window size in rolling linear regression?

Patrick Burns-2
Let's think about what you are asking for.

You want to change the window size in order
(I presume) to get better predictions.  So
it seems to me that you would need a variable
that has information about the pertinence of
past data to the future.

I could imagine volatility being such a variable
in some circumstances.  I don't know of any
work along those lines -- I'd be interested to
hear of any.

My usual practice is to have weights that descend
linearly.  In comparison to exponentially decaying
weights this puts more weight on the older data,
and hence is often a more stable estimate.  It has
the advantage over equal weighting that the window
size is of less importance.

On 11/01/2012 17:11, Michael wrote:

> Hi all,
>
> In application of linear regression to financial time series, we always
> have a parameter which is the window size.
>
> It's clear that a lot of results are sensitive to this parameter...
>
> Is there a way to make this parameter dynamic, or are there statistical
> procedures to select such parameter dynamically and/or "optimally"?
>
>  From a trading strategy perspective, is there a way to make this parameter
> dynamically chosen?
>
> Thanks a lot!
>
> [[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.
>

--
Patrick Burns
[hidden email]
http://www.burns-stat.com
http://www.portfolioprobe.com/blog
twitter: @portfolioprobe

_______________________________________________
[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.
Reply | Threaded
Open this post in threaded view
|

Re: dynamic window size in rolling linear regression?

riccardo visca
What about using an expanding window with exponential weights to make the coefficients more adaptive? Throwing away data is not good.
Still you need to have weights that are inverse of conditional variance to correct eteroschedasticity.

It could be a lot more efficient computationally than Kalman and one could use robust or lasso, ridge, pls... 
Food for thoughts...




________________________________
 Da: Patrick Burns <[hidden email]>
A: [hidden email]
Inviato: Mercoledì 11 Gennaio 2012 17:35
Oggetto: Re: [R-SIG-Finance] dynamic window size in rolling linear regression?

Let's think about what you are asking for.

You want to change the window size in order
(I presume) to get better predictions.  So
it seems to me that you would need a variable
that has information about the pertinence of
past data to the future.

I could imagine volatility being such a variable
in some circumstances.  I don't know of any
work along those lines -- I'd be interested to
hear of any.

My usual practice is to have weights that descend
linearly.  In comparison to exponentially decaying
weights this puts more weight on the older data,
and hence is often a more stable estimate.  It has
the advantage over equal weighting that the window
size is of less importance.

On 11/01/2012 17:11, Michael wrote:

> Hi all,
>
> In application of linear regression to financial time series, we always
> have a parameter which is the window size.
>
> It's clear that a lot of results are sensitive to this parameter...
>
> Is there a way to make this parameter dynamic, or are there statistical
> procedures to select such parameter dynamically and/or "optimally"?
>
>  From a trading strategy perspective, is there a way to make this parameter
> dynamically chosen?
>
> Thanks a lot!
>
>     [[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.
>
--
Patrick Burns
[hidden email]
http://www.burns-stat.com
http://www.portfolioprobe.com/blog
twitter: @portfolioprobe

_______________________________________________
[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.
Reply | Threaded
Open this post in threaded view
|

Re: dynamic window size in rolling linear regression?

Eric Zivot
How to pick an optimal window depends, of course, on what optimal means.
Peseran and Timmermann have numerous articles related to this topic,
although they tend to focus on optimal forecasting in the presence of
structural change (just search on their names in SSRN and you will see a ton
of papers). Here is a recent paper:
http://www.econ.cam.ac.uk/faculty/pesaran/wp11/PPP-30-Oct-2011.pdf  Their
analysis clearly defines what "optimal" means and they derive optimal
weights for the data to satisfy their optimality criteria.

-----Original Message-----
From: [hidden email]
[mailto:[hidden email]] On Behalf Of riccardo visca
Sent: Wednesday, January 11, 2012 10:08 AM
To: Patrick Burns; [hidden email]
Subject: Re: [R-SIG-Finance] dynamic window size in rolling linear
regression?

What about using an expanding window with exponential weights to make the
coefficients more adaptive? Throwing away data is not good.
Still you need to have weights that are inverse of conditional variance to
correct eteroschedasticity.

It could be a lot more efficient computationally than Kalman and one could
use robust or lasso, ridge, pls...
Food for thoughts...




________________________________
 Da: Patrick Burns <[hidden email]>
A: [hidden email]
Inviato: Mercoledl 11 Gennaio 2012 17:35
Oggetto: Re: [R-SIG-Finance] dynamic window size in rolling linear
regression?

Let's think about what you are asking for.

You want to change the window size in order (I presume) to get better
predictions.  So it seems to me that you would need a variable that has
information about the pertinence of past data to the future.

I could imagine volatility being such a variable in some circumstances.  I
don't know of any work along those lines -- I'd be interested to hear of
any.

My usual practice is to have weights that descend linearly.  In comparison
to exponentially decaying weights this puts more weight on the older data,
and hence is often a more stable estimate.  It has the advantage over equal
weighting that the window size is of less importance.

On 11/01/2012 17:11, Michael wrote:
> Hi all,
>
> In application of linear regression to financial time series, we
> always have a parameter which is the window size.
>
> It's clear that a lot of results are sensitive to this parameter...
>
> Is there a way to make this parameter dynamic, or are there
> statistical procedures to select such parameter dynamically and/or
"optimally"?

>
>  From a trading strategy perspective, is there a way to make this
> parameter dynamically chosen?
>
> Thanks a lot!
>
>     [[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.
>

--
Patrick Burns
[hidden email]
http://www.burns-stat.com
http://www.portfolioprobe.com/blog
twitter: @portfolioprobe

_______________________________________________
[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.
Reply | Threaded
Open this post in threaded view
|

Re: dynamic window size in rolling linear regression?

Patrick Burns-2
In reply to this post by riccardo visca
Throwing away data *is* good if the
process changes and that data is not
applicable to the future.

Exponential weights throw away lots of
data -- though they leave a very small
amount of weight (at least) for all
datapoints.

Pat

On 11/01/2012 18:08, riccardo visca wrote:

> What about using an expanding window with exponential weights to make
> the coefficients more adaptive? Throwing away data is not good.
> Still you need to have weights that are inverse of conditional variance
> to correct eteroschedasticity.
>
> It could be a lot more efficient computationally than Kalman and one
> could use robust or lasso, ridge, pls...
> Food for thoughts...
>
>
> ------------------------------------------------------------------------
> *Da:* Patrick Burns <[hidden email]>
> *A:* [hidden email]
> *Inviato:* Mercoledì 11 Gennaio 2012 17:35
> *Oggetto:* Re: [R-SIG-Finance] dynamic window size in rolling linear
> regression?
>
> Let's think about what you are asking for.
>
> You want to change the window size in order
> (I presume) to get better predictions. So
> it seems to me that you would need a variable
> that has information about the pertinence of
> past data to the future.
>
> I could imagine volatility being such a variable
> in some circumstances. I don't know of any
> work along those lines -- I'd be interested to
> hear of any.
>
> My usual practice is to have weights that descend
> linearly. In comparison to exponentially decaying
> weights this puts more weight on the older data,
> and hence is often a more stable estimate. It has
> the advantage over equal weighting that the window
> size is of less importance.
>
> On 11/01/2012 17:11, Michael wrote:
>  > Hi all,
>  >
>  > In application of linear regression to financial time series, we always
>  > have a parameter which is the window size.
>  >
>  > It's clear that a lot of results are sensitive to this parameter...
>  >
>  > Is there a way to make this parameter dynamic, or are there statistical
>  > procedures to select such parameter dynamically and/or "optimally"?
>  >
>  > From a trading strategy perspective, is there a way to make this
> parameter
>  > dynamically chosen?
>  >
>  > Thanks a lot!
>  >
>  > [[alternative HTML version deleted]]
>  >
>  > _______________________________________________
>  > [hidden email] <mailto:[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.
>  >
>
> --
> Patrick Burns
> [hidden email] <mailto:[hidden email]>
> http://www.burns-stat.com
> http://www.portfolioprobe.com/blog
> twitter: @portfolioprobe
>
> _______________________________________________
> [hidden email] <mailto:[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.
>
>

--
Patrick Burns
[hidden email]
http://www.burns-stat.com
http://www.portfolioprobe.com/blog
twitter: @portfolioprobe

_______________________________________________
[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.
Reply | Threaded
Open this post in threaded view
|

Re: dynamic window size in rolling linear regression?

riccardo visca
Good point, but I still prefer weighting to choosing a rolling window, maybe because I never had good success with them. 

A better point of view is the one of defining structural breaks as mentioned earlier and select the window up until that last break.

A note: you never reasonably know if data are not applicable to the future: you cannot make information that you do not have. 
However regime switching helps to adapt models to structural breaks and sometimes losing one prediction point is not too bad as decision can adjust bad predictions (stop loss, degearing...).

So I think you are right and wrong and we have been too generic.




________________________________
 Da: Patrick Burns <[hidden email]>

Cc: "[hidden email]" <[hidden email]>
Inviato: Giovedì 12 Gennaio 2012 9:09
Oggetto: Re: [R-SIG-Finance] dynamic window size in rolling linear regression?

Throwing away data *is* good if the
process changes and that data is not
applicable to the future.

Exponential weights throw away lots of
data -- though they leave a very small
amount of weight (at least) for all
datapoints.

Pat

On 11/01/2012 18:08, riccardo visca wrote:

> What about using an expanding window with exponential weights to make
> the coefficients more adaptive? Throwing away data is not good.
> Still you need to have weights that are inverse of conditional variance
> to correct eteroschedasticity.
>
> It could be a lot more efficient computationally than Kalman and one
> could use robust or lasso, ridge, pls...
> Food for thoughts...
>
>
> ------------------------------------------------------------------------
> *Da:* Patrick Burns <[hidden email]>
> *A:* [hidden email]
> *Inviato:* Mercoledì 11 Gennaio 2012 17:35
> *Oggetto:* Re: [R-SIG-Finance] dynamic window size in rolling linear
> regression?
>
> Let's think about what you are asking for.
>
> You want to change the window size in order
> (I presume) to get better predictions. So
> it seems to me that you would need a variable
> that has information about the pertinence of
> past data to the future.
>
> I could imagine volatility being such a variable
> in some circumstances. I don't know of any
> work along those lines -- I'd be interested to
> hear of any.
>
> My usual practice is to have weights that descend
> linearly. In comparison to exponentially decaying
> weights this puts more weight on the older data,
> and hence is often a more stable estimate. It has
> the advantage over equal weighting that the window
> size is of less importance.
>
> On 11/01/2012 17:11, Michael wrote:
>  > Hi all,
>  >
>  > In application of linear regression to financial time series, we always
>  > have a parameter which is the window size.
>  >
>  > It's clear that a lot of results are sensitive to this parameter...
>  >
>  > Is there a way to make this parameter dynamic, or are there statistical
>  > procedures to select such parameter dynamically and/or "optimally"?
>  >
>  > From a trading strategy perspective, is there a way to make this
> parameter
>  > dynamically chosen?
>  >
>  > Thanks a lot!
>  >
>  > [[alternative HTML version deleted]]
>  >
>  > _______________________________________________
>  > [hidden email] <mailto:[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.
>  >
>
> --
> Patrick Burns
> [hidden email] <mailto:[hidden email]>
> http://www.burns-stat.com
> http://www.portfolioprobe.com/blog
> twitter: @portfolioprobe
>
> _______________________________________________
> [hidden email] <mailto:[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.
>
>
--
Patrick Burns
[hidden email]
http://www.burns-stat.com
http://www.portfolioprobe.com/blog
twitter: @portfolioprobe
        [[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.
Reply | Threaded
Open this post in threaded view
|

Re: dynamic window size in rolling linear regression?

Patrick Burns-2
On 12/01/2012 10:05, riccardo visca wrote:

[...]

> So I think you are right and wrong ...

I absolutely agree.  Though we may
still have a discussion on which is which.

Pat

>
>
>
> ------------------------------------------------------------------------
> *Da:* Patrick Burns <[hidden email]>
> *A:* riccardo visca <[hidden email]>
> *Cc:* "[hidden email]" <[hidden email]>
> *Inviato:* Giovedì 12 Gennaio 2012 9:09
> *Oggetto:* Re: [R-SIG-Finance] dynamic window size in rolling linear
> regression?
>
> Throwing away data *is* good if the
> process changes and that data is not
> applicable to the future.
>
> Exponential weights throw away lots of
> data -- though they leave a very small
> amount of weight (at least) for all
> datapoints.
>
> Pat
>
> On 11/01/2012 18:08, riccardo visca wrote:
>  > What about using an expanding window with exponential weights to make
>  > the coefficients more adaptive? Throwing away data is not good.
>  > Still you need to have weights that are inverse of conditional variance
>  > to correct eteroschedasticity.
>  >
>  > It could be a lot more efficient computationally than Kalman and one
>  > could use robust or lasso, ridge, pls...
>  > Food for thoughts...
>  >
>  >
>  > ------------------------------------------------------------------------
>  > *Da:* Patrick Burns <[hidden email]
> <mailto:[hidden email]>>
>  > *A:* [hidden email] <mailto:[hidden email]>
>  > *Inviato:* Mercoledì 11 Gennaio 2012 17:35
>  > *Oggetto:* Re: [R-SIG-Finance] dynamic window size in rolling linear
>  > regression?
>  >
>  > Let's think about what you are asking for.
>  >
>  > You want to change the window size in order
>  > (I presume) to get better predictions. So
>  > it seems to me that you would need a variable
>  > that has information about the pertinence of
>  > past data to the future.
>  >
>  > I could imagine volatility being such a variable
>  > in some circumstances. I don't know of any
>  > work along those lines -- I'd be interested to
>  > hear of any.
>  >
>  > My usual practice is to have weights that descend
>  > linearly. In comparison to exponentially decaying
>  > weights this puts more weight on the older data,
>  > and hence is often a more stable estimate. It has
>  > the advantage over equal weighting that the window
>  > size is of less importance.
>  >
>  > On 11/01/2012 17:11, Michael wrote:
>  > > Hi all,
>  > >
>  > > In application of linear regression to financial time series, we always
>  > > have a parameter which is the window size.
>  > >
>  > > It's clear that a lot of results are sensitive to this parameter...
>  > >
>  > > Is there a way to make this parameter dynamic, or are there statistical
>  > > procedures to select such parameter dynamically and/or "optimally"?
>  > >
>  > > From a trading strategy perspective, is there a way to make this
>  > parameter
>  > > dynamically chosen?
>  > >
>  > > Thanks a lot!
>  > >
>  > > [[alternative HTML version deleted]]
>  > >
>  > > _______________________________________________
>  > > [hidden email] <mailto:[hidden email]>
> <mailto:[hidden email] <mailto:[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.
>  > >
>  >
>  > --
>  > Patrick Burns
>  > [hidden email] <mailto:[hidden email]>
> <mailto:[hidden email] <mailto:[hidden email]>>
>  > http://www.burns-stat.com
>  > http://www.portfolioprobe.com/blog
>  > twitter: @portfolioprobe
>  >
>  > _______________________________________________
>  > [hidden email] <mailto:[hidden email]>
> <mailto:[hidden email]
> <mailto:[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.
>  >
>  >
>
> --
> Patrick Burns
> [hidden email] <mailto:[hidden email]>
> http://www.burns-stat.com
> http://www.portfolioprobe.com/blog
> twitter: @portfolioprobe
>
>

--
Patrick Burns
[hidden email]
http://www.burns-stat.com
http://www.portfolioprobe.com/blog
twitter: @portfolioprobe

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