Hello, I am attending a course in Computational Statistics at ETH and in one of the assignments I am asked to prove that a time series is not autocorrelated using the R function "acf". I tried out the acf function with the given data, according to what I found here: http://landshape.org/enm/options-for-acf-in-r/ this test data does not look IID but rather shows some trends so how can I then prove that it is not autocorrelated? maybe the trends are ok? I have bought several titles on R but none really explains autocorrelation or how to interpret the acf function ... the integrated help is also a bit dry. These are the books I have on R: - Introductory Statistics with R (Springer) - A handbook of Statistical Analyses using R (CRC) - R in a Nutshell (Oreilly) - Statistical Computing with R (CRC) Thanks in advance, Best regards, Giovanni # ========================================================================================# Computational Statistics # Series 4 # Author: Giovanni Azua # Date: 16 April 2010 # ========================================================================================rm(list=ls()) # clear workspace # ========================================================================================# EXERCISE 1.(c) # ======================================================================================== # load dataset from web #bmwlr <- scan("http://stat.ethz.ch/Teaching/Datasets/bmw.dat") # load dataset from file bmwlr <- scan("/Users/bravegag/code/compstats/bmw.dat") par(mfrow=c(1,2)) # visualize two plots acf(bmwlr, lag.max = 10) acf(bmwlr^2, lag.max = 10) [[alternative HTML version deleted]]
Giovanni Azua <bravegag <at> gmail.com> writes:> > Hello, > > I am attending a course in Computational Statistics at > ETH and in one of the assignments I am asked to prove > that a time series is not autocorrelated using the R function "acf". > > I tried out the acf function with the given data, > according to what I found here: > http://landshape.org/enm/options-for-acf-in-r/ > this test data does not look IID but rather shows > some trends so how can I then prove that it is not > autocorrelated? maybe the trends are ok? > > I have bought several titles on R but none really explains > autocorrelation or how to interpret the acf > function ... the integrated help is also a bit dry.Hmmm. The acf() shows what looks to be fairly mild autocorrelation at lag 1 (rho=0.09228), which is strongly significant according to the Durbin-Watson test ...> aa <- acf(bmwlr) > aa$acf[2] ## 0.09228> library(car) > durbinWatsonTest(lm(bmwlr~1))lag Autocorrelation D-W Statistic p-value 1 0.09228737 1.815334 0.002 Alternative hypothesis: rho != 0 However, I don't know where you're getting the idea of a trend from: the plot looks noisy (although there is one big excursion in the middle) ? Are you confusing "trend" with "autocorrelation"? I would suggest general time-series books -- Chatfield has several at various levels.
Hello Denis, (1) I appreciate your feedback, however, I feel I have all the right to ask a specific question related R namely what's the interpretation of the acf function plot. I gave away the information that it is a homework because many times people before helping ask what's the context for the question at hand. If I don't understand something I will for sure ask. I don't have anything to hide so I don't care if there are professors subscribed to this list. My ultimate goal is to learn and it doesn't really matter whether it is studying a book, asking an assistant or asking in a forum. (2) After looking in many references and not finding any clue ... I Googled for information and found that I should be "looking for cyclic patterns" i.e. oscillations? There are none in this dataset so I presume there would not be any autocorrelation, oder? (3) This is something very unfortunate ... the course Lectures are great, the course script is very comprehensive, however, the assignments many times include questions that are a bit off topic like in this case of Time Series and includes no actual reference ... so it is no surprise that even after diligently attending all lectures and doing all exercises I get stuck. Please recommend what's the best book in this topic of Time Series analysis maybe with R. I will buy it. (4) Yes they mentioned something like this in the assignment "Dependency can be verified by showing that under the model, Cov(X_t^2,X_{t-h}^2) \neq 0, h > 0 (complicated). Plot and interpret the autocorrelation functions of X_t and X_t^2 for the BMW-dataset." http://stat.ethz.ch/teaching/lectures/FS_2010/CompStat/series4.pdf Thank you. Best regards, Giovanni On Apr 17, 2010, at 7:25 PM, Dennis Murphy wrote:> Hi: > > (1) If you read the posting guide (as you were asked to do before posting), you would find out > rather quickly that this is not a forum to help you with homework. Moreover, several of your > professors may subscribe to this list and notice your request. > (2) What 'trend' is in this data set? It has excessive variation at certain points of the series, > but what trend? > (3) None of your cited references is likely to have much that describes what autocorrelation means. > (The only exception might be HSAUR, but it focuses more on the programming than the concepts.) > I'd consult an actual time series text to learn the concepts you need to make sense of the plots. > (4) You can't 'prove' that the series in question is (or is not) autocorrelated with R or any other > software; however, it can be used to provide empirical support for one hypothesis or the other. > Proof is a mathematical construct involving deductive logic, whereas statistical inference uses > inductive logic. They represent different approaches to problem solving. > > HTH, > Dennis[[alternative HTML version deleted]]