[R] Determination lag order - problem with daily data and AR / ARIMA
Hello, I am trying to determine a lag order for my data with the help of AIC and/ or BIC in order to conduct further tests. It is about prices measured at a daily frequency (weekends and holidays excluded). 1) My first approach was to approximate the process with an AR model using the function ar(x, ...) and a loop to try several lags and then determine the AIC and BIC values for each lag to determine the lowest one. However, when I try to use the BIC function or the AIC, setting k = log(length(time series)), it does not work. The error says that the model is of the class ar and AIC cannot work with that. [This is not the loop, but just the general problem when inserting an ar model into AIC] > model=ar(price, aic = FALSE, method="ols") > AIC(model, k = 2) Error in UseMethod("logLik") : no applicable method for 'logLik' applied to an object of class "ar" > AIC(model, k = log(length(price_G))) Error in UseMethod("logLik") : no applicable method for 'logLik' applied to an object of class "ar" 2) Alternatively, I know that ar selects by default he lag order via the AIC criterion, but it suggests 40 lags, which appears quite high to me. Therefore, I wanted to check this result for robustness by applying BIC. But that doesn't work due to the problem explained above. 3) Another option was to use an ARIMA model with order = c(lags, 0, 0) and then determine the AIC and BIC values. That does generally work, but it calculates AICs and BICs of zero for every kind of lag. That doesn't make sense to me. So that is why I think I may have a problem in classifying my daily data. I just inserted the numeric vector for calculating the models. But how can I classify the daily data as a time series correctly? (Because weekends and holidays are missing.) I've tried the zoo package, but then I can't use the ARIMA function any more. Can anyone offer any help to make one of the three approaches work? Thanks in advance! -- View this message in context: http://r.789695.n4.nabble.com/Determination-lag-order-problem-with-daily-data-and-AR-ARIMA-tp4692195.html Sent from the R help mailing list archive at Nabble.com. __ 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.
[R] Determination lag order - problem with daily data and AR / ARIMA
Hello, I am trying to determine a lag order for my data with the help of AIC and/ or BIC in order to conduct further tests. It is about prices measured at a daily frequency (weekends and holidays excluded). My first approach was to approximate the process with an AR model using the function ar(x, ...) and a loop to try several lags and then determine the AIC and BIC values for each lag to determine the lowest one. However, when I try to use the BIC function or the AIC, setting k = log(length(time series)), it does not work. The error says that the model is of the class ar and AIC cannot work with that. [This is not the loop, but just the general problem when inserting an ar model into AIC] > model=ar(price, aic = FALSE, method="ols") > AIC(model, k = 2) Error in UseMethod("logLik") : no applicable method for 'logLik' applied to an object of class "ar" > AIC(model, k = log(length(price_G))) Error in UseMethod("logLik") : no applicable method for 'logLik' applied to an object of class "ar" Alternatively, I know that ar selects by default he lag order via the AIC criterion, but it suggests 40 lags, which appears quite high to me. Therefore, I wanted to check this result for robustness by applying BIC. But that doesn't work due to the problem explained above. Another option was to use an ARIMA model with order = c(lags, 0, 0) and then determine the AIC and BIC values. That does generally work, but it calculates AICs and BICs of zero for every kind of lag. That doesn't make sense to me. So that is why I think I may have a problem in classifying my daily data. I just inserted the numeric vector for calculating the models. But how can I classify the daily data as a time series correctly? (Because weekends and holidays are missing.) I've tried the zoo package, but then I can't use the ARIMA function any more. Can anyone offer any help to make on of the three approaches work? Thanks in advance! -- View this message in context: http://r.789695.n4.nabble.com/Determination-lag-order-problem-with-daily-data-and-AR-ARIMA-tp4692194.html Sent from the R help mailing list archive at Nabble.com. __ 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.