R version 2.15.3 (2013-03-01) -- "Security Blanket" Copyright (C) 2013 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(7.14,7.11,7.21,7.25,7.25,7.45,7.45,7.49,7.47,7.49,7.47,7.51,7.52,7.5,7.54,7.54,7.57,7.53,7.54,7.63,7.61,7.64,7.68,7.7,7.72,7.71,7.77,7.83,7.85,7.89,8.01,8.18,8.25,8.31,8.34,8.38,8.36,8.34,8.34,8.3,8.35,8.36,8.34,8.39,8.23,8.14,8.04,8.05,7.99,8.17,8.22,8.12,8.11,8.12,8.11,8.03,8.03,7.96,7.96,7.87,7.9,7.87,7.94,7.82,7.83,7.86,7.81,7.76,7.75,7.75,7.74,7.72) > par8 = '' > par7 = '0.95' > par6 = 'White Noise' > par5 = '12' > par4 = '0' > par3 = '1' > par2 = '1' > par1 = '48' > par8 <- '' > par7 <- '0.95' > par6 <- 'White Noise' > par5 <- '12' > par4 <- '0' > par3 <- '1' > par2 <- '1' > par1 <- '48' > #'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/fisher/rcomp/tmp/1synu1363711411.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/fisher/rcomp/tmp/2g6zr1363711411.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/fisher/rcomp/tmp/3lqso1363711411.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.119297338 0.221020621 0.129046810 0.135662846 [6] -0.045288429 0.039127529 0.149914636 0.070416794 0.161591617 [11] -0.010487075 0.075680249 0.076966697 -0.019742849 -0.137800948 [16] -0.009303903 0.005983410 0.017964264 -0.029797612 0.166192462 [21] -0.052886260 0.008077493 0.064063944 -0.032887170 0.001438703 [26] -0.028099904 0.030880981 0.037627867 0.006503971 -0.001469679 [31] -0.009151435 0.010871613 -0.156662585 -0.089141273 -0.057774605 [36] -0.027057150 -0.095996468 -0.145675788 0.060062552 -0.183283666 [41] -0.133567912 -0.123192477 -0.060125071 -0.057021832 0.042633026 [46] -0.004575257 -0.040998545 0.039874419 -0.050861358 > (mypacf <- c(rpacf$acf)) [1] 0.1192973383 0.2097742427 0.0882706248 0.0757515790 -0.1139791438 [6] -0.0023576223 0.1702542977 0.0533067824 0.1175290549 -0.1105298029 [11] -0.0158334376 0.0971396717 -0.0512081048 -0.1719292585 -0.0309115094 [16] 0.0367899541 0.1088019504 -0.0497458747 0.1134682458 -0.1063303547 [21] -0.0036573290 0.1563189699 -0.0550369086 -0.0295583828 -0.0442994724 [26] 0.0143857431 0.1351557388 -0.1132839622 -0.0379115675 -0.0321261971 [31] -0.0001650582 -0.0694756224 -0.0913374931 -0.0487108142 0.0552048309 [36] -0.0288750244 -0.1266037513 0.0439765974 -0.1264060634 -0.0431494414 [41] -0.0059138133 -0.0093347318 0.0597741544 0.1378454869 0.0065362052 [46] -0.1237339270 0.0197785119 0.0535905500 > lengthx <- length(x) > sqrtn <- sqrt(lengthx) > > #Note: the /var/fisher/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/fisher/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/fisher/rcomp/tmp/4c94m1363711411.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/fisher/rcomp/tmp/5k7o51363711411.tab") > > try(system("convert tmp/1synu1363711411.ps tmp/1synu1363711411.png",intern=TRUE)) character(0) > try(system("convert tmp/2g6zr1363711411.ps tmp/2g6zr1363711411.png",intern=TRUE)) character(0) > try(system("convert tmp/3lqso1363711411.ps tmp/3lqso1363711411.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.802 0.278 2.060