Re: [R] ACF values with confidence limits + Plot Extaction

2016-03-06 Thread Jean-Claude Arbaut
a <- as.ts(rnorm(20)) png("acf.png") a.acf <- acf(a) dev.off() # to see what is available names(a.acf) unclass(a.acf) 2016-03-06 20:06 GMT+01:00 Preetam Pal : > Thanks, Michael. Appreciate it. > But suppose I go for the plot, how to extract it from R ... say, I want to > save it as a .png file.

Re: [R] ACF values with confidence limits + Plot Extaction

2016-03-06 Thread Bert Gunter
My word! Did you try ?png? More to the point, any good R tutorial should provide such info. Pls make some reasonable efforts on your own before posting here. Cheers, Bert On Sunday, March 6, 2016, Preetam Pal wrote: > Thanks, Michael. Appreciate it. > But suppose I go for the plot, how t

Re: [R] ACF values with confidence limits + Plot Extaction

2016-03-06 Thread Preetam Pal
Thank you very much,Jean-Claude and Michael. 1> @Michael, your suggestion "plot = FALSE" only returns the estimated ACF values, not the confidence limits at different lags. May be I am missing something here.Do you know any way around for this? 2>@Jean-Claude, got it, thanks. Regards, Preetam On

Re: [R] ACF values with confidence limits + Plot Extaction

2016-03-06 Thread Preetam Pal
Thanks, Michael. Appreciate it. But suppose I go for the plot, how to extract it from R ... say, I want to save it as a .png file. Regards, Preetam On Sun, Mar 6, 2016 at 3:39 PM, Michael Dewey wrote: > According to the documentation acf returns what you want. It also says > that it returns it i

Re: [R] ACF values with confidence limits + Plot Extaction

2016-03-06 Thread Michael Dewey
According to the documentation acf returns what you want. It also says that it returns it invisibly if plot = TRUE which I imagine is what you are doing. So try res <- acf(insert_parameters_here, plot = FALSE) and then look at res On 06/03/2016 07:40, Preetam Pal wrote: Hi R-users, I have

[R] ACF values with confidence limits + Plot Extaction

2016-03-05 Thread Preetam Pal
Hi R-users, I have a time series of residuals and I want to get the ACF (autocorrelation) values till lag = 12, along with the 12 upper/lower confidence limits. I understand that acf(residual) would give me the plot, but I will also need the actual values as an array etc. Plus, I'll have to extrac

Re: [R] acf(ts.union()): Missing Values in Object

2014-03-27 Thread Rich Shepard
On Thu, 27 Mar 2014, Rich Shepard wrote: s95ec.z <- read.zoo("s95ec.dat", sep = ".", format = "%Y-%m-%d" ^ ) didn't copy but was present on the command line. Tryi

Re: [R] acf(ts.union()): Missing Values in Object

2014-03-27 Thread Rich Shepard
On Thu, 27 Mar 2014, Rich Shepard wrote: I'll report back on whether that avoids the errors. Changing from ts.union() to ts.intersect() did not make a difference. So, I went back to bare metal by using awk to generate two-column text files, each consisting of a date and an interger or real v

Re: [R] acf(ts.union()): Missing Values in Object

2014-03-27 Thread Rich Shepard
On Thu, 27 Mar 2014, William Dunlap wrote: Why aren't you using ts.intersect instead of ts.union? Bill, I was wondering the same thing. The reason (perhaps excuse would be the more appropriate term) is my emulating the example in Paul Cowpertwait and Andrew Metcalfe's "Introductory Time Ser

Re: [R] acf(ts.union()): Missing Values in Object

2014-03-27 Thread William Dunlap
45 AM > To: r-help@r-project.org > Subject: Re: [R] acf(ts.union()): Missing Values in Object > > On Wed, 26 Mar 2014, Rich Shepard wrote: > > > According to the ts.union help, "‘ts.union’ pads with ‘NA’s to the total > > time coverage" but the problem seems to be

Re: [R] acf(ts.union()): Missing Values in Object

2014-03-27 Thread Rich Shepard
On Wed, 26 Mar 2014, Rich Shepard wrote: According to the ts.union help, "‘ts.union’ pads with ‘NA’s to the total time coverage" but the problem seems to be that one series has a single NA while the other has 2 NAs. Both series have 792 rows of (date, value). I should have written in the fi

