Free Statistics

of Irreproducible Research!

Author's title

Author*The author of this computation has been verified*
R Software Modulerwasp_cross.wasp
Title produced by softwareCross Correlation Function
Date of computationMon, 01 Dec 2008 13:34:35 -0700
Cite this page as followsStatistical Computations at FreeStatistics.org, Office for Research Development and Education, URL https://freestatistics.org/blog/index.php?v=date/2008/Dec/01/t1228163718hro5w4yibolofmw.htm/, Retrieved Sun, 05 May 2024 09:34:20 +0000
Statistical Computations at FreeStatistics.org, Office for Research Development and Education, URL https://freestatistics.org/blog/index.php?pk=27353, Retrieved Sun, 05 May 2024 09:34:20 +0000
QR Codes:

Original text written by user:
IsPrivate?No (this computation is public)
User-defined keywords
Estimated Impact180
Family? (F = Feedback message, R = changed R code, M = changed R Module, P = changed Parameters, D = changed Data)
F     [Univariate Data Series] [Airline data] [2007-10-18 09:58:47] [42daae401fd3def69a25014f2252b4c2]
F RMPD    [Cross Correlation Function] [X: Brandstof Y: A...] [2008-12-01 20:34:35] [63302faa1e3976bf98d1de42298c0b24] [Current]
Feedback Forum
2008-12-03 18:05:28 [Kevin Truyts] [reply
De student heeft een conclusie getrokken na het invoeren van zijn tijdreeksen.
Dit werd ook besproken tijdens het college (maandag).
Zo kunnen we de Cross Correlation function omschrijven als volgt:
Op de x-as vinden we zowel positieve als negatieve getallen terug, terwijl op de y-as de correlatie te vinden is (tussen -1 en +1).
De cross correlatie functie gaat zoeken naar de correlaties tussen 2 tijdreeksen.
Bij de berekeningen zien we een tabel staan. De tweede kolom geeft de correlatie van Xt tot k weer.
Xt van k-perioden geleden gecorreleerd met Yt. Wanneer k negatief is, gaan we k-perioden terug in het verleden. Als k positief is dan geldt dit voor de voorspelling naar de toekomst toe, maar als k = 0 => gewone correlatie tussen Xt en Yt.
In deze tabel en op de grafiek is dan ook af te lezen hoe groot het vertragingseffect is.
2008-12-07 17:14:25 [Chi-Kwong Man] [reply
Sluit me volledig aan bij de uitleg van mijn student. De cross correlation function geeft een verband van de toekomstige evolutie tussen Xt en Yt.
2008-12-08 16:22:12 [Mehmet Yilmaz] [reply
CCF geeft de mate van voorspellen weer van een reeks adhv het verleden van een andere reeks.

Zo zien we bij k=0 dat de correlatie tussen bijde reeksen 61% is, we kunnen dus een hoge mate van voorspelbaarheid verwachten.
Kijken we naar de andere data dan lijkt dit te kloppen. Bij lag=1 zien we dat we reeks Y kunnen verklaren voor 60% met de data van reeks X (1 periode vooruit verschoven). Omgekeerd zien we dat bij lag=-1 55% van Y kan verklaard worden door X (1 periode in het verleden verschoven).

Post a new message
Dataseries X:
118,63
121,83
119,97
124,98
129,99
126,6
121,71
119,28
122,63
116,74
114,23
113,23
112,75
113,54
115,3
121,05
119,51
116,78
117,17
117,5
119,65
120,97
117,18
116,87
119,46
122,52
124,1
118,39
113,1
113,94
114,58
118,79
120,44
118,37
118,44
117,93
117,76
118,29
121,11
124,86
131,17
130,16
131,76
134,7
135,32
140,23
136,31
131,62
128,9
133,89
138,21
146,12
144,69
149,18
156,6
158,87
164,85
162,89
153,31
150,91
Dataseries Y:
105,15
105,24
105,57
105,62
106,17
106,27
106,41
106,94
107,16
107,32
107,32
107,35
107,55
107,87
108,37
108,38
107,92
108,03
108,14
108,3
108,64
108,66
109,04
109,03
109,03
109,54
109,75
109,83
109,65
109,82
109,95
110,12
110,15
110,21
109,99
110,14
110,14
110,81
110,97
110,99
109,73
109,81
110,02
110,18
110,21
110,25
110,36
110,51
110,6
110,95
111,18
111,19
111,69
111,7
111,83
111,77
111,73
112,01
111,86
112,04




Summary of computational transaction
Raw Inputview raw input (R code)
Raw Outputview raw output of R engine
Computing time1 seconds
R Server'Sir Ronald Aylmer Fisher' @ 193.190.124.24

\begin{tabular}{lllllllll}
\hline
Summary of computational transaction \tabularnewline
Raw Input & view raw input (R code)  \tabularnewline
Raw Output & view raw output of R engine  \tabularnewline
Computing time & 1 seconds \tabularnewline
R Server & 'Sir Ronald Aylmer Fisher' @ 193.190.124.24 \tabularnewline
\hline
\end{tabular}
%Source: https://freestatistics.org/blog/index.php?pk=27353&T=0

[TABLE]
[ROW][C]Summary of computational transaction[/C][/ROW]
[ROW][C]Raw Input[/C][C]view raw input (R code) [/C][/ROW]
[ROW][C]Raw Output[/C][C]view raw output of R engine [/C][/ROW]
[ROW][C]Computing time[/C][C]1 seconds[/C][/ROW]
[ROW][C]R Server[/C][C]'Sir Ronald Aylmer Fisher' @ 193.190.124.24[/C][/ROW]
[/TABLE]
Source: https://freestatistics.org/blog/index.php?pk=27353&T=0

Globally Unique Identifier (entire table): ba.freestatistics.org/blog/index.php?pk=27353&T=0

As an alternative you can also use a QR Code:  

The GUIDs for individual cells are displayed in the table below:

Summary of computational transaction
Raw Inputview raw input (R code)
Raw Outputview raw output of R engine
Computing time1 seconds
R Server'Sir Ronald Aylmer Fisher' @ 193.190.124.24







Cross Correlation Function
ParameterValue
Box-Cox transformation parameter (lambda) of X series1
Degree of non-seasonal differencing (d) of X series0
Degree of seasonal differencing (D) of X series0
Seasonal Period (s)1
Box-Cox transformation parameter (lambda) of Y series1
Degree of non-seasonal differencing (d) of Y series0
Degree of seasonal differencing (D) of Y series0
krho(Y[t],X[t+k])
-14-0.072863045771005
-13-0.0317085895655771
-120.000512333722549775
-110.0198336058688529
-100.0448705062271807
-90.0741989219541054
-80.122357029482242
-70.172213386048463
-60.226433978249848
-50.287193272133533
-40.349922958822196
-30.425233746945116
-20.495803099166986
-10.5564105423888
00.611843847055095
10.600098555010654
20.591947143029379
30.57383059578764
40.575738759696511
50.589223486692841
60.597535233106785
70.587803792442851
80.562646505270691
90.55178059230347
100.532420433232796
110.515201237079052
120.502511333470857
130.480045345429888
140.460030036842632

\begin{tabular}{lllllllll}
\hline
Cross Correlation Function \tabularnewline
Parameter & Value \tabularnewline
Box-Cox transformation parameter (lambda) of X series & 1 \tabularnewline
Degree of non-seasonal differencing (d) of X series & 0 \tabularnewline
Degree of seasonal differencing (D) of X series & 0 \tabularnewline
Seasonal Period (s) & 1 \tabularnewline
Box-Cox transformation parameter (lambda) of Y series & 1 \tabularnewline
Degree of non-seasonal differencing (d) of Y series & 0 \tabularnewline
Degree of seasonal differencing (D) of Y series & 0 \tabularnewline
k & rho(Y[t],X[t+k]) \tabularnewline
-14 & -0.072863045771005 \tabularnewline
-13 & -0.0317085895655771 \tabularnewline
-12 & 0.000512333722549775 \tabularnewline
-11 & 0.0198336058688529 \tabularnewline
-10 & 0.0448705062271807 \tabularnewline
-9 & 0.0741989219541054 \tabularnewline
-8 & 0.122357029482242 \tabularnewline
-7 & 0.172213386048463 \tabularnewline
-6 & 0.226433978249848 \tabularnewline
-5 & 0.287193272133533 \tabularnewline
-4 & 0.349922958822196 \tabularnewline
-3 & 0.425233746945116 \tabularnewline
-2 & 0.495803099166986 \tabularnewline
-1 & 0.5564105423888 \tabularnewline
0 & 0.611843847055095 \tabularnewline
1 & 0.600098555010654 \tabularnewline
2 & 0.591947143029379 \tabularnewline
3 & 0.57383059578764 \tabularnewline
4 & 0.575738759696511 \tabularnewline
5 & 0.589223486692841 \tabularnewline
6 & 0.597535233106785 \tabularnewline
7 & 0.587803792442851 \tabularnewline
8 & 0.562646505270691 \tabularnewline
9 & 0.55178059230347 \tabularnewline
10 & 0.532420433232796 \tabularnewline
11 & 0.515201237079052 \tabularnewline
12 & 0.502511333470857 \tabularnewline
13 & 0.480045345429888 \tabularnewline
14 & 0.460030036842632 \tabularnewline
\hline
\end{tabular}
%Source: https://freestatistics.org/blog/index.php?pk=27353&T=1

[TABLE]
[ROW][C]Cross Correlation Function[/C][/ROW]
[ROW][C]Parameter[/C][C]Value[/C][/ROW]
[ROW][C]Box-Cox transformation parameter (lambda) of X series[/C][C]1[/C][/ROW]
[ROW][C]Degree of non-seasonal differencing (d) of X series[/C][C]0[/C][/ROW]
[ROW][C]Degree of seasonal differencing (D) of X series[/C][C]0[/C][/ROW]
[ROW][C]Seasonal Period (s)[/C][C]1[/C][/ROW]
[ROW][C]Box-Cox transformation parameter (lambda) of Y series[/C][C]1[/C][/ROW]
[ROW][C]Degree of non-seasonal differencing (d) of Y series[/C][C]0[/C][/ROW]
[ROW][C]Degree of seasonal differencing (D) of Y series[/C][C]0[/C][/ROW]
[ROW][C]k[/C][C]rho(Y[t],X[t+k])[/C][/ROW]
[ROW][C]-14[/C][C]-0.072863045771005[/C][/ROW]
[ROW][C]-13[/C][C]-0.0317085895655771[/C][/ROW]
[ROW][C]-12[/C][C]0.000512333722549775[/C][/ROW]
[ROW][C]-11[/C][C]0.0198336058688529[/C][/ROW]
[ROW][C]-10[/C][C]0.0448705062271807[/C][/ROW]
[ROW][C]-9[/C][C]0.0741989219541054[/C][/ROW]
[ROW][C]-8[/C][C]0.122357029482242[/C][/ROW]
[ROW][C]-7[/C][C]0.172213386048463[/C][/ROW]
[ROW][C]-6[/C][C]0.226433978249848[/C][/ROW]
[ROW][C]-5[/C][C]0.287193272133533[/C][/ROW]
[ROW][C]-4[/C][C]0.349922958822196[/C][/ROW]
[ROW][C]-3[/C][C]0.425233746945116[/C][/ROW]
[ROW][C]-2[/C][C]0.495803099166986[/C][/ROW]
[ROW][C]-1[/C][C]0.5564105423888[/C][/ROW]
[ROW][C]0[/C][C]0.611843847055095[/C][/ROW]
[ROW][C]1[/C][C]0.600098555010654[/C][/ROW]
[ROW][C]2[/C][C]0.591947143029379[/C][/ROW]
[ROW][C]3[/C][C]0.57383059578764[/C][/ROW]
[ROW][C]4[/C][C]0.575738759696511[/C][/ROW]
[ROW][C]5[/C][C]0.589223486692841[/C][/ROW]
[ROW][C]6[/C][C]0.597535233106785[/C][/ROW]
[ROW][C]7[/C][C]0.587803792442851[/C][/ROW]
[ROW][C]8[/C][C]0.562646505270691[/C][/ROW]
[ROW][C]9[/C][C]0.55178059230347[/C][/ROW]
[ROW][C]10[/C][C]0.532420433232796[/C][/ROW]
[ROW][C]11[/C][C]0.515201237079052[/C][/ROW]
[ROW][C]12[/C][C]0.502511333470857[/C][/ROW]
[ROW][C]13[/C][C]0.480045345429888[/C][/ROW]
[ROW][C]14[/C][C]0.460030036842632[/C][/ROW]
[/TABLE]
Source: https://freestatistics.org/blog/index.php?pk=27353&T=1

Globally Unique Identifier (entire table): ba.freestatistics.org/blog/index.php?pk=27353&T=1

As an alternative you can also use a QR Code:  

The GUIDs for individual cells are displayed in the table below:

Cross Correlation Function
ParameterValue
Box-Cox transformation parameter (lambda) of X series1
Degree of non-seasonal differencing (d) of X series0
Degree of seasonal differencing (D) of X series0
Seasonal Period (s)1
Box-Cox transformation parameter (lambda) of Y series1
Degree of non-seasonal differencing (d) of Y series0
Degree of seasonal differencing (D) of Y series0
krho(Y[t],X[t+k])
-14-0.072863045771005
-13-0.0317085895655771
-120.000512333722549775
-110.0198336058688529
-100.0448705062271807
-90.0741989219541054
-80.122357029482242
-70.172213386048463
-60.226433978249848
-50.287193272133533
-40.349922958822196
-30.425233746945116
-20.495803099166986
-10.5564105423888
00.611843847055095
10.600098555010654
20.591947143029379
30.57383059578764
40.575738759696511
50.589223486692841
60.597535233106785
70.587803792442851
80.562646505270691
90.55178059230347
100.532420433232796
110.515201237079052
120.502511333470857
130.480045345429888
140.460030036842632



Parameters (Session):
par1 = 500 ; par2 = 0.5 ;
Parameters (R input):
par1 = 1 ; par2 = 0 ; par3 = 0 ; par4 = 1 ; par5 = 1 ; par6 = 0 ; par7 = 0 ;
R code (references can be found in the software module):
par1 <- as.numeric(par1)
par2 <- as.numeric(par2)
par3 <- as.numeric(par3)
par4 <- as.numeric(par4)
par5 <- as.numeric(par5)
par6 <- as.numeric(par6)
par7 <- as.numeric(par7)
if (par1 == 0) {
x <- log(x)
} else {
x <- (x ^ par1 - 1) / par1
}
if (par5 == 0) {
y <- log(y)
} else {
y <- (y ^ par5 - 1) / par5
}
if (par2 > 0) x <- diff(x,lag=1,difference=par2)
if (par6 > 0) y <- diff(y,lag=1,difference=par6)
if (par3 > 0) x <- diff(x,lag=par4,difference=par3)
if (par7 > 0) y <- diff(y,lag=par4,difference=par7)
x
y
bitmap(file='test1.png')
(r <- ccf(x,y,main='Cross Correlation Function',ylab='CCF',xlab='Lag (k)'))
dev.off()
load(file='createtable')
a<-table.start()
a<-table.row.start(a)
a<-table.element(a,'Cross Correlation Function',2,TRUE)
a<-table.row.end(a)
a<-table.row.start(a)
a<-table.element(a,'Parameter',header=TRUE)
a<-table.element(a,'Value',header=TRUE)
a<-table.row.end(a)
a<-table.row.start(a)
a<-table.element(a,'Box-Cox transformation parameter (lambda) of X series',header=TRUE)
a<-table.element(a,par1)
a<-table.row.end(a)
a<-table.row.start(a)
a<-table.element(a,'Degree of non-seasonal differencing (d) of X series',header=TRUE)
a<-table.element(a,par2)
a<-table.row.end(a)
a<-table.row.start(a)
a<-table.element(a,'Degree of seasonal differencing (D) of X series',header=TRUE)
a<-table.element(a,par3)
a<-table.row.end(a)
a<-table.row.start(a)
a<-table.element(a,'Seasonal Period (s)',header=TRUE)
a<-table.element(a,par4)
a<-table.row.end(a)
a<-table.row.start(a)
a<-table.element(a,'Box-Cox transformation parameter (lambda) of Y series',header=TRUE)
a<-table.element(a,par5)
a<-table.row.end(a)
a<-table.row.start(a)
a<-table.element(a,'Degree of non-seasonal differencing (d) of Y series',header=TRUE)
a<-table.element(a,par6)
a<-table.row.end(a)
a<-table.row.start(a)
a<-table.element(a,'Degree of seasonal differencing (D) of Y series',header=TRUE)
a<-table.element(a,par7)
a<-table.row.end(a)
a<-table.row.start(a)
a<-table.element(a,'k',header=TRUE)
a<-table.element(a,'rho(Y[t],X[t+k])',header=TRUE)
a<-table.row.end(a)
mylength <- length(r$acf)
myhalf <- floor((mylength-1)/2)
for (i in 1:mylength) {
a<-table.row.start(a)
a<-table.element(a,i-myhalf-1,header=TRUE)
a<-table.element(a,r$acf[i])
a<-table.row.end(a)
}
a<-table.end(a)
table.save(a,file='mytable.tab')