dhabby wrote:
Last week I run in to a lot a problems triyng to fit an ARIMA model to a
time series. The problem is that the internal process of the arima
function
call function "optim" to estimate the model parameters, so far so
good...
but my data presents a problem with the default method "BFGS" of
the
optim
function, the output error looks like this:
Error en optim(init[mask], armafn, method = "BFGS", hessian = TRUE,
control
= optim.control, :
non-finite finite-difference value [7]
I don't know much about the calls from ARIMA to optim, but when I modified
Fletcher's 1970 VM method (called BFGS in R), I was aiming to make it
extremely robust to messy functions. (I had machinery with only 6 hex
digits for floating point and no guard digits. Furthermore, only 8K bytes
for program AND data. This was 1975/6.) However, BFGS needs gradients, and
it is clear there's some sort of trouble approximating them with finite
differences.
Changing optimization methods might succeed on this occasion, but your
problem is more likely bad scaling or some setup where your ARIMA model
essentially is not sensible. Can you duplicate the message on a small
example problem?
John Nash
Surely, this sounds like a bug in the optim function.
The rule of thumb with ts data is to scale so that data have mean 0 and
unit variance and then fit
a) for non-seasonal data the IMA model (0,1,1); and
b) for seasonal data so-called Airline Model (0,1,1)X(0,1,1)S
see for example A course in TS analysis by Daniel Pena.
These can usually be fit to most series unless they are very irregular
(e.g. mainly zeros) and then Box-Jenkins ARIMA is inappropriate.
The fit of any other model is then judged against these two models. If a
proposed model fit fails it is usual report the fault and then to step over
that model and try the next in sequence - optim should do this, if not then
it's a code fault.
Very often with nasty series only the 2 basic models can be fit and these
results are reported - but for these the parameters may not even fully
converge.
The moral of all this is that automatic modelling methods are handy but not
a substitute for looking at the acf and choosing an appropriate
parameterisation.
Can someone say whether optim has automatic outlier detection - this is a
must have with this type of procedure.
Gerard
nashjc at uottawa.ca
Sent by:
r-help-bounces at r- To
project.org r-help at r-project.org
cc
27/01/2009 15:45 Subject
Re: [R] optim() and ARIMA
dhabby wrote:
Last week I run in to a lot a problems triyng to fit an ARIMA model to
a
time series. The problem is that the internal process of the arima
function
call function "optim" to estimate the model parameters, so far so
good...
but my data presents a problem with the default method "BFGS" of
the
optim
function, the output error looks like this:
Error en optim(init[mask], armafn, method = "BFGS", hessian = TRUE,
control
= optim.control, :
non-finite finite-difference value [7]
I don't know much about the calls from ARIMA to optim, but when I modified
Fletcher's 1970 VM method (called BFGS in R), I was aiming to make it
extremely robust to messy functions. (I had machinery with only 6 hex
digits for floating point and no guard digits. Furthermore, only 8K bytes
for program AND data. This was 1975/6.) However, BFGS needs gradients, and
it is clear there's some sort of trouble approximating them with finite
differences.
Changing optimization methods might succeed on this occasion, but your
problem is more likely bad scaling or some setup where your ARIMA model
essentially is not sensible. Can you duplicate the message on a small
example problem?
John Nash
______________________________________________
R-help at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
**********************************************************************************
The information transmitted is intended only for the person or entity to which
it is addressed and may contain confidential and/or privileged material. Any
review, retransmission, dissemination or other use of, or taking of any action
in reliance upon, this information by persons or entities other than the
intended recipient is prohibited. If you received this in error, please contact
the sender and delete the material from any computer. It is the policy of the
Department of Justice, Equality and Law Reform and the Agencies and Offices
using its IT services to disallow the sending of offensive material.
Should you consider that the material contained in this message is offensive you
should contact the sender immediately and also mailminder[at]justice.ie.
Is le haghaidh an duine n? an eintitis ar a bhfuil s? d?rithe, agus le haghaidh
an duine n? an eintitis sin amh?in, a bhearta?tear an fhaisn?is a tarchuireadh
agus f?adfaidh s? go bhfuil ?bhar faoi r?n agus/n? faoi phribhl?id inti.
Toirmisctear aon athbhreithni?, atarchur n? leathadh a dh?anamh ar an bhfaisn?is
seo, aon ?s?id eile a bhaint aisti n? aon ghn?omh a dh?anamh ar a hiontaoibh, ag
daoine n? ag eintitis seachas an faighteoir beartaithe. M? fuair t? ? seo tr?
dhearmad, t?igh i dteagmh?il leis an seolt?ir, le do thoil, agus scrios an
t-?bhar as aon r?omhaire. Is ? beartas na Roinne Dl? agus Cirt, Comhionannais
agus Athch?irithe Dl?, agus na nOif?g? agus na nGn?omhaireachta? a ?s?ideann
seirbh?s? TF na Roinne, seoladh ?bhair chol?il a dh?chead?.
M?s rud ? go measann t? gur ?bhar col?il at? san ?bhar at? sa teachtaireacht seo
is ceart duit dul i dteagmh?il leis an seolt?ir l?ithreach agus le
mailminder[ag]justice.ie chomh maith.
***********************************************************************************
The optim() function really does no "statistics", so outlier detection is not part of it. It is a link to function minimization. Ravi Varadhan and I are doing some work to see what might be feasible to do to improve optim() and unify the many optimization tools to help users choose the tools more easily. Readers interested can contact me off-list and I'll send them the coordinates of the wiki we're using to collaborate; help definitely welcome. It does occur to me that BFGS, as implemented in R, does not have bounds constraints on parameters, so it is not impossible for inadmissible values to be sent to the function to be minimized (and hence to the gradient estimator). I'm currently struggling to learn how to work with the R internals to add bounds constraints to BFGS, since the code at the C level is pretty straightforward. (My learning woes are in how to interface R and C properly.) And over a career in nonlinear fitting, I've found plenty of just plain nasty functions that will give trouble to software. It's part of the scenery of this area of work. Perhaps someone who has knowledge of how various arima tools in R are implemented can comment if there are filters and scaling before optim() is called. JN> Surely, this sounds like a bug in the optim function. > > The rule of thumb with ts data is to scale so that data have mean 0 and > unit variance and then fit > a) for non-seasonal data the IMA model (0,1,1); and > b) for seasonal data so-called Airline Model (0,1,1)X(0,1,1)S > see for example A course in TS analysis by Daniel Pena. > These can usually be fit to most series unless they are very irregular > (e.g. mainly zeros) and then Box-Jenkins ARIMA is inappropriate. > > The fit of any other model is then judged against these two models. If a > proposed model fit fails it is usual report the fault and then to step > over > that model and try the next in sequence - optim should do this, if not > then > it's a code fault. > Very often with nasty series only the 2 basic models can be fit and these > results are reported - but for these the parameters may not even fully > converge. > The moral of all this is that automatic modelling methods are handy but > not > a substitute for looking at the acf and choosing an appropriate > parameterisation. > > Can someone say whether optim has automatic outlier detection - this is a > must have with this type of procedure. > > Gerard > > > > > > nashjc at uottawa.ca > Sent by: > r-help-bounces at r- To > project.org r-help at r-project.org > cc > > 27/01/2009 15:45 Subject > Re: [R] optim() and ARIMA > > > > > > > > > > > dhabby wrote: > Last week I run in to a lot a problems triyng to fit an ARIMA model > to > a > time series. The problem is that the internal process of the arima > function > call function "optim" to estimate the model parameters, so far so > good... > but my data presents a problem with the default method "BFGS" of the > optim > function, the output error looks like this: > > Error en optim(init[mask], armafn, method = "BFGS", hessian = TRUE, > control > = optim.control, : > non-finite finite-difference value [7] > > I don't know much about the calls from ARIMA to optim, but when I > modified > Fletcher's 1970 VM method (called BFGS in R), I was aiming to make it > extremely robust to messy functions. (I had machinery with only 6 hex > digits for floating point and no guard digits. Furthermore, only 8K bytes > for program AND data. This was 1975/6.) However, BFGS needs gradients, > and > it is clear there's some sort of trouble approximating them with finite > differences. > > Changing optimization methods might succeed on this occasion, but your > problem is more likely bad scaling or some setup where your ARIMA model > essentially is not sensible. Can you duplicate the message on a small > example problem? > > John Nash > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > > > > ********************************************************************************** > The information transmitted is intended only for the person or entity to > which it is addressed and may contain confidential and/or privileged > material. Any review, retransmission, dissemination or other use of, or > taking of any action in reliance upon, this information by persons or > entities other than the intended recipient is prohibited. If you received > this in error, please contact the sender and delete the material from any > computer. It is the policy of the Department of Justice, Equality and Law > Reform and the Agencies and Offices using its IT services to disallow the > sending of offensive material. > Should you consider that the material contained in this message is > offensive you should contact the sender immediately and also > mailminder[at]justice.ie. > > Is le haghaidh an duine n? an eintitis ar a bhfuil s? d?rithe, agus le > haghaidh an duine n? an eintitis sin amh?in, a bhearta?tear an fhaisn?is a > tarchuireadh agus f?adfaidh s? go bhfuil ?bhar faoi r?n agus/n? faoi > phribhl?id inti. Toirmisctear aon athbhreithni?, atarchur n? leathadh a > dh?anamh ar an bhfaisn?is seo, aon ?s?id eile a bhaint aisti n? aon > ghn?omh a dh?anamh ar a hiontaoibh, ag daoine n? ag eintitis seachas an > faighteoir beartaithe. M? fuair t? ? seo tr? dhearmad, t?igh i dteagmh?il > leis an seolt?ir, le do thoil, agus scrios an t-?bhar as aon r?omhaire. Is > ? beartas na Roinne Dl? agus Cirt, Comhionannais agus Athch?irithe Dl?, > agus na nOif?g? agus na nGn?omhaireachta? a ?s?ideann seirbh?s? TF na > Roinne, seoladh ?bhair chol?il a dh?chead?. > M?s rud ? go measann t? gur ?bhar col?il at? san ?bhar at? sa > teachtaireacht seo is ceart duit dul i dteagmh?il leis an seolt?ir > l?ithreach agus le mailminder[ag]justice.ie chomh maith. > *********************************************************************************** > > >