R version 2.9.0 (2009-04-17) Copyright (C) 2009 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(113,95.4,86.2,111.7,97.5,99.7,111.5,91.8,86.3,88.7,95.1,105.1,104.5,89.1,82.6,102.7,91.8,94.1,103.1,93.2,91,94.3,99.4,115.7,116.8,99.8,96,115.9,109.1,117.3,109.8,112.8,110.7,100,113.3,122.4,112.5,104.2,92.5,117.2,109.3,106.1,118.8,105.3,106,102,112.9,116.5,114.8,100.5,85.4,114.6,109.9,100.7,115.5,100.7,99,102.3) > x <- c(76.14,75.93,74.49,74.73,75.56,84.19,79.30,74.70,77.09,74.88,77.56,74.08,68.38,71.63,64.65,69.13,58.10,50.28,46.95,41.76,43.91,41.53,54.04,72.69,99.29,114.57,132.55,131.52,122.77,109.05,101.84,93.75,90.82,89.43,91.27,82.15,76.91,70.13,73.67,68.19,65.10,65.10,60.60,57.58,53.40,61.00,58.13,57.95,61.97,71.81,72.51,68.29,68.61,68.00,60.93,59.71,62.36,56.47) > par8 = '1' > par7 = '1' > par6 = '1' > 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), Bivariate Granger Causality (v1.0.0) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_grangercausality.wasp/ > #Source of accompanying publication: Office for Research, Development, and Education > #Technical description: > library(lmtest) Loading required package: zoo Attaching package: 'zoo' The following object(s) are masked from package:base : as.Date.numeric > 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) > par8 <- as.numeric(par8) > ox <- x > oy <- y > 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] 75.14 74.93 73.49 73.73 74.56 83.19 78.30 73.70 76.09 73.88 [11] 76.56 73.08 67.38 70.63 63.65 68.13 57.10 49.28 45.95 40.76 [21] 42.91 40.53 53.04 71.69 98.29 113.57 131.55 130.52 121.77 108.05 [31] 100.84 92.75 89.82 88.43 90.27 81.15 75.91 69.13 72.67 67.19 [41] 64.10 64.10 59.60 56.58 52.40 60.00 57.13 56.95 60.97 70.81 [51] 71.51 67.29 67.61 67.00 59.93 58.71 61.36 55.47 > y [1] 2.2 2.7 -5.4 3.3 0.1 -2.8 9.8 3.3 0.9 -1.3 6.3 1.7 [13] -1.6 2.7 -0.2 4.1 5.9 -16.5 12.9 0.1 -14.0 8.2 -7.2 -11.0 [25] 8.7 -7.9 4.8 -1.1 -11.4 20.2 -16.5 2.8 6.7 -2.4 -5.5 8.2 [37] -6.0 -3.4 4.5 3.2 -6.0 2.1 -1.3 -2.4 7.3 > (gyx <- grangertest(y ~ x, order=par8)) Error in model.frame.default(mt, data = data) : variable lengths differ (found for 'x') Calls: grangertest ... grangertest.formula -> model.frame -> model.frame.default Execution halted