Tell me more ×
Cross Validated is a question and answer site for statisticians, data analysts, data miners and data visualization experts. It's 100% free, no registration required.

I am trying to fit a time series model to the following data. It seems to be seasonal. Would an ARIMA model be good?

enter image description here Here is the data:

Count

2 1 4 5 4 8 7 11 4 4 11 7 10 7 0 19 13 13 11 9 8 16 10 12 9 7 21 9 10 6 7 19 18 9 19 15 14 17 9 10 10 13 15 20 15 12 15 16

The numbers are separated by spaces.

share|improve this question
1  
The data do not appear to be the same as the plot. (Where is the 42 in the data on the plot? Where is the value of (28,0) on the plot shown in the data?) – whuber Jul 23 '12 at 18:47
@whuber: The data starts at t=12. – Damien Jul 23 '12 at 18:54
Usually time is the abscissa and the observed value is the ordinate. You have it switch which I think is what confused whuber. – Michael Chernick Jul 23 '12 at 19:45
@MichaelChernick: Isn't my data correct if we assume the x-axis is time? – Damien Jul 23 '12 at 20:21
1  
Damien, editing the data was a bad idea, because you have already received several detailed responses that used the data you originally posted. It's unfair of you in effect to pull the rug out from under those who have gone to that work to help you. – whuber Jul 23 '12 at 20:43
show 4 more comments

2 Answers

up vote 2 down vote accepted

I'm not sure the data you added to your post is the same you used to make the plot. At any rate, it doesn't really matter since we're trying to help with the underlying methodological aspect of the problem.

From whatever information we have, i would advise a simple median filter:

The idea is to circumvent the model-fitting procedure as much as possible, since we don't have enough information --and IMHO datapoints-- to build a complicated model.

Edit: Following Whuber's suggestion I've taken the square root transformation to symmetricize the residuals.

looking at the outliers, i don't really see a seasonality --below, for illustration, i'm carrying the analysis using R, the open source statistical software

library("robfilter")
dta<-c(2, 1, 4, 5, 4, 8, 7, 11, 4, 4, 11, 7, 10, 7, 42, 19, 13, 13, 11, 9, 8, 16, 10, 12, 9, 7, 21, 9, 10, 6, 7, 19, 18, 9, 19 ,15, 14, 17, 9, 10 ,10, 13, 15, 20, 15, 12, 15, 16 ,20, 17, 21 ,19, 8, 16, 11, 12, 16, 10, 5, 18, 13, 18, 16, 7, 12, 12, 17, 17, 7, 14, 15 ,10, 13, 15, 11, 13, 10, 9, 11, 11 ,10, 8, 24, 13, 18, 8, 8 ,13, 9 ,7, 6, 14, 17 ,7, 13, 9, 11, 19, 8 ,9, 13, 11, 14, 5, 8, 8, 13, 12 ,20, 9, 18 ,13, 13, 10 ,6 ,9, 8, 8)
mod4a<-robreg.filter(y=sqrt(dta),width=12,method="MED",h=7,minNonNAs=5,online=TRUE,extrapolate=FALSE)
resds<-abs(c(rep(sqrt(dta[1]),11),na.omit(mod4a$level[,1]))-sqrt(dta))
    mod4b<-robreg.filter(y=resds,width=12,method="MED",h=7,minNonNAs=5,online=TRUE,extrapolate=FALSE)
    otl<-which(resds/mod4b$level[,1]>3) #time of the outliers:
>otl
[1]  15  32  53  59  83  85 104 109

fit of the series, with outliers marked in green

share|improve this answer
1  
This is the right idea, because (a) there is a trend but it's not easily characterized and (b) there are no significant serial correlations at any lag. However, loess will do a much better job than a median filter at characterizing these data. All this begs the question of why the OP is fitting the data: median filters or loess will do little for predicting future values, for instance. – whuber Jul 23 '12 at 20:33
1  
@whuber: --this is a one sided filter: as far as i understood the option "online" makes sure it doesn't use data from $t+i$, $i>0$ at time $t$. More generally, I agree with you: I also tough of asking the OP what was the end purpose (is he, for example, interested in the value of an ar coefficient for a given lag)? – user603 Jul 23 '12 at 20:38
@user602: I want to predict data – Damien Jul 23 '12 at 20:41
1  
Good point about the potential online nature (+1). Another mild improvement can be achieved by analyzing the square roots of the data (because these evidently are counts). Alternatively--for sophisticated analysts--a Poisson GLM with splines or changepoints would do a fine job. – whuber Jul 23 '12 at 20:41
1  
yes. But again, you are encouraged to go read the references quoted in the manual – user603 Jul 23 '12 at 22:32
show 17 more comments
  1. delete the leading zeroes as they can inflate the autocorrelation function
  2. a visual suggest possibly a level shift and then a slight upward trend
  3. a few anomalies , maybe just one , (pulses)
  4. no apparent seasonal structure.

An ARIMA model would be good just as long as the reflections above were considered.

If you want to post the data , I will be more specific as to the applicability of ARIMA.

The 114 values you posted are quite different from your original plot. The actual-fit-forecast isenter image description here. The acf of the original series shows little structure enter image description here . The "best model" contains no ARIMA structure but evidences a few unusual data points and three distinct means or GROUPS [1-32 ; 33-69 ; 70-114 ] enter image description here with outliers enter image description here] .[4] . The acf of the residuals suggests randomness![enter image description here . What we have here are three arima models of the form (0,0,0)(0,0,0) with three different means or regimes XBAR1=8.0 ; XBAR2=14.826 and XBAR3=10.8572. One could consider this single-dimension cluster analysis (see Univariate clustering of time series )

share|improve this answer
Can I email you the data? – Damien Jul 23 '12 at 18:23
5  
Damien, because that kind of personal communication circumvents the purpose and mechanisms of this site it is strongly discouraged. – whuber Jul 23 '12 at 18:36
1  
@IrishStat I see from your plot that Huber was right. his data looks nothing like the original plot even if the labelling was corrected. It does look like two level shifts with no apparent trend at all. there is one very distinctive outlier in the first portion of the series and possbly another after the second shift. My suggestions wouldn't work for this plot. Mine only pertained as possibilities to the original plot. If there was an issue with the private communication i think it is resolved as you have exhibited the data and your modeling of it very nicely for CV. – Michael Chernick Jul 24 '12 at 0:26
1  
@IrishStat it looks to me that the level shifts explain a lot of the variation, The remaining problems are the outliers and the job for the OP to come up with a sensible explanation for the apparent behavior. – Michael Chernick Jul 24 '12 at 0:28
1  
The data are counts and ARMA models are not good choice to analyze them (even after transforming the data). It's better to use generalized ARMA (GLARMA) models. – hbaghishani Jul 24 '12 at 11:24
show 1 more comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.