ARIMA, xreg and intercepts

5 messages Options
Embed this post
Permalink
Peter Brecknock

ARIMA, xreg and intercepts

Reply Threaded More More options
Print post
Permalink
Apologies for cross posting.

David Stoffer describes some challenges with R's output when fitting
ARIMA models for different orders (see Issue 2 at
http://www.stat.pitt.edu/stoffer/tsa2/Rissues.htm). R doesn't fit an
intercept in the model if there is any differencing. David describes a
workaround using the xreg parameter to force R to calculate an
intercept.

Assume I have a variable y and 3 explanatory variables a, b and c.

No intercept would be produced for the model .... fit = arima(y,
order=c(1,1,0), xreg=c(a,b,c))

1. If I wish to force an intercept to be output is the following
correct?

intercept = 1:length(y)
fit2 = arima(y, order=c(1,1,0), xreg=c(intercept, a, b, c))

2. If 1 is correct, is the following code equivalent?

data = ts.intersect(diff(y),intercept, a,b,c)
fit3 = arima(data[,1], order=c(1,0,0), xreg=[,c(2:5)])

3. If I fit 2 and find the intercept is not significant would it be
correct to use the following?

fit = arima(y, order=c(1,1,0), xreg=c(a,b,c))

Thanks for your help

Kind regards

Pete


This e-mail may contain confidential or proprietary information
belonging to the BP group and is intended only for the use of the
recipients named above.  If you are not the intended recipient, please
immediately notify the sender and either delete this email or return to
the sender immediately.  You may not review, copy or distribute this
email.  Within the bounds of law, this part of BP retains all emails and
IMs and may monitor them to ensure compliance with BP's internal
policies and for other legitimate business purposes.


        [[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.
Peter Brecknock

ARIMA, xreg and intercepts

Reply Threaded More More options
Print post
Permalink
Re-posting from Monday .......

Hi All

David Stoffer describes some challenges with R's output when fitting
ARIMA models for different orders (see Issue 2 at
http://www.stat.pitt.edu/stoffer/tsa2/Rissues.htm). R doesn't fit an
intercept in the model if there is any differencing. David describes a
workaround using the xreg parameter to force R to calculate an
intercept.

Assume I have a variable y and 3 explanatory variables a, b and c.

No intercept would be produced for the model .... fit = arima(y,
order=c(1,1,0), xreg=c(a,b,c))

1. If I wish to force an intercept to be output is the following
correct?

intercept = 1:length(y)
fit1 = arima(y, order=c(1,1,0), xreg=c(intercept, a, b, c))

2. If 1 is correct, is the following code equivalent?

data = ts.intersect(diff(y),intercept, a,b,c)
fit2 = arima(data[,1], order=c(1,0,0), xreg=[,c(2:5)])

3. If I fit 2 and find the intercept is not significant would it then be
correct to use the following?

fit = arima(y, order=c(1,1,0), xreg=c(a,b,c))


Thanks for your help

Kind regards

Pete

This e-mail may contain confidential or proprietary information
belonging to the BP group and is intended only for the use of the
recipients named above.  If you are not the intended recipient, please
immediately notify the sender and either delete this email or return to
the sender immediately.  You may not review, copy or distribute this
email.  Within the bounds of law, this part of BP retains all emails and
IMs and may monitor them to ensure compliance with BP's internal
policies and for other legitimate business purposes.


        [[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.
Brian G. Peterson

Re: ARIMA, xreg and intercepts

Reply Threaded More More options
Print post
Permalink
Rather than reposting, you might get more of a response if you followed
the posting guide:

http://www.r-project.org/posting-guide.html

and provided a reproducible example.

It seems that from your pseudocode, you could test your own hypothesis,
but you didn't provide data, so I can't check.  If your hypothesized
behavior did not materialize, as seems likely, then providing the steps
that you tried, what you expected/wanted to happen, and what happened
instead would assist someone else who felt like helping you out.

Also, it is considered impolite to attach claims of confidentiality to a
public mailing list.

Regards,

  - Brian

Brecknock, Peter wrote:

> Re-posting from Monday .......
>
> Hi All
>
> David Stoffer describes some challenges with R's output when fitting
> ARIMA models for different orders (see Issue 2 at
> http://www.stat.pitt.edu/stoffer/tsa2/Rissues.htm). R doesn't fit an
> intercept in the model if there is any differencing. David describes a
> workaround using the xreg parameter to force R to calculate an
> intercept.
>
> Assume I have a variable y and 3 explanatory variables a, b and c.
>
> No intercept would be produced for the model .... fit = arima(y,
> order=c(1,1,0), xreg=c(a,b,c))
>
> 1. If I wish to force an intercept to be output is the following
> correct?
>
> intercept = 1:length(y)
> fit1 = arima(y, order=c(1,1,0), xreg=c(intercept, a, b, c))
>
> 2. If 1 is correct, is the following code equivalent?
>
> data = ts.intersect(diff(y),intercept, a,b,c)
> fit2 = arima(data[,1], order=c(1,0,0), xreg=[,c(2:5)])
>
> 3. If I fit 2 and find the intercept is not significant would it then be
> correct to use the following?
>
> fit = arima(y, order=c(1,1,0), xreg=c(a,b,c))
>
>
> Thanks for your help
>
> Kind regards
>
> Pete
>  


--
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.
Peter Brecknock

Re: ARIMA, xreg and intercepts

Reply Threaded More More options
Print post
Permalink
Brian

I have attached some code that I hope illustrates my issue.

y=c(-0.626,0.183,-0.835,1.595,0.329,-0.820,0.487,0.738,0.575,-0.305)
a=c(-0.896,0.184,1.587,-1.130,-0.080,0.132,0.707,-0.239,1.984,-0.138)
b=c(2.090,-1.199,1.589,1.954,0.004,-2.451,0.477,-0.596,0.792,0.289)
c=c(-0.383,-1.959,-0.841,1.903,0.622,1.990,-0.305,-0.090,-0.184,-1.198)

# No intercept fitted
fit = arima(y, order=c(1,1,0), xreg=cbind(a,b,c))

# Q1 - How would I fit an intercept along with explanatory variables
using the order=c(1,1,0) approach?

# My attempt ....
intercept = 1:length(y)
fit1 = arima(y, order=c(1,1,0), xreg=cbind(intercept, a, b, c))

# Q2 - What is the equivalent code to Q1 that would use order=c(1,0,0)?

# My attempt .... (gives different results to fit1)
data = ts.intersect(ts(diff(y)),ts(a),ts(b),ts(c))
fit2 = arima(data[,1], order=c(1,0,0), xreg=data[,c(2:4)])

# Q3 - Assume intercept non-significant. At that point would it make
sense to fit the following no intercept model?

fit = arima(y, order=c(1,1,0), xreg=cbind(a,b,c))


It's funny that it is considered impolite to (inadvertently) attach a
claim of confidentiality to a public mailing list but that it is not
considered impolite to publically rebuke someone for doing it! ;-)
 
Kind regards

Pete


-----Original Message-----
From: Brian G. Peterson [mailto:[hidden email]]
Sent: Thursday, November 12, 2009 8:35 AM
To: Brecknock, Peter
Cc: [hidden email]
Subject: Re: [R-SIG-Finance] ARIMA, xreg and intercepts

Rather than reposting, you might get more of a response if you followed
the posting guide:

http://www.r-project.org/posting-guide.html

and provided a reproducible example.

It seems that from your pseudocode, you could test your own hypothesis,
but you didn't provide data, so I can't check.  If your hypothesized
behavior did not materialize, as seems likely, then providing the steps
that you tried, what you expected/wanted to happen, and what happened
instead would assist someone else who felt like helping you out.

Also, it is considered impolite to attach claims of confidentiality to a

public mailing list.

Regards,

  - Brian

Brecknock, Peter wrote:

> Re-posting from Monday .......
>
> Hi All
>
> David Stoffer describes some challenges with R's output when fitting
> ARIMA models for different orders (see Issue 2 at
> http://www.stat.pitt.edu/stoffer/tsa2/Rissues.htm). R doesn't fit an
> intercept in the model if there is any differencing. David describes a
> workaround using the xreg parameter to force R to calculate an
> intercept.
>
> Assume I have a variable y and 3 explanatory variables a, b and c.
>
> No intercept would be produced for the model .... fit = arima(y,
> order=c(1,1,0), xreg=c(a,b,c))
>
> 1. If I wish to force an intercept to be output is the following
> correct?
>
> intercept = 1:length(y)
> fit1 = arima(y, order=c(1,1,0), xreg=c(intercept, a, b, c))
>
> 2. If 1 is correct, is the following code equivalent?
>
> data = ts.intersect(diff(y),intercept, a,b,c)
> fit2 = arima(data[,1], order=c(1,0,0), xreg=[,c(2:5)])
>
> 3. If I fit 2 and find the intercept is not significant would it then
be

> correct to use the following?
>
> fit = arima(y, order=c(1,1,0), xreg=c(a,b,c))
>
>
> Thanks for your help
>
> Kind regards
>
> Pete
>  


--
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.
Guillaume Yziquel-4

Re: ARIMA, xreg and intercepts

Reply Threaded More More options
Print post
Permalink
Brecknock, Peter a écrit :
>
> It's funny that it is considered impolite to (inadvertently) attach a
> claim of confidentiality to a public mailing list but that it is not
> considered impolite to publically rebuke someone for doing it! ;-)
>  
> Kind regards
>
> Pete

No. It's not funny. At all.

Guillaume Yziquel.

_______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-finance
-- Subscriber-posting only.
-- If you want to post, subscribe first.