[R] acf(ts.union()): Missing Values in Object

2014-03-26 Thread Rich Shepard
I have 2 time series (class 'ts') and I want to plot the acf for each and the joint ccf using acf(ts.union(ts1, ts2)). According to the ts.union help, "‘ts.union’ pads with ‘NA’s to the total time coverage" but the problem seems to be that one series has a single NA while the other has 2 NAs.

Re: [R] acf and ccf

2013-07-30 Thread arun
s, snames = colnames(x)), class = "acf") Check this link: http://stackoverflow.com/questions/14035506/how-to-see-the-source-code-of-r-internal-or-primitive-function A.K. From: Cathy Lee Gierke To: arun Sent: Tuesday, July 30, 2013 5:04 PM Subject:

Re: [R] acf and ccf

2013-07-30 Thread arun
Just type acf ccf on R prompt A.K. - Original Message - From: Cathy Lee Gierke To: r-help@r-project.org; r-core-ow...@r-project.org Cc: Sent: Tuesday, July 30, 2013 4:02 PM Subject: [R] acf and ccf Greetings, Is it possible to see the source code for the acf and ccf functions

[R] acf and ccf

2013-07-30 Thread Cathy Lee Gierke
Greetings, Is it possible to see the source code for the acf and ccf functions? I want to understand the exact formula used. It may be in this book, but I am hoping I can find it elsewhere, as the book is quite expensive. Venables, W. N. and Ripley, B. D. (2002) *Modern Applied Statistics with S

Re: [R] acf question...

2013-07-02 Thread Rolf Turner
On 03/07/13 04:21, Venkatesh Nagarajan wrote: > I am trying to understand lagged correlations. > > x= 1:100; > y = c(rep(NA,40), 1:60)ccf(x = x, y = y, lag.max=100, na.action=na.pass, type > = "correlation") > > I was hoping to see max cor at lag = 40. But I am not. What am I doing wrong? We

Re: [R] acf question...

2013-07-02 Thread Jeff Newmiller
Then you are posting in the wrong forum, since this is a forum about getting R to do things for which you already understand the theory. As to the results you are getting, I highly recommend reading the details section of ?ccf. BTW The Posting Guide indicates that you should post in text format

[R] acf question...

2013-07-02 Thread Venkatesh Nagarajan
I am trying to understand lagged correlations.   x= 1:100; y = c(rep(NA,40), 1:60)ccf(x = x, y = y, lag.max=100, na.action=na.pass, type = "correlation")   I was hoping to see max cor at lag = 40. But I am not. What am I doing wrong?   Thanks VN [[alternative HTML version deleted]] ___

Re: [R] acf () and pacf()

2012-12-30 Thread Prof Brian Ripley
On 30/12/2012 07:47, Rashid Ameer wrote: I have used acf() and pacf() in R to get the acf and pacf values at max/lag=20 but the output did not show the values associated with lag numbers. lag numbers is shown in decimals. What 'lag numbers'? Lags in time series are in time units: most likely y

[R] acf () and pacf()

2012-12-30 Thread Rashid Ameer
I have used acf() and pacf() in R to get the acf and pacf values at max/lag=20 but the output did not show the values associated with lag numbers. lag numbers is shown in decimals. -- Rashid Ameer View my recent publication at * http://www.emeraldinsight.com/fwd.htm?id=aob&ini=aob&doi=10.1108/1753

Re: [R] acf() plot of matrix cuts y-axis labels

2012-03-02 Thread Folkes, Michael
-project.org Subject: Re: [R] acf() plot of matrix cuts y-axis labels On 02/03/2012 11:40 AM, Folkes, Michael wrote: > Hello all, > I found a funny problem with y-axis labels when plotting acf(matrix) - > the labels are too close to one of the margins and cut in half. > Here's the

Re: [R] acf() plot of matrix cuts y-axis labels

2012-03-02 Thread Duncan Murdoch
On 02/03/2012 11:40 AM, Folkes, Michael wrote: Hello all, I found a funny problem with y-axis labels when plotting acf(matrix) - the labels are too close to one of the margins and cut in half. Here's the problem: test<-matrix(rnorm(200),ncol=4) acf(test) This doesn't fix the problem: test<-matr

[R] acf() plot of matrix cuts y-axis labels

