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')
|