R version 3.3.1 (2016-06-21) -- "Bug in Your Hair" Copyright (C) 2016 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(29054.50 + ,28543.50 + ,28032.00 + ,27009.50 + ,37356.00 + ,36844.50 + ,29054.50 + ,23881.50 + ,24392.50 + ,24392.50 + ,24904.00 + ,25982.00 + ,22859.00 + ,19731.00 + ,17169.50 + ,17169.50 + ,27009.50 + ,28032.00 + ,20242.00 + ,11429.50 + ,16091.50 + ,16091.50 + ,19731.00 + ,21831.50 + ,21320.00 + ,16091.50 + ,18708.50 + ,17681.00 + ,26493.50 + ,24392.50 + ,16091.50 + ,9891.00 + ,15580.00 + ,17169.50 + ,18708.50 + ,20753.50 + ,16602.50 + ,13019.00 + ,14558.00 + ,15069.00 + ,28543.50 + ,28543.50 + ,20753.50 + ,19731.00 + ,22859.00 + ,21320.00 + ,25471.00 + ,30644.00 + ,31671.50 + ,24392.50 + ,22342.50 + ,20242.00 + ,34283.50 + ,35311.00 + ,32694.00 + ,35311.00 + ,34794.50 + ,30644.00 + ,35311.00 + ,40484.00 + ,42584.50 + ,36333.50 + ,32182.50 + ,35311.00 + ,48785.00 + ,52936.00 + ,51913.50 + ,53958.00 + ,53447.00 + ,48274.00 + ,57086.50 + ,59187.00 + ,62259.50 + ,52936.00 + ,49296.50 + ,53447.00 + ,63337.50 + ,72150.00 + ,70049.50 + ,70049.50 + ,71077.00 + ,67488.00 + ,76817.00 + ,76817.00 + ,75227.50 + ,66410.00 + ,67999.50 + ,69027.00 + ,75789.50 + ,84602.00 + ,78350.50 + ,81479.00 + ,78862.00 + ,77328.00 + ,89269.00 + ,86652.00 + ,83012.50 + ,77839.50 + ,83012.50 + ,85629.50 + ,88752.50 + ,92903.00 + ,88752.50 + ,91314.00 + ,88190.50 + ,87679.50 + ,100642.50 + ,101720.50 + ,97570.00 + ,90291.50 + ,96492.00 + ,99104.00 + ,102232.00 + ,106894.00 + ,102232.00 + ,105871.50 + ,104282.00 + ,98592.50 + ,110533.00 + ,110533.00) > par8 = '' > par7 = '0.95' > par6 = 'White Noise' > par5 = '12' > par4 = '0' > par3 = '0' > par2 = '1' > par1 = '48' > par8 <- '' > par7 <- '0.95' > par6 <- 'White Noise' > par5 <- '12' > par4 <- '0' > par3 <- '0' > par2 <- '1' > par1 <- '48' > #'GNU S' R Code compiled by R2WASP v. 1.2.327 (Mon, 30 Nov 2015 06:58:35 +0000) > #Author: root > #To cite this work: Wessa P., (2015), (Partial) Autocorrelation Function (v1.0.12) 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) > x <- na.omit(x) > 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/18kca1470782764.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/2l60i1470782764.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/3cjit1470782764.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.00000000 0.96641555 0.93166392 0.91182675 0.89732024 0.88764226 [7] 0.87380023 0.84651894 0.81509377 0.78761179 0.77088201 0.76564574 [13] 0.75420901 0.71579950 0.67671501 0.65121992 0.63216794 0.61630145 [19] 0.59781344 0.56694951 0.53161164 0.50093051 0.48079600 0.46930910 [25] 0.45255313 0.41531832 0.37630575 0.34946645 0.32537163 0.30521799 [31] 0.28492422 0.25077381 0.21513512 0.18530083 0.16562225 0.15200004 [37] 0.13116682 0.09561199 0.05958763 0.03189732 0.00385417 -0.01664875 [43] -0.03590971 -0.06642910 -0.09818357 -0.12379634 -0.13844988 -0.14994881 [49] -0.16709154 > (mypacf <- c(rpacf$acf)) [1] 0.966415549 -0.034752611 0.208415728 0.063765794 0.117393753 [6] -0.037904805 -0.169764474 -0.089850971 -0.040233801 0.096082926 [11] 0.158376825 -0.025330977 -0.334451935 -0.030767889 0.064340837 [16] 0.019982850 -0.002382973 0.007744040 -0.062071981 -0.037212569 [21] -0.031931133 0.010410740 0.031309183 0.016602099 -0.133460389 [26] -0.049393775 0.018731067 -0.074219896 0.005434878 0.017239428 [31] -0.079187263 0.027799082 -0.018734620 0.026983988 -0.021643203 [36] -0.042848575 -0.054524501 -0.031963742 -0.030207512 -0.122958017 [41] 0.051234809 0.020082887 -0.002534097 0.005901773 -0.015458956 [46] 0.058251714 -0.040548649 -0.009777294 > 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/46m6h1470782764.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/5a1301470782764.tab") > > try(system("convert tmp/18kca1470782764.ps tmp/18kca1470782764.png",intern=TRUE)) character(0) > try(system("convert tmp/2l60i1470782764.ps tmp/2l60i1470782764.png",intern=TRUE)) character(0) > try(system("convert tmp/3cjit1470782764.ps tmp/3cjit1470782764.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.312 0.139 1.468