Displaying 20 results from an estimated 2000 matches similar to: "Confidence intervals in ccf()"
2011 Jan 19
2
CCF and missing values.
Hi,
I have missing values in my time series. "na.action = na.pass" works for acf and pacf. Why do I get the following error for the ccf?
> ts(matrix(c(dev$u[1:10],dev$q[1:10]),ncol=2),start=1,freq=1)
Time Series:
Start = 1
End = 10
Frequency = 1
Series 1 Series 2
1 68.00000 138.4615
2 70.00000 355.5556
3 68.76000 304.3200
4 68.00000 231.4286
5 69.74194 357.4963
6
2010 Apr 26
1
Why am I getting different results from cor VS ccf ?
Hi all,
I am getting different results from ccf and cor,
Here is a simple example:
set.seed(100)
N <- 100
x1 <- sample(N)
x2 <- x1 + rnorm(N,0,5)
ccf(x1,x2)$acf[ccf(x1,x2)$lag == -1]
cor(x1[-N], x2[-1])
Results:
> ccf(x1,x2)$acf[ccf(x1,x2)$lag == -1]
[1] -0.128027
> cor(x1[-N], x2[-1])
[1] -0.1301427
Thanks,
Tal
----------------Contact
2014 Nov 04
1
[R] Calculation of cross-correlation in ccf
Dear All,
I am studying some process measurement time series in R and trying to identify time delays using cross-correlation function ccf. The results have however been bit confusing. I found a couple of years old message about this issue but unfortunately wasn't able to find it again for a reference.
For example, an obvious time shift is observed between the measurements y1 and y2 when the
2006 Sep 15
1
"ccf versus acf"
I am trying to run a cross-correlation using the "ccf()" function. When
I select plot = TRUE in the ccf() I get a graph which has ACF on the
y-axis, which would suggest that these y-values are the auto-correlation
values.
How should I adjust the code to produce a plot that provides the
cross-correlation values?
Here is my code:
w002dat <-
2006 Oct 02
1
CCF and ACF
Dear all,
given two numeric vectors x and y, the ACF(x) at lag k is
cor(x(t),x(t+k)) while the CCF(x,y) at lag k is cor(x(t),y(t-k)). See
below for a simple example.
> set.seed(1)
> x <- rnorm(10)
> y <- rnorm(10)
> x
[1] -0.6264538 0.1836433 -0.8356286 1.5952808 0.3295078 -0.8204684
0.4874291 0.7383247 0.5757814 -0.3053884
> y
[1] 1.51178117 0.38984324
2006 Nov 28
1
ccf documentation bug or suggeston (PR#9394)
On 11/28/2006 11:50 AM, A.I. McLeod wrote:
> Hi Duncan,
Hi Ian.
>
> ccf(x,y) does not explain whether c(k)=cov(x(t),x(t+k)) or d(k)=cov(x(t),x(t-k)) is calculated. The following example demonstrates
> that the c(k) definition is used:
> ccf(c(-1,1,rep(0,8)),c(1,rep(0,9)))
> However S-Plus acf uses the d(k) definition in their acf function.
I don't think our code looks
2002 Jun 11
1
extra 0 in ccf
im using R 1.5.0 on redhat.
when i use ccf in the ts library i get, what i think is, an incorrect
entry in the lag and acf components. as an example, look at the second
entry in the lag and acf components below:
> library(ts)
> tmp <- ccf(ts(rnorm(3)),ts(rnorm(3)),plot=F)
> tmp$lag
, , 1
[,1]
[1,] -1
[2,] 0
[3,] 0
[4,] 1
> tmp$acf
, , 1
[,1]
[1,]
2008 May 08
1
significance threshold in CCF
Hi everyone,
When the CCF between two series of observations is plotted in R, a line indicating (presumably) the significance threshold appears across the plot. Does anyone know how this threshold is determined (it is different for each set of series) and how its value can be extracted from R? I've tried saving the CCF into an object and unclassing the object, but there's nothing there to
2010 Jul 14
1
ccf function
Hello,
I am a very new R user and not a statistician so please excuse any over
explanation, I'm just trying to be as clear as possible.
I have performed a cross correlation of two time series (my columns) in a single
data setusing:
ccf(ts(A[rows,columnX]),(A[rows,columnY]), lag=NULL, type="correlation",plot=F)
I?am able to get the results (for example):
Autocorrelations of
2008 Dec 18
3
Parsing unusual date format
Hello,
If I have a character string like
d <- c("1990m3", "1992m8") #March 1990 and Aug 1992
what is the easiest way to convert it into any standard date form; for
example,
d <- c("01/03/1990", "01/08/1992")
I looked at as.Date but it doesn't seem to address my problem as I have an
"m" stuck in the middle of my character string
2013 Jan 29
1
ccf (cross correlation function) problems
Hello everybody,
I am sorry if my questions are too simple or not easily understandable. I’m
not a native English speaker and this is my first analysis using this
function.
I have a problem with a cross correlation function and I would like to
understand how I have to perform it in R.
I have yearly data of an independent variable (x) from 1982 to 2010, and I
also have yearly data of a variable
2003 Dec 02
1
Help with this topic
Dear ladies and gentlemen,
I would like to calculate autocovarinace and cross-covariance scores 1,
2 and 3 of four classes A, B, C and D. I am using acf and ccf from time
sires library. My problem is that I can not separate my data among the
classes A, B, C and D. When I calculated acf for Score 1, I got a wrong
result. The reason being that instead of using ony 60, 40 and 20, the
program
2009 Jan 05
3
if statement
Hi,
How do I check for two conditions in an if loop? I want to check if a value
lies between 2 other values.
For example,
A <- ts(rnorm(120), freq=12, start=c(1992,8))
X <- 0.5
Y <- 0.8
I would like to create a new vector C for which C[i] is 0 if A[i] lies in
between X and Y.
Would be grateful for any help. Sorry for asking such an R-newbie question!
Shruthi
--
View this message
2012 May 11
1
Possible artifacts in cross-correlation function ("ccf")?
Dear R-users,
I have been using R and its core-packages with great satisfaction now for many years, and have recently started using the "ccf" function (part of the "stats" package version 2.16.0), about which I have a question.
The "ccf"-algorithm for calculating the cross-correlation between two time series always calculates the mean and standard deviation per time
2008 Jul 25
1
How to pass function argument of same name to internal call?
I ran across this problem when playing with ccf().
Its function call is
>function (x, y, lag.max = NULL, type = c("correlation", "covariance"),
plot = TRUE, na.action = na.fail, ...)
Internally, ccf() calls plot(), which digs up plot.acf() whose default
style is type='h' .
I wanted to pass the argument type='l' to the plotting routine, but of
2009 Feb 03
1
Using getSymbols
Hi,
How can one ask getSymbols to obtain data within a specified time interval?
For example, if I am downloading US PPI data:
usppi <- as.zoo(getSymbols("PPIACO", src="FRED", verbose=TRUE,
auto.assign=FALSE))
How do I ask getSymbols to truncate starting from Jan-1970 until present? I
looked up the help file but couldn't find anything.
Another newbie question, can I
2009 Mar 10
1
HAC corrected standard errors
Hi,
I have a simple linear regression for which I want to obtain HAC corrected
standard errors, since I have significant serial/auto correlation in my
residuals, and also potential heteroskedasticity.
Would anyone be able to direct me to the function that implements this in R?
It's a basic question and I'm sure I'm missing something obvious here. I
looked up this post:
2008 Dec 18
1
For and if confusion
I have two date objects
X <- c("01-03-1993", "01-05-1997") #Mar 1993 and May 1997
Y <- c("01-02-1995", "01-08-1999") #Feb 1995 and Aug 1999
and a time series object
A <- ts(rnorm(120), freq=12, start=c(1992,8)) #Aug 1992 to Aug 2002
I want to create a binary (0-1) vector B that is of length 1:(A).
B should have value 1 for the time periods
2008 May 16
1
Dimensions of svd V matrix
Hi,
I'm trying to do PCA on a n by p wide matrix (n < p), and I'd like to
get more principal components than there are rows. However, svd() only
returns a V matrix of with n columns (instead of p) unless the argument
nv=p is set (prcomp calls svd without setting it). Moreover, the
eigenvalues returned are always min(n, p) instead of p, even if nv is set:
> x <-
2006 Nov 27
2
NaN with ccf() for vector with all same element
hello,
i have been using ccf() to look at the correlation between lightning and electrogamnetic data. for the most part it has worked exactly as expected. however, i have come across something that puzzles me a bit:
> x <- c(1, 0, 1, 0, 1, 0)
> y <- c(0, 0, 0, 0, 0, 0)
> ccf(x, x, plot = FALSE)
Autocorrelations of series 'X', by lag
-4 -3 -2 -1 0