|
I have already fitted several models
using R code; arima(rates,c(p,d,q)) 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? [[alternative HTML version deleted]] ______________________________________________ [hidden email] 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. |
|
Hello,
Inline. Em 03-07-2012 09:22, Sajeeka Nanayakkara escreveu: > I have already fitted several models > using R code; arima(rates,c(p,d,q)) > 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? By reading the help page. ?arima Value [...] code the convergence value returned by _optim_. Hope this helps, Rui Barradas > [[alternative HTML version deleted]] > > > > ______________________________________________ > [hidden email] 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. > ______________________________________________ [hidden email] 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. |
|
In reply to this post by Sajeeka Nanayakkara
I have already fitted several models
using R code; arima(rates,c(p,d,q)) 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? [[alternative HTML version deleted]] ______________________________________________ [hidden email] 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. |
|
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]] > > ______________________________________________ > [hidden email] 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. > ______________________________________________ [hidden email] 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. |
|
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 <[hidden email]> > *To:* Sajeeka Nanayakkara <[hidden email]> > *Cc:* [hidden email] > *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]] > > > > ______________________________________________ > > [hidden email] <mailto:[hidden email]> 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. > > > > > ______________________________________________ [hidden email] 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. |
|
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 <[hidden email]> Cc: [hidden email] 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 <[hidden email]> > *Cc:* [hidden email] > *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]] > > > > ______________________________________________ > > [hidden email] <mailto:[hidden email]> 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. > > > > > ______________________________________________ [hidden email] 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. |
|
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 <[hidden email]> > *To:* Sajeeka Nanayakkara <[hidden email]> > *Cc:* [hidden email] > *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 <[hidden email] <mailto:[hidden email]>> > > *To:* Sajeeka Nanayakkara <[hidden email] > <mailto:[hidden email]>> > > *Cc:* [hidden email] <mailto:[hidden email]> > > *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]] > > > > > > ______________________________________________ > > > [hidden email] <mailto:[hidden email]> > <mailto:[hidden email] <mailto:[hidden email]>> 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. > > > > > > > > > > > > ______________________________________________ [hidden email] 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. |
|
Also look at auto.arima in the forecast package.
Michael On Jul 4, 2012, at 4:38 AM, Rui Barradas <[hidden email]> wrote: > 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 <[hidden email]> >> *To:* Sajeeka Nanayakkara <[hidden email]> >> *Cc:* [hidden email] >> *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 <[hidden email] <mailto:[hidden email]>> >> > *To:* Sajeeka Nanayakkara <[hidden email] >> <mailto:[hidden email]>> >> > *Cc:* [hidden email] <mailto:[hidden email]> >> > *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]] >> > > >> > > ______________________________________________ >> > > [hidden email] <mailto:[hidden email]> >> <mailto:[hidden email] <mailto:[hidden email]>> 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. >> > > >> > >> > >> > >> >> >> > > ______________________________________________ > [hidden email] 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. ______________________________________________ [hidden email] 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. |
|
In reply to this post by Rui Barradas
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 <[hidden email]> Cc: [hidden email] 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 <[hidden email]> > *Cc:* [hidden email] > *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 <[hidden email] <mailto:[hidden email]>> > > *Cc:* [hidden email] <mailto:[hidden email]> > > *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]] > > > > > > ______________________________________________ > > > [hidden email] <mailto:[hidden email]> > <mailto:[hidden email] <mailto:[hidden email]>> 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. > > > > > > > > > > > > ______________________________________________ [hidden email] 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. |
|
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 <[hidden email]>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 <[hidden email]> > > Cc: [hidden email] > 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 <[hidden email]> > > > *Cc:* [hidden email] > > *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 <[hidden email] <mailto: > [hidden email]>> > > > > > *Cc:* [hidden email] <mailto:[hidden email]> > > > *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]] > > > > > > > > ______________________________________________ > > > > [hidden email] <mailto:[hidden email]> > > <mailto:[hidden email] <mailto:[hidden email]>> 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]] > > > ______________________________________________ > [hidden email] 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]] ______________________________________________ [hidden email] 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. |
|
Thanks for your advice.
Sajeeka ________________________________ From: Bert Gunter <[hidden email]> Cc: Rui Barradas <[hidden email]>; "[hidden email]" <[hidden email]> Sent: Thursday, July 5, 2012 12:43 AM Subject: Re: [R] how to check convergence of arima model 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 ote: 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 <[hidden email]> > >Cc: [hidden email] >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 <[hidden email]> > >> *Cc:* [hidden email] >> *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 <[hidden email] <mailto:[hidden email]>> > > >> > *Cc:* [hidden email] <mailto:[hidden email]> >> > *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]] >> > > >> > > ______________________________________________ >> > > [hidden email] <mailto:[hidden email]> >> <mailto:[hidden email] <mailto:[hidden email]>> 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]] > > >______________________________________________ >[hidden email] 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]] ______________________________________________ [hidden email] 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. |
|
In reply to this post by Sajeeka Nanayakkara
What is the R code for Ljung-Box Test in Statistics? Sajeeka Nanayakkara [[alternative HTML version deleted]] ______________________________________________ [hidden email] 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. |
|
Hello,
The function is ?Box.test It has two types, Box-Pierce and Ljung-Box. Hope this helps, Rui Barradas Em 09-07-2012 15:59, Sajeeka Nanayakkara escreveu: > > > What is the R code for Ljung-Box Test in Statistics? > > Sajeeka Nanayakkara > [[alternative HTML version deleted]] > > > > ______________________________________________ > [hidden email] 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. > ______________________________________________ [hidden email] 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. |
|
In reply to this post by Sajeeka Nanayakkara
What is the R code to check whether data series have outliers or not? Thanks, Sajeeka Nanayakkara [[alternative HTML version deleted]] ______________________________________________ [hidden email] 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. |
|
HI,
Check this link: http://stackoverflow.com/questions/1444306/how-to-use-outlier-tests-in-r-code Hope it would be helpful. A.K. ----- Original Message ----- From: Sajeeka Nanayakkara <[hidden email]> To: "[hidden email]" <[hidden email]> Cc: Sent: Wednesday, July 18, 2012 9:27 AM Subject: [R] R code for to check outliers What is the R code to check whether data series have outliers or not? Thanks, Sajeeka Nanayakkara [[alternative HTML version deleted]] ______________________________________________ [hidden email] 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. ______________________________________________ [hidden email] 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. |
|
In reply to this post by Sajeeka Nanayakkara
checkforoutliers <- function(series)NULL
Cheers, Bert *Explanation: There is no such thing as a statistical outlier -- or, rather,"outlier" is a fraudulent statistical concept, defined arbitrarily and without scientific legitimacy. The typical unstated purpose of such identification is to remove contaminating or irrelevant data, but such a judgment can only be made by a subject matter expert with knowledge of the context and, usually, the specific cause for the unusual data. Do not be misled by the large body of statistical literature on this topic into believing that statistical analysis alone can provide objective criteria to do this. That is a path to scientific purgatory. For the record: 1. I am a statistician 2. Lots of highly knowledgeable, smart statisticians will condemn what I have just said as stupid ranting. The perils of a mailing list. -- Bert On Wed, Jul 18, 2012 at 6:27 AM, Sajeeka Nanayakkara <[hidden email]>wrote: > > > > > What is the R code to check whether data series have outliers or not? > > Thanks, > > Sajeeka Nanayakkara > [[alternative HTML version deleted]] > > > ______________________________________________ > [hidden email] 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]] ______________________________________________ [hidden email] 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. |
|
To further what Bert says:
You would almost certainly prefer to use robust statistics than "outlier detection". I believe Greg Snow's TeachingDemos package has a data set "outliers" suggesting some of the perils of doing things the outlier-removal way. Best, Michael On Wed, Jul 18, 2012 at 9:14 AM, Bert Gunter <[hidden email]> wrote: > checkforoutliers <- function(series)NULL > > Cheers, > Bert > > *Explanation: There is no such thing as a statistical outlier -- or, > rather,"outlier" is a fraudulent statistical concept, defined arbitrarily > and without scientific legitimacy. The typical unstated purpose of such > identification is to remove contaminating or irrelevant data, but such a > judgment can only be made by a subject matter expert with knowledge of the > context and, usually, the specific cause for the unusual data. Do not be > misled by the large body of statistical literature on this topic into > believing that statistical analysis alone can provide objective criteria to > do this. That is a path to scientific purgatory. > > For the record: > 1. I am a statistician > 2. Lots of highly knowledgeable, smart statisticians will condemn what I > have just said as stupid ranting. > > The perils of a mailing list. > > -- Bert > > On Wed, Jul 18, 2012 at 6:27 AM, Sajeeka Nanayakkara <[hidden email]>wrote: > >> >> >> >> >> What is the R code to check whether data series have outliers or not? >> >> Thanks, >> >> Sajeeka Nanayakkara >> [[alternative HTML version deleted]] >> >> >> ______________________________________________ >> [hidden email] 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]] > > ______________________________________________ > [hidden email] 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. ______________________________________________ [hidden email] 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. |
|
> >> What is the R code to check whether data series have >>> outliers or not? In case noone else has pointed you there, you could try the 'outliers' package. That contains some of the 'standard' methods of outlier testing for univariate data. What you do with them when you find them is a rather more complicated and, as you have already seen, controversial question. S Ellison ******************************************************************* This email and any attachments are confidential. Any use...{{dropped:8}} ______________________________________________ [hidden email] 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. |
|
In reply to this post by Bert Gunter
On 18/07/2012 10:14 AM, Bert Gunter wrote:
> checkforoutliers <- function(series)NULL > > Cheers, > Bert > > *Explanation: There is no such thing as a statistical outlier -- or, > rather,"outlier" is a fraudulent statistical concept, defined arbitrarily > and without scientific legitimacy. The typical unstated purpose of such > identification is to remove contaminating or irrelevant data, but such a > judgment can only be made by a subject matter expert with knowledge of the > context and, usually, the specific cause for the unusual data. Do not be > misled by the large body of statistical literature on this topic into > believing that statistical analysis alone can provide objective criteria to > do this. That is a path to scientific purgatory. > > For the record: > 1. I am a statistician > 2. Lots of highly knowledgeable, smart statisticians will condemn what I > have just said as stupid ranting. > > The perils of a mailing list. I think you are assuming that Sajeeka will handle the outliers incorrectly. It happens often enough, but I don't think it's polite to make that assumption. My answer to the question would have been to ask the question, "how do you define outliers?" Certainly it's possible to define outliers in the context of a model, and their presence is an indication of problems with the model. The correct response might be to weaken the assumptions of your model and use a robust procedure as Michael suggested (which might mean throwing away the outliers), or it might be to change the model in some other way. Your advice to consult a subject matter expert is good, but in my experience, they often put more faith in their models than they should, so as a statistician, I think you should point out discrepancies like outliers. Which means it's good to have a function to detect them. Duncan Murdoch > > -- Bert > > On Wed, Jul 18, 2012 at 6:27 AM, Sajeeka Nanayakkara <[hidden email]>wrote: > > > > > > > > > > > What is the R code to check whether data series have outliers or not? > > > > Thanks, > > > > Sajeeka Nanayakkara > > [[alternative HTML version deleted]] > > > > > > ______________________________________________ > > [hidden email] 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. > > > > > > ______________________________________________ [hidden email] 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. |
|
In reply to this post by Bert Gunter
>>>>> Bert Gunter <[hidden email]>
>>>>> on Wed, 18 Jul 2012 07:14:31 -0700 writes: > checkforoutliers <- function(series) NULL > Cheers, Bert > *Explanation: There is no such thing as a statistical > outlier -- or, rather,"outlier" is a fraudulent > statistical concept, defined arbitrarily and without > scientific legitimacy. The typical unstated purpose of > such identification is to remove contaminating or > irrelevant data, but such a judgment can only be made by a > subject matter expert with knowledge of the context and, > usually, the specific cause for the unusual data. Do not > be misled by the large body of statistical literature on > this topic into believing that statistical analysis alone > can provide objective criteria to do this. That is a path > to scientific purgatory. > For the record: 1. I am a statistician > 2. Lots of highly knowledgeable, smart statisticians will condemn what I > have just said as stupid ranting. I entirely agree with you that outlier-removing procedures are mostly misused, and dangerous because of that misuse {and hence should typically NOT be taught, or not the way I have seen them taught (on occasions, not here at ETH!)...} and I even more fervently agree with Michael Weylandt's recommendation to use robust statistics rather than outlier detection --- at least in those cases where "robust statistics" is *not* ill-re-defined as {outlier detection}+{classical stats}. However, I don't think 'outlier' to be a fraudulent concept. Rather I think outliers can be pretty well defined along the line of "outlier WITH RESPECT TO A MODEL" (and 'model' means 'statistical model', i.e., with some randomness built in) : Outlier wrt model M := an observation which is highly improbable to be observed under model M (and "highly improbable" of course is somewhat vague, but that's not a problem per se.) A version of the above is Outlier := an observation that has unduely large influence on the estimators/inference performed where 'estimator / inference' imply a model of course. So I think outlier is a useful concept for those who think about *models* (rather than just data sets), and I agree that without an implicit or explicit model, "outlier" is not well defined. > The perils of a mailing list. > -- Bert :-) Martin > On Wed, Jul 18, 2012 at 6:27 AM, Sajeeka Nanayakkara .. wrote: >> >> What is the R code to check whether data series have >> outliers or not? >> >> Thanks, >> >> Sajeeka Nanayakkara > -- > Bert Gunter Genentech Nonclinical Biostatistics ______________________________________________ [hidden email] 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. |
| Powered by Nabble | Edit this page |
