1. This is a statistical question. Please do not post further to this list.
It is about R, and you have summarily dismissed all attempts to answer your
R questions as unhelpful. So you need to look elsewhere.
2. Consult a statistician -- you use the statistical words, but do not
understand what they mean. There often is NO single model that both
maximizes likelihood and minimizes AIC (depending on the models one fits).
-- Bert
On Wed, Jul 4, 2012 at 7:03 AM, Sajeeka Nanayakkara wrote:
> Hi,
>
> Thanks for your explanation. But still I didn't get the answer which I
> need.
>
> You have mentioned the code which can obtain AIC values for all models at
> once. My question is; the procedure of selecting the suitable model to
> predict using R package.
>
> If I select the model which produces the smallest AIC and maximized log
> likelihood values, as the suitable model is it correct?
>
>
> Sajeeka Nanayakkara
>
>
>
>
> ________________________________
> From: Rui Barradas
>
> Cc: r-help@r-project.org
> Sent: Wednesday, July 4, 2012 3:38 PM
> Subject: Re: [R] how to check convergence of arima model
>
> Hello,
>
> Put the fitted models in a list and then use lapply with AIC(). Like this
>
>
> set.seed(1)
> x <- 1:100 + sqrt(1:100 + runif(100)) + rnorm(100)
> models <- list()
> models[[1]] <- arima(diff(x), order = c(1, 0, 0)) # Just to show
> models[[2]] <- arima(diff(x), order = c(1, 0, 1)) # several
> models[[3]] <- arima(diff(x), order = c(2, 0, 2)) # models
> models[[4]] <- arima(diff(x), order = c(2, 0, 3))
> lapply(models, AIC)
>
>
> Or run each model at a time through AIC(), whichever suits better.
>
> Hope this helps
>
> Rui Barradas
>
> Em 04-07-2012 10:22, Sajeeka Nanayakkara escreveu:
> > Hi,
> >
> > I need to predict exchange rates using time series. So according to ACF
> > and PACF knowledge, mixed model (ARIMA) be the appropriate and now, I
> > need to find order of the model (p,d,q). So, several models were fitted
> > to select the suitable model using arima().
> >
> > Could you please tell me the procedure of selecting the correct order as
> > I don't have enough time to search?
> >
> > Thank you.
> >
> > Sajeeka Nanayakkara
> >
> >
> >
> >
> >
> > ------------------------------------------------------------------------
> > *From:* Rui Barradas
>
> > *Cc:* r-help@r-project.org
> > *Sent:* Wednesday, July 4, 2012 2:58 PM
> > *Subject:* Re: [R] how to check convergence of arima model
> >
> > Hello,
> >
> > Inline.
> >
> > Em 04-07-2012 09:35, Sajeeka Nanayakkara escreveu:
> > > Hi,
> > >
> > > Sorry, since I didn't see the earlier message I resend it.
> > >
> > > I read the help page that you mentioned. But the problem is for all
> > > models, code is zero. According to that, all models were converged.
> > > Considering AIC value the best model is selected.
> >
> > No, arima() does not select models by AIC. That is the default behavior
> > of ar(); arima() does NOT select models, it selects, using optim, values
> > for the parameters of a specified model. You must choose the orders
> > yourself.
> >
> > Hope this helps,
> >
> > Rui Barradas
> >
> > >
> > > Is that correct procedure?
> > >
> > > The R code which was used is;
> > > model1<-arima(rates,c(1,1,1))
> > > model1
> > > model1$code
> > > [1] 0
> > >
> > > Sajeeka Nanayakkara
> > >
> > >
> > >
> > >
> ------------------------------------------------------------------------
> > > *From:* Rui Barradas ruipbarradas@sapo.pt>>
>
>
> > > *Cc:* r-help@r-project.org
> > > *Sent:* Wednesday, July 4, 2012 2:01 PM
> > > *Subject:* Re: [R] how to check convergence of arima model
> > >
> > > Hello,
> > >
> > > Sorry, but do you read the answers to your posts?
> > > Inline.
> > >
> > > Em 04-07-2012 08:02, Sajeeka Nanayakkara escreveu:
> > > > I have already fitted several models
> > > > using R code; arima(rates,c(p,d,q))
> > > >
> > >
> > > And I have already answered to a question starting like this
> yesterday.
> > > In the mean time, the subject line changed.
> > >
> > > >
> > > > As I heard, best model produce the
> > > > smallest AIC value, but maximum likelihood estimation procedure
> > optimizer
> > > > should converge.
> > > >
> > > >
> > > > How to check whether maximum likelihood estimation procedure
> > > optimizer has converged or not?
> > >
> > > Yes, it was this question, the subject line was 'question'...
> > >
> > > ... And the answer was: read the manual, that I quoted, by the way.
> > >
> > > It now changed to: read the manual, period.
> > >
> > > Rui Barradas
> > >
> > > > [[alternative HTML version deleted]]
> > > >
> > > > ______________________________________________
> > > > R-help@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.
> > > >
> > >
> > >
> > >
> >
> >
> >
> [[alternative HTML version deleted]]
>
>
> ______________________________________________
> R-help@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.
>
>
--
Bert Gunter
Genentech Nonclinical Biostatistics
Internal Contact Info:
Phone: 467-7374
Website:
http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm
[[alternative HTML version deleted]]