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(40927.00 + ,40856.00 + ,40778.00 + ,40635.00 + ,42103.00 + ,42032.00 + ,40927.00 + ,40194.00 + ,40265.00 + ,40265.00 + ,40336.00 + ,40486.00 + ,40856.00 + ,40414.00 + ,40856.00 + ,40486.00 + ,41661.00 + ,42181.00 + ,39973.00 + ,39381.00 + ,39894.00 + ,39823.00 + ,39381.00 + ,39453.00 + ,40336.00 + ,40194.00 + ,40336.00 + ,40336.00 + ,41298.00 + ,41440.00 + ,38790.00 + ,38790.00 + ,39823.00 + ,39310.00 + ,38427.00 + ,38790.00 + ,39674.00 + ,39232.00 + ,39161.00 + ,38206.00 + ,39602.00 + ,39894.00 + ,37023.00 + ,36952.00 + ,38427.00 + ,37615.00 + ,36218.00 + ,36810.00 + ,37465.00 + ,37615.00 + ,37173.00 + ,36290.00 + ,38128.00 + ,38128.00 + ,34893.00 + ,34673.00 + ,35556.00 + ,33939.00 + ,32314.00 + ,32835.00 + ,33939.00 + ,33055.00 + ,32464.00 + ,31210.00 + ,32906.00 + ,32977.00 + ,29743.00 + ,29664.00 + ,30256.00 + ,28418.00 + ,26430.00 + ,27235.00 + ,28339.00 + ,27164.00 + ,27093.00 + ,25910.00 + ,27826.00 + ,28197.00 + ,24585.00 + ,23780.00 + ,24293.00 + ,22305.00 + ,20246.00 + ,20909.00 + ,22156.00 + ,20688.00 + ,20909.00 + ,20026.00 + ,21864.00 + ,22084.00 + ,17668.00 + ,17375.00 + ,18180.00 + ,16050.00 + ,14134.00 + ,14797.00 + ,16414.00 + ,14504.00 + ,14355.00 + ,12880.00 + ,14504.00 + ,15017.00 + ,10451.00 + ,10451.00 + ,11113.00 + ,9347.00 + ,7359.00 + ,8392.00 + ,10230.00 + ,8242.00 + ,9055.00 + ,7950.00 + ,9717.00 + ,10308.00 + ,5592.00 + ,5229.00 + ,5963.00 + ,4196.00 + ,2800.00 + ,3384.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/108w01470928614.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/2z8j21470928614.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/3d6sx1470928614.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.970504258 0.941070334 0.919919162 0.897951532 [6] 0.868975281 0.840660270 0.824634979 0.808242215 0.784392232 [11] 0.759197259 0.738479184 0.720988413 0.688780888 0.656217804 [16] 0.632140196 0.607470107 0.576268121 0.545226406 0.526410846 [21] 0.507028112 0.480531816 0.453875784 0.432654016 0.414354023 [26] 0.383047243 0.351635864 0.328220235 0.304648240 0.275148872 [31] 0.246910069 0.230451122 0.213329727 0.189150131 0.164917399 [36] 0.145128619 0.127298467 0.098766691 0.070348327 0.049511698 [41] 0.029273803 0.003793266 -0.019538789 -0.032627574 -0.046780290 [46] -0.067601508 -0.087303069 -0.102399465 -0.116014495 > (mypacf <- c(rpacf$acf)) [1] 0.9705042584 -0.0139050461 0.1273724686 -0.0255188848 -0.1143568922 [6] -0.0072625026 0.1726932510 -0.0110693686 -0.0850679865 -0.0462974798 [11] 0.0059074340 0.0491740849 -0.2131355293 -0.0130802810 0.0472989722 [16] -0.0370363131 -0.0577347124 -0.0029769795 0.0993652199 -0.0276020100 [21] -0.0432250651 -0.0205985497 0.0073980938 0.0224584086 -0.1368978984 [26] -0.0071545810 0.0099714285 -0.0287910165 -0.0349032906 0.0235000650 [31] 0.0611951081 -0.0300908491 -0.0325930781 -0.0239793442 -0.0193149031 [36] -0.0010547518 -0.0786591552 -0.0107013353 -0.0063145672 -0.0164178433 [41] -0.0232492393 0.0368767745 0.0225835301 -0.0334312226 -0.0250302002 [46] -0.0053982891 -0.0129193534 0.0002217489 > 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/4cakj1470928614.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/5co901470928614.tab") > > try(system("convert tmp/108w01470928614.ps tmp/108w01470928614.png",intern=TRUE)) character(0) > try(system("convert tmp/2z8j21470928614.ps tmp/2z8j21470928614.png",intern=TRUE)) character(0) > try(system("convert tmp/3d6sx1470928614.ps tmp/3d6sx1470928614.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.368 0.126 1.510