2012-03-02 Thread Folkes, Michael
Hello all, I found a funny problem with y-axis labels when plotting acf(matrix) - the labels are too close to one of the margins and cut in half. Here's the problem: test<-matrix(rnorm(200),ncol=4) acf(test) This doesn't fix the problem: test<-matrix(rnorm(200),ncol=4) par(mar=c(3,3,2,0.2),oma=c(

Re: [R] acf?

2011-11-04 Thread Gabor Grothendieck
On Sat, Nov 5, 2011 at 12:26 AM, Kevin Burton wrote: > I started to check what I thought I knew with autocovariance and it doesn’t > jive with the the calculations given by ‘R’. I was wondering if there is > some scaling or something that I am not aware of. > > > > Take the example > > > > Ø  d <-

[R] acf?

2011-11-04 Thread Kevin Burton
I started to check what I thought I knew with autocovariance and it doesn’t jive with the the calculations given by ‘R’. I was wondering if there is some scaling or something that I am not aware of. Take the example Ø d <- 1:10 Ø (a <- acf(d, type="covariance", demean=FALSE, plot=FALSE))

Re: [R] Acf of Frima

2011-02-02 Thread Spencer Graves
What's farima? functional arima or fractional arima? If the former, the "fda" package includes a function "cor.fd" for "correlation matrix from functional data object(s)". If the latter, I suggest you use sos as follows: library(sos) (fr <- findFn('fractional arima')) "findFn" sear

[R] Acf of Frima

2011-02-02 Thread Chuse chuse
Hello, I am trying to calculate the autocovariance matrix for any general farima(p,d,q) with p,q > 1. Could anyone give an idea how to implement in R or if there is any package for this? thank you beforehand. Jose. __ R-help@r-project.org mailing list

Re: [R] acf function

2010-09-26 Thread Theresa Csar
Hi Andre, try acf.data$acf regards, Theresa andre bedon wrote: Hi, Im new to R so this question is quite fundamental. Im trying to compare some autocorrelations generated by the acf function to some theoretical correlations. How can I have acces to just the autocorrelations, for comput

[R] acf function

2010-09-26 Thread andre bedon
Hi, Im new to R so this question is quite fundamental. Im trying to compare some autocorrelations generated by the acf function to some theoretical correlations. How can I have acces to just the autocorrelations, for computation? This is some of my code: > acf.data<-c(acf(x)) > acf.dat

[R] acf significance levels

2010-07-14 Thread nuncio m
Dear useRs, How to save the correlations corresponding to the significance levels from ACF function Thanks nuncio -- Nuncio.M Research Scientist National Center for Antarctic and Ocean research Head land Sada Vasco da Gamma Goa-403804 [[alternative HTML version dele

Re: [R] acf

2010-07-06 Thread Joris Meys
Your question is a bit confusing. "acfresidfit" is an object, of which we don't know the origin. with your test file, I arrive at the first correlations (but with integer headings) : > residfit <- read.table("fileree2_test_out.txt") > acf(residfit) > acfresid <- acf(residfit) > acfresid Autocorre

[R] acf

2010-07-06 Thread nuncio m
Hi list, I have the following code to compute the acf of a time series acfresid <- acf(residfit), where residfit is the series when I type acfresid at the prompt the follwoing is displayed Autocorrelations of series ‘residfit’, by lag 0. 0.0833 0.1667 0.2500 0. 0.4167 0.5000 0.5

Re: [R] ACF and PACF

2010-02-11 Thread Uwe Ligges
On 11.02.2010 12:48, sathiya_mtm wrote: Hi helpers, can you help me in plotting acf and pacf functions in R. I am using the code acf(variable name) > but it is not working. For me it is, hence citing the footer of al R-help messages: PLEASE do read the posting guide http://www.R-project

[R] ACF and PACF

2010-02-11 Thread sathiya_mtm
Hi helpers, can you help me in plotting acf and pacf functions in R. I am using the code acf(variable name) but it is not working. Expecting your reply. Thanks -- View this message in context: http://n4.nabble.com/ACF-and-PACF-tp1477149p1477149.html Sent from the R help mailing list archive

Re: [R] ACF normalization and Nesed For loops

2009-12-22 Thread alok juneja
Thanks for the suggestions.. I must admit that on the R-help one of my coworker is asking the same question named "Nested For loops". My question "ACF normalization" and his question both lead to the same problem. So now I merge both the questions. Sorry for the inconvenience. The main problem

Re: [R] ACF normalization and Nesed For loops

2009-12-22 Thread alok juneja
ch one. As when I used ACF, I simply used it like acf(distance,lag.max=l0,plot=FALSE) but I am not sure by default generic ACF is using either ACF.gls or ACF.lme Please guide so that I can kick start. Best Alok & Baloo --- On Tue, 12/22/09, ONKELINX, Thierry wrote: > From: ONKELINX, T

Re: [R] ACF normalization.

2009-12-22 Thread ONKELINX, Thierry
: R help Onderwerp: Re: [R] ACF normalization. May be please inform where I can find the source code for "nlme:::ACF.gls" and "nlme:::ACF.lme". Sorry to ask. As I have looked into the R directory but don't find that. Best Alok --- On Tue, 12/22/09, Prof Brian Ripley

Re: [R] ACF normalization.

2009-12-22 Thread alok juneja
May be please inform where I can find the source code for "nlme:::ACF.gls" and "nlme:::ACF.lme". Sorry to ask. As I have looked into the R directory but don't find that. Best Alok --- On Tue, 12/22/09, Prof Brian Ripley wrote: > From: Prof Brian Ripley > Sub

Re: [R] ACF normalization.

2009-12-22 Thread Prof Brian Ripley
On Tue, 22 Dec 2009, alok juneja wrote: Hi, My earlier email was sent as html so no visible properly. I am now posting it as text. Sorry for the duplication of the message. Can anyone please provide the formula used to compute ACF(nlme). I believe the one that is used in R is of the type me

Re: [R] ACF normalization.

2009-12-22 Thread alok juneja
Hi, My earlier email was sent as html so no visible properly. I am now posting it as text. Sorry for the duplication of the message. Can anyone please provide the formula used to compute ACF(nlme). I believe the one that is used in R is of the type mentioned on the website (http://www.itl.nis

[R] ACF normalization.

2009-12-22 Thread alok juneja
Hi, Can anyone please provide the formula used to compute ACF(nlme). I believe the one that is used in R is of the type mentioned on the website. Please correct me if I am wrong. The normalization of the numerator (Ch) has been done by 'N' where as I would like to do it by 'N-k'. Is there anywa

Re: [R] acf for a univariate time series in a data frame

2009-10-08 Thread CJ Rubio
*additional: the lags i am expecting is in months.. since i am trying to predict monthly streamflow. thanks again -- View this message in context: http://www.nabble.com/acf-for-a-univariate-time-series-in-a-data-frame-tp25799751p25799784.html Sent from the R help mailing list archive at Nabble.

[R] acf for a univariate time series in a data frame

2009-10-08 Thread CJ Rubio
hi everyone! i want to check the autocorrelation function for a univariate time series (streamflow) in a data frame as below: < DF <- read.table("D:/file path") < DF year jan feb mar apr .. dec 1966 0.504 0.406 0.740 0.241 0.429 1967 0.683 0.529

Re: [R] acf gives correlations > 1

2009-09-14 Thread Ted Harding
This is quite a nasty one! I've been having a look at it, and I think it would be useful to go back to first principles. Given a series u[1:N], the correlation coefficient between u[1:(N-k)] and u[(k+1):N] is c(k) = cov(u[1:(N-k)],u[(k+1):N])/sqrt(var(u[1:(N-k)])*var(u(k+1):N])) in which, in par

Re: [R] acf gives correlations > 1

2009-09-14 Thread Liviu Andronic
Hello On Mon, Sep 14, 2009 at 2:53 PM, Steve Jones wrote: > Looks like I'll have to compute the acf myself. Shame, but such is life. > Wouldn't na.omit be an option? Liviu __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-hel

Re: [R] acf gives correlations > 1

2009-09-14 Thread Steve Jones
I misunderstood what the help page was saying - I thought that the missing values were what constituted the invalid function. Clearly I was mistaken. Looks like I'll have to compute the acf myself. Shame, but such is life. Thanks for the input, everyone! Steve. Berwin A Turlach wrote: > G'day S

Re: [R] acf gives correlations > 1

2009-09-14 Thread Duncan Murdoch
On 14/09/2009 7:44 AM, Steve Jones wrote: Apologies for the missing data. It can be downloaded from here (22Kb): http://www.squaregoldfish.co.uk/sekrett/series.csv The dataset is 97% missing values. I suspect what you're seeing is what the man page describes as follows: "If the na.action fu

Re: [R] acf gives correlations > 1

2009-09-14 Thread Berwin A Turlach
G'day Steve, On Mon, 14 Sep 2009 13:44:56 +0200 Steve Jones wrote: > Apologies for the missing data. It can be downloaded from here (22Kb): > http://www.squaregoldfish.co.uk/sekrett/series.csv Well, the Details section of acf's help page states: By default, no missing values are allowed.

Re: [R] acf gives correlations > 1

2009-09-14 Thread Steve Jones
Apologies for the missing data. It can be downloaded from here (22Kb): http://www.squaregoldfish.co.uk/sekrett/series.csv Steve. Duncan Murdoch wrote: > On 14/09/2009 6:40 AM, Steve Jones wrote: >> Hi list, >> >> I've been producing autocorrelation functions of time series using the >> acf functi

Re: [R] acf gives correlations > 1

2009-09-14 Thread Duncan Murdoch
On 14/09/2009 6:40 AM, Steve Jones wrote: Hi list, I've been producing autocorrelation functions of time series using the acf function, and have found a series or two for which correlations of > 1 are given, which I think shouldn't happen. Attached is the time series I'm using, and below is the

[R] acf gives correlations > 1

2009-09-14 Thread Steve Jones
Hi list, I've been producing autocorrelation functions of time series using the acf function, and have found a series or two for which correlations of > 1 are given, which I think shouldn't happen. Attached is the time series I'm using, and below is the R code (version 2.9.1) that I'm entering:

Re: [R] acf Significance

2009-08-07 Thread Steve Jones
Your suggestion wasn't entirely useless - I didn't know about it before, so I learned something! I've had a look in the plot.acf source and found the bit I need, so it's all good now. Thanks for the suggestions. Steve. markle...@verizon.net wrote: > Hi Steve: Clearly my str suggestions was usel

Re: [R] acf Significance

2009-08-06 Thread David Scott
Steve Jones wrote: Thanks for the pointer to the str function - very handy! The output for the acf object is below - it doesn't seem to contain anything that might tell me the significance level. List of 6 $ acf : num [1:27, 1, 1] 1 0.6309 0.2989 0.0612 -0.2105 ... $ type : chr "correlatio

Re: [R] acf Significance

2009-08-06 Thread Steve Jones
Thanks for the pointer to the str function - very handy! The output for the acf object is below - it doesn't seem to contain anything that might tell me the significance level. List of 6 $ acf : num [1:27, 1, 1] 1 0.6309 0.2989 0.0612 -0.2105 ... $ type : chr "correlation" $ n.used: int 27

[R] acf Significance

2009-08-05 Thread Steve Jones
Hi List, I'm trying to calculate the autocorrelation coefficients for a time series using acf at various lags. This is working well, and I can get the coefficients without any trouble. However, I don't seem to be able to obtain the significance of these coefficients from the returned acf object, l

[R] ACF roots

2009-05-29 Thread mauede
I have a number of signals whose ACF may or may not cross the zero line. Whether roots exist or not is a piece of useful information for me. Likewise, if any root exists, I'd like to know its lag value. Unluckily R function ACF does not seem to provide such information. I wonder whether someone c

Re: [R] acf(): meaning of the blue horizontal lines

2008-10-28 Thread Oliver Bandel
Zitat von David Scott <[EMAIL PROTECTED]>: > On Tue, 28 Oct 2008, Oliver Bandel wrote: > > > Zitat von David Scott <[EMAIL PROTECTED]>: > > > >> On Tue, 28 Oct 2008, Oliver Bandel wrote: > >> > >>> Hello, > >>> > >>> what are they meaning? It could be something that > >>> would show a threshhold a

Re: [R] acf(): meaning of the blue horizontal lines

2008-10-28 Thread David Scott
On Tue, 28 Oct 2008, Oliver Bandel wrote: Zitat von David Scott <[EMAIL PROTECTED]>: On Tue, 28 Oct 2008, Oliver Bandel wrote: Hello, what are they meaning? It could be something that would show a threshhold above which the result is indicating different meanings then just random noise. But

Re: [R] acf(): meaning of the blue horizontal lines

2008-10-28 Thread Oliver Bandel
Zitat von David Scott <[EMAIL PROTECTED]>: > On Tue, 28 Oct 2008, Oliver Bandel wrote: > > > Hello, > > > > what are they meaning? It could be something that > > would show a threshhold above which the result is > > indicating different meanings then just random noise. > > But there is no descript

Re: [R] acf() plots of a data.frame: what meaning?

2008-10-28 Thread David Scott
On Tue, 28 Oct 2008, Oliver Bandel wrote: Hello, what is the meaning of the plots of an acf()-plot, when using a data frame as argument? The result is NOT obvious for me. There are combinations of the columns of a dataframe in the reulting plot. But an acf() is just defined for onyl one time-

Re: [R] acf(): meaning of the blue horizontal lines

2008-10-28 Thread David Scott
On Tue, 28 Oct 2008, Oliver Bandel wrote: Hello, what are they meaning? It could be something that would show a threshhold above which the result is indicating different meanings then just random noise. But there is no description on the definition of those lines, so it means nothing, if it is

[R] acf(): meaning of the blue horizontal lines

2008-10-28 Thread Oliver Bandel
Hello, what are they meaning? It could be something that would show a threshhold above which the result is indicating different meanings then just random noise. But there is no description on the definition of those lines, so it means nothing, if it is not clearly defined. Where can I find a deta

[R] acf() plots of a data.frame: what meaning?

2008-10-28 Thread Oliver Bandel
Hello, what is the meaning of the plots of an acf()-plot, when using a data frame as argument? The result is NOT obvious for me. There are combinations of the columns of a dataframe in the reulting plot. But an acf() is just defined for onyl one time-sreies. So what do the plots mean? I did not

[R] acf() and ccf() - acf() on a data-frame: so many plots...

2008-10-26 Thread Oliver Bandel
Hello, when using acf, there is a blue stripped line in the plot. What is the meaning of it? Another question on acf(): when I use adc() on a data-frame it automatically creates a lot of seperated acf-plots. But there are combinations of plots, which seem to be ccf() and not acf(). Is this a "fea

Re: [R] acf function

2008-05-08 Thread Christofer
It should be ok -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Irene Mantzouni Sent: Thursday, May 08, 2008 5:45 PM To: [EMAIL PROTECTED] Subject: [R] acf function Dear all, I have an annual time-series of population numbers and I would like to

[R] acf function

2008-05-08 Thread Irene Mantzouni
Dear all, I have an annual time-series of population numbers and I would like to estimate the auto-correlation. Can I use acf() function and judge whether auto-correlation is significant by the plots? The acf array produced by this functions gives the auto-correlation at lags 1, 2 Is that

[R] acf function

2008-05-08 Thread Irene Mantzouni
Dear all, I have an annual time-series of population numbers and I would like to estimate the auto-correlation. Can I use acf() function and judge whether auto-correlation is significant by the plots? The acf array, eg: Autocorrelations of series 'x$log.s.r', by lag 0 1

Re: [R] acf lag1 value

2008-01-17 Thread Shubha Vishwanath Karanth
2:27 PM To: Shubha Vishwanath Karanth Cc: [EMAIL PROTECTED] Subject: Re: [R] acf lag1 value Please re-check your time-series books. The acf at lag 1 is _not_ the correlation between x and lag(x). For one thing, the variance of x is computed from the whole series, and not from the series with

Re: [R] acf lag1 value

2008-01-17 Thread Prof Brian Ripley
Please re-check your time-series books. The acf at lag 1 is _not_ the correlation between x and lag(x). For one thing, the variance of x is computed from the whole series, and not from the series with either the first or last value removed -- there is also the question of the divisor. See MAS

[R] acf lag1 value

2008-01-17 Thread Shubha Vishwanath Karanth
Hi R, I have doubt. >x= c(4,5,6,3,2,4,5) >acf(x,plot=F,lag.max=1) Autocorrelations of series 'x', by lag 0 1 1.000 0.182 But if I actually calculate the autocorrelation at lag1 I get, >cor(x[-1],x[-length(x)]) [1] 0.1921538 Even in excel I get 0.1921538 val