R version 2.15.2 (2012-10-26) -- "Trick or Treat" Copyright (C) 2012 The R Foundation for Statistical Computing ISBN 3-900051-07-0 Platform: i686-pc-linux-gnu (32-bit) 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. > x <- c(8.64 + ,8.89 + ,8.87 + ,8.81 + ,8.87 + ,9.06 + ,9.12 + ,8.66 + ,8.17 + ,8.04 + ,7.71 + ,7.55 + ,7.52 + ,7.38 + ,7.52 + ,7.31 + ,6.92 + ,7.09 + ,7.05 + ,7.37 + ,7.05 + ,6.79 + ,6.35 + ,6.44 + ,6.89 + ,7.16 + ,7.46 + ,7.91 + ,7.86 + ,8.02 + ,8.38 + ,8.50 + ,8.40 + ,8.24 + ,8.33 + ,8.28 + ,8.15 + ,8.06 + ,7.79 + ,7.28 + ,7.52 + ,7.23 + ,7.13 + ,7.21 + ,6.99 + ,6.77 + ,6.69 + ,6.39 + ,6.85 + ,6.74 + ,6.56 + ,6.62 + ,6.71 + ,6.67 + ,6.54 + ,6.14 + ,6.13 + ,5.86 + ,5.88 + ,5.75 + ,5.53 + ,5.86 + ,5.90 + ,5.95 + ,5.69 + ,5.53 + ,5.71 + ,5.60 + ,5.73 + ,5.60 + ,5.41 + ,5.13 + ,5.00 + ,5.04 + ,5.10 + ,4.96 + ,4.90 + ,4.80 + ,4.48 + ,4.29 + ,4.27 + ,4.18 + ,4.02 + ,3.82 + ,4.13 + ,4.16 + ,3.98 + ,4.26 + ,4.70 + ,4.96 + ,5.13 + ,5.35 + ,5.41 + ,5.42 + ,5.51 + ,5.75 + ,5.67 + ,5.46 + ,5.56 + ,5.56 + ,5.54 + ,5.53 + ,5.65 + ,5.58 + ,5.57 + ,5.36 + ,5.23 + ,5.11 + ,5.07 + ,5.04 + ,5.34 + ,5.43 + ,5.31 + ,5.12 + ,4.97 + ,5.00 + ,4.64 + ,4.80 + ,5.10 + ,5.11 + ,5.12 + ,5.36 + ,5.26 + ,5.27 + ,5.10 + ,4.94 + ,4.68 + ,4.41 + ,4.60 + ,4.53 + ,4.18 + ,4.00 + ,3.87 + ,4.09 + ,4.13 + ,3.74 + ,3.81 + ,4.11 + ,4.14 + ,3.99 + ,4.28 + ,4.37 + ,4.24 + ,4.19 + ,4.01 + ,3.95 + ,4.30 + ,4.37 + ,4.40 + ,4.29 + ,4.12 + ,4.07 + ,3.93 + ,3.79 + ,3.67 + ,3.53 + ,3.69 + ,3.69 + ,3.48 + ,3.31 + ,3.16 + ,3.25 + ,3.14 + ,3.19 + ,3.43 + ,3.45 + ,3.31 + ,3.51 + ,3.53 + ,3.83 + ,4.02 + ,3.99 + ,4.11 + ,3.96 + ,3.83 + ,3.71 + ,3.81 + ,3.73 + ,3.99 + ,4.17 + ,4.00 + ,4.10 + ,4.24 + ,4.45 + ,4.62 + ,4.49 + ,4.45 + ,4.49 + ,4.36 + ,4.32 + ,4.45 + ,4.13 + ,4.14 + ,4.30 + ,4.42 + ,4.67 + ,4.96 + ,4.73 + ,4.52 + ,4.36 + ,4.15 + ,3.92 + ,3.88 + ,4.20 + ,3.95 + ,3.78 + ,3.69 + ,3.77 + ,3.66 + ,3.53 + ,3.50 + ,3.14 + ,3.42 + ,3.30 + ,2.81 + ,3.15 + ,3.37 + ,4.05 + ,4.00 + ,4.20 + ,4.21 + ,4.24 + ,4.24 + ,4.17 + ,4.12 + ,4.35 + ,3.98 + ,3.62 + ,4.39 + ,5.01 + ,4.07 + ,3.70 + ,3.59 + ,3.44 + ,3.33 + ,2.98 + ,3.14 + ,2.55 + ,2.49 + ,2.53 + ,2.43) > par8 = '' > par7 = '0.95' > par6 = 'White Noise' > par5 = '12' > par4 = '1' > par3 = '1' > par2 = '1' > par1 = 'Default' > par8 <- '' > par7 <- '0.95' > par6 <- 'White Noise' > par5 <- '12' > par4 <- '1' > par3 <- '1' > par2 <- '1' > par1 <- 'Default' > #'GNU S' R Code compiled by R2WASP v. 1.2.291 () > #Author: root > #To cite this work: Wessa P., (2012), (Partial) Autocorrelation Function (v1.0.11) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_autocorrelation.wasp/ > #Source of accompanying publication: > # > if (par1 == 'Default') { + par1 = 10*log10(length(x)) + } else { + par1 <- as.numeric(par1) + } > par2 <- as.numeric(par2) > par3 <- as.numeric(par3) > par4 <- as.numeric(par4) > par5 <- as.numeric(par5) > if (par6 == 'White Noise') par6 <- 'white' else par6 <- 'ma' > par7 <- as.numeric(par7) > if (par8 != '') par8 <- as.numeric(par8) > ox <- x > if (par8 == '') { + if (par2 == 0) { + x <- log(x) + } else { + x <- (x ^ par2 - 1) / par2 + } + } else { + x <- log(x,base=par8) + } > if (par3 > 0) x <- diff(x,lag=1,difference=par3) > if (par4 > 0) x <- diff(x,lag=par5,difference=par4) > postscript(file="/var/wessaorg/rcomp/tmp/1nuqk1354190474.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > op <- par(mfrow=c(2,1)) > plot(ox,type='l',main='Original Time Series',xlab='time',ylab='value') > if (par8=='') { + mytitle <- paste('Working Time Series (lambda=',par2,', d=',par3,', D=',par4,')',sep='') + mysub <- paste('(lambda=',par2,', d=',par3,', D=',par4,', CI=', par7, ', CI type=',par6,')',sep='') + } else { + mytitle <- paste('Working Time Series (base=',par8,', d=',par3,', D=',par4,')',sep='') + mysub <- paste('(base=',par8,', d=',par3,', D=',par4,', CI=', par7, ', CI type=',par6,')',sep='') + } > plot(x,type='l', main=mytitle,xlab='time',ylab='value') > par(op) > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/2vgqa1354190474.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > racf <- acf(x, par1, main='Autocorrelation', xlab='time lag', ylab='ACF', ci.type=par6, ci=par7, sub=mysub) > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/3hver1354190474.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > rpacf <- pacf(x,par1,main='Partial Autocorrelation',xlab='lags',ylab='PACF',sub=mysub) > dev.off() null device 1 > (myacf <- c(racf$acf)) [1] 1.000000000 0.116993897 -0.002933298 0.217514662 0.024233138 [6] 0.100032308 0.030315949 0.006739426 0.058172495 -0.121078160 [11] 0.012670907 -0.146099225 -0.462977768 -0.032201328 -0.139818053 [16] -0.137608796 -0.006915178 -0.133083782 -0.037155444 -0.024313802 [21] -0.095683284 -0.019676820 0.038900291 0.133758639 > (mypacf <- c(rpacf$acf)) [1] 0.116993897 -0.016851526 0.222949228 -0.030598832 0.118423417 [6] -0.049537552 0.022736548 0.006565991 -0.133676703 0.039205920 [11] -0.203072119 -0.407315961 0.022286808 -0.141938147 0.071300899 [16] 0.022437812 0.011717092 0.014868393 0.037029144 -0.044660339 [21] -0.091640804 0.090500915 0.006664302 > lengthx <- length(x) > sqrtn <- sqrt(lengthx) > > #Note: the /var/wessaorg/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/wessaorg/rcomp/createtable") > > a<-table.start() > a<-table.row.start(a) > a<-table.element(a,'Autocorrelation Function',4,TRUE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'Time lag k',header=TRUE) > a<-table.element(a,hyperlink('http://www.xycoon.com/basics.htm','ACF(k)','click here for more information about the Autocorrelation Function'),header=TRUE) > a<-table.element(a,'T-STAT',header=TRUE) > a<-table.element(a,'P-value',header=TRUE) > a<-table.row.end(a) > for (i in 2:(par1+1)) { + a<-table.row.start(a) + a<-table.element(a,i-1,header=TRUE) + a<-table.element(a,round(myacf[i],6)) + mytstat <- myacf[i]*sqrtn + a<-table.element(a,round(mytstat,4)) + a<-table.element(a,round(1-pt(abs(mytstat),lengthx),6)) + a<-table.row.end(a) + } > a<-table.end(a) > table.save(a,file="/var/wessaorg/rcomp/tmp/4yla11354190475.tab") > a<-table.start() > a<-table.row.start(a) > a<-table.element(a,'Partial Autocorrelation Function',4,TRUE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'Time lag k',header=TRUE) > a<-table.element(a,hyperlink('http://www.xycoon.com/basics.htm','PACF(k)','click here for more information about the Partial Autocorrelation Function'),header=TRUE) > a<-table.element(a,'T-STAT',header=TRUE) > a<-table.element(a,'P-value',header=TRUE) > a<-table.row.end(a) > for (i in 1:par1) { + a<-table.row.start(a) + a<-table.element(a,i,header=TRUE) + a<-table.element(a,round(mypacf[i],6)) + mytstat <- mypacf[i]*sqrtn + a<-table.element(a,round(mytstat,4)) + a<-table.element(a,round(1-pt(abs(mytstat),lengthx),6)) + a<-table.row.end(a) + } > a<-table.end(a) > table.save(a,file="/var/wessaorg/rcomp/tmp/534d71354190475.tab") > > try(system("convert tmp/1nuqk1354190474.ps tmp/1nuqk1354190474.png",intern=TRUE)) character(0) > try(system("convert tmp/2vgqa1354190474.ps tmp/2vgqa1354190474.png",intern=TRUE)) character(0) > try(system("convert tmp/3hver1354190474.ps tmp/3hver1354190474.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.886 0.371 2.237