R version 3.0.2 (2013-09-25) -- "Frisbee Sailing" Copyright (C) 2013 The R Foundation for Statistical Computing Platform: x86_64-pc-linux-gnu (64-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(93.6,103.5,127,108,117.5,111.5,137.6,122.2,103.2,86.9,124.4,104.8,113.6,101.6,148.5,121.2,114.1,108.3,117.2,128.7,118,116.5,131.7,139.9,129.4,107.4,96.1,126.5,110,116.4,109.8,148,124.7,120.5,111.4,117,141.7,123.4,120,132.1,146.7,133,122.5,99.6,122.7,115,139,117.8,125.5,127.5,124.7,134.5,121.3,126.7,127.5,117.7,123,132.1,124.3,113.1,89.2,121.7,108,105.3,85.3,105.3,98.6,114.6,72.2,92.1,97.2,87.1,78.6,78.1,93,83.2,81,65.9,88.6,78.5,85.7,76.3,96.8,86.3,83.8,76.8,85.6,119.2,93.9,91.4,95.7,112.3,99.8,95.2,82.8,111.3,96.5,108.2,97,124.4,109.9,100,99.3,117.6,131.5,116.1,114.2,116.8,116.5,115.8,105.4,89.2,115.8,103.5,111.4,106.4,128.4,115.4,112.7,107.7,111,129.8,116.2,130.5,142.9,159.9,144.4,84.1,75,100.7,86.6,106.8,97.4,113,105.7,113.2,76.9,87.3,103.7,89.3,92.1,92.9,112.2,99,88.7,74.6,101.5,88.3,119.7,120.7,153.5,131.3,102,76,89.3,105.3,90.2,97.7,94.4,103.5,98.5,89.2) > par8 = '' > par7 = '0.95' > par6 = 'White Noise' > par5 = '12' > par4 = '0' > par3 = '1' > par2 = '1' > par1 = '60' > par8 <- '' > par7 <- '0.95' > par6 <- 'White Noise' > par5 <- '12' > par4 <- '0' > par3 <- '1' > par2 <- '1' > par1 <- '60' > #'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/18q1a1413457690.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/25kz21413457690.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/3kwek1413457690.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.339644011 0.021897752 -0.376182476 0.348117801 [6] -0.049494612 -0.137765143 -0.199148298 0.260490901 0.227497009 [11] -0.144294140 -0.152613808 -0.018945176 0.306466280 -0.323334555 [16] 0.022894970 -0.191275270 0.576477452 -0.233223597 0.004467876 [21] -0.217637484 0.245996645 -0.040197611 -0.133980758 -0.178765359 [26] 0.246878720 0.211159340 -0.150022308 -0.116600788 -0.037935132 [31] 0.272712249 -0.232961390 0.018765833 -0.222779524 0.475584084 [36] -0.213326499 0.093757796 -0.270825429 0.260845964 -0.031128814 [41] -0.064015316 -0.171966443 0.133018624 0.142670545 -0.108478559 [46] -0.037923235 -0.073293166 0.267131109 -0.179331560 -0.007754661 [51] -0.208525369 0.426684076 -0.188300718 0.066280658 -0.265739448 [56] 0.277713690 -0.038135899 -0.051994368 -0.169076062 0.187588172 [61] 0.109674525 > (mypacf <- c(rpacf$acf)) [1] -0.339644011 -0.105647605 -0.461655917 0.054936929 0.026881066 [6] -0.327275494 -0.294672194 0.014649291 0.210550414 -0.026347280 [11] -0.003127649 -0.027579404 0.165885772 -0.262712282 -0.016185794 [16] -0.125854142 0.231240680 0.020730028 0.004647558 0.100808215 [21] -0.088995660 -0.008656564 -0.011014687 -0.152704658 -0.036157285 [26] 0.130656841 -0.016751938 -0.044138847 -0.025206723 0.006724912 [31] 0.010487121 0.071003965 -0.124443034 0.067857305 -0.118975265 [36] 0.081516460 -0.025994747 -0.073984845 0.085706058 0.036921621 [41] -0.002057007 -0.110324828 -0.068336646 -0.102106664 -0.011103147 [46] -0.059526713 0.014678224 0.032295190 -0.119052901 0.001106413 [51] 0.110994485 -0.053687913 -0.002436820 -0.029626867 0.027415668 [56] -0.108640962 -0.082060992 0.006685706 0.137039731 0.012439986 > 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/46tuv1413457691.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/5wgcp1413457691.tab") > > try(system("convert tmp/18q1a1413457690.ps tmp/18q1a1413457690.png",intern=TRUE)) character(0) > try(system("convert tmp/25kz21413457690.ps tmp/25kz21413457690.png",intern=TRUE)) character(0) > try(system("convert tmp/3kwek1413457690.ps tmp/3kwek1413457690.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.189 0.212 1.408