R version 2.8.0 (2008-10-20) Copyright (C) 2008 The R Foundation for Statistical Computing ISBN 3-900051-07-0 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > y <- c(1530.9,2220.6,2161.5,1863.6,1955.1,1907.4,1889.4,2246.3,2213,1965,2285.6,1983.8,1872.4,2371.4,2287,2198.2,2330.4,2014.4,2066.1,2355.8,2232.5,2091.7,2376.5,1931.9,2025.7,2404.9,2316.1,2368.1,2282.5,2158.6,2174.8,2594.1,2281.4,2547.9,2606.3,2190.8,2262.3,2423.8,2520.4,2482.9,2215.9,2441.9,2333.8,2670.2,2431,2559.3,2661.4,2404.6,2378.3,2489.2,2959,2713.5,2341.3,2833.2,2849.7,2871.7,3058.3,2855.1,3083.6,2828.3) > x <- c(1846.5,2796.3,2895.6,2472.2,2584.4,2630.4,2663.1,3176.2,2856.7,2551.4,3088.7,2628.3,2226.2,3023.6,3077.9,3084.1,2990.3,2949.6,3014.7,3517.7,3121.2,3067.4,3174.6,2676.3,2424,3195.1,3146.6,3506.7,3528.5,3365.1,3153,3843.3,3123.2,3361.1,3481.9,2970.5,2537,3257.6,3301.3,3391.6,2933.6,3283.2,3139.7,3486.4,3202.2,3294.4,3550.3,3279.3,2678.6,3451.4,3977.1,3814.8,3310.5,3971.8,4051.9,4057.6,4391.4,3628.9,4092.2,3822.5) > par7 = '0' > par6 = '0' > par5 = '1' > par4 = '12' > par3 = '0' > par2 = '0' > par1 = '1' > #'GNU S' R Code compiled by R2WASP v. 1.0.44 () > #Author: Prof. Dr. P. Wessa > #To cite this work: Wessa P., (2008), Cross Correlation Function (v1.0.6) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_cross.wasp/ > #Source of accompanying publication: Office for Research, Development, and Education > #Technical description: > 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 [1] 1845.5 2795.3 2894.6 2471.2 2583.4 2629.4 2662.1 3175.2 2855.7 2550.4 [11] 3087.7 2627.3 2225.2 3022.6 3076.9 3083.1 2989.3 2948.6 3013.7 3516.7 [21] 3120.2 3066.4 3173.6 2675.3 2423.0 3194.1 3145.6 3505.7 3527.5 3364.1 [31] 3152.0 3842.3 3122.2 3360.1 3480.9 2969.5 2536.0 3256.6 3300.3 3390.6 [41] 2932.6 3282.2 3138.7 3485.4 3201.2 3293.4 3549.3 3278.3 2677.6 3450.4 [51] 3976.1 3813.8 3309.5 3970.8 4050.9 4056.6 4390.4 3627.9 4091.2 3821.5 > y [1] 1529.9 2219.6 2160.5 1862.6 1954.1 1906.4 1888.4 2245.3 2212.0 1964.0 [11] 2284.6 1982.8 1871.4 2370.4 2286.0 2197.2 2329.4 2013.4 2065.1 2354.8 [21] 2231.5 2090.7 2375.5 1930.9 2024.7 2403.9 2315.1 2367.1 2281.5 2157.6 [31] 2173.8 2593.1 2280.4 2546.9 2605.3 2189.8 2261.3 2422.8 2519.4 2481.9 [41] 2214.9 2440.9 2332.8 2669.2 2430.0 2558.3 2660.4 2403.6 2377.3 2488.2 [51] 2958.0 2712.5 2340.3 2832.2 2848.7 2870.7 3057.3 2854.1 3082.6 2827.3 > postscript(file="/var/www/html/rcomp/tmp/1jfkr1228308937.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > (r <- ccf(x,y,main='Cross Correlation Function',ylab='CCF',xlab='Lag (k)')) Autocorrelations of series 'X', by lag -14 -13 -12 -11 -10 -9 -8 -7 -6 -5 -4 -3 -2 0.091 0.114 0.339 0.191 0.068 0.236 0.254 0.257 0.427 0.437 0.474 0.578 0.475 -1 0 1 2 3 4 5 6 7 8 9 10 11 0.540 0.919 0.585 0.423 0.514 0.388 0.384 0.420 0.258 0.291 0.275 0.110 0.172 12 13 14 0.340 0.166 0.041 > dev.off() null device 1 > > #Note: the /var/www/html/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/html/rcomp/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="/var/www/html/rcomp/tmp/2o5ys1228308938.tab") > > system("convert tmp/1jfkr1228308937.ps tmp/1jfkr1228308937.png") > > > proc.time() user system elapsed 0.387 0.164 0.453