R version 3.2.3 (2015-12-10) -- "Wooden Christmas-Tree" Copyright (C) 2015 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(81.83,82.58,82.6,82.71,82.98,83.11,83.22,83.32,83.39,83.45,83.52,83.59,83.97,84.48,84.8,84.93,85.14,85.22,85.54,85.5,85.61,85.75,85.89,85.94,86.08,86.3,86.97,87.3,87.62,87.59,87.78,87.87,88.17,88.67,88.84,88.9,88.98,89.27,89.69,89.72,89.79,89.82,89.98,90.09,90.31,90.3,90.48,90.52,90.53,91.38,91.87,91.9,92.08,92.14,92.09,92.32,92.67,92.78,92.96,93.12,93.32,94.12,94.34,94.52,94.81,94.95,94.99,95.03,95.16,95.41,95.46,95.62,95.66,95.96,96.18,96.24,97.03,97.11,97.28,97.74,97.83,98.14,98.18,98.21,98.43,98.67,99.51,99.64,99.83,99.84,99.94,100.17,100.56,101.05,101.17,101.21,101.01,101.92,102.33,102.41,102.5,102.69,102.98,103.11,103.36,103.8,104.07,104.15,104.19,104.64,104.98,105.25,105.43,105.59,105.84,105.87,106,106.14,106.24,106.31) > 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/1ol8w1457428175.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/245zp1457428175.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/36owe1457428175.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.0000000000 0.9752239510 0.9512249794 0.9267951875 0.9021701734 [6] 0.8776377894 0.8525698594 0.8274438026 0.8020379357 0.7764076568 [11] 0.7507958348 0.7253578005 0.7001316548 0.6746789937 0.6496128943 [16] 0.6250561612 0.6009447497 0.5770610345 0.5528609309 0.5291757689 [21] 0.5051277864 0.4808504940 0.4563386333 0.4323304946 0.4095102808 [26] 0.3857920274 0.3618553878 0.3388188669 0.3168021484 0.2956174344 [31] 0.2742134337 0.2527581109 0.2309055787 0.2094266791 0.1886212489 [36] 0.1693160889 0.1500548939 0.1306656528 0.1112059993 0.0921404012 [41] 0.0733467308 0.0544600892 0.0360609945 0.0178027404 -0.0006665171 [46] -0.0176064939 -0.0349047079 -0.0518376290 -0.0685203204 > (mypacf <- c(rpacf$acf)) [1] 0.9752239510 0.0033353216 -0.0208600920 -0.0169361601 -0.0111065302 [6] -0.0238916691 -0.0150753077 -0.0193559659 -0.0187653826 -0.0141407582 [11] -0.0108393230 -0.0102545765 -0.0193000880 -0.0074036487 -0.0044127151 [16] -0.0057492664 -0.0104346127 -0.0216499196 -0.0055659254 -0.0227527902 [21] -0.0212813155 -0.0216531658 -0.0065799305 0.0077128336 -0.0337749791 [26] -0.0225372185 0.0010931948 0.0046152272 0.0003888982 -0.0204770658 [31] -0.0188563363 -0.0257919085 -0.0105350581 -0.0041118051 0.0128939046 [36] -0.0164317922 -0.0195960704 -0.0188707444 -0.0097618848 -0.0129491304 [41] -0.0201419910 -0.0076209640 -0.0154358232 -0.0231558735 0.0122951497 [46] -0.0240740287 -0.0124436786 -0.0149524853 > 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/43ly81457428175.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/5cvx41457428175.tab") > > try(system("convert tmp/1ol8w1457428175.ps tmp/1ol8w1457428175.png",intern=TRUE)) character(0) > try(system("convert tmp/245zp1457428175.ps tmp/245zp1457428175.png",intern=TRUE)) character(0) > try(system("convert tmp/36owe1457428175.ps tmp/36owe1457428175.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.125 0.212 1.347