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(77.34,78.15,78.31,78.71,78.68,78.85,78.97,79.47,80.6,82.24,83.25,84.55,85.91,86.84,87.44,87.79,88.08,88.38,88.53,88.79,88.85,89.26,89.31,89.39,89.76,89.94,89.99,90.08,89.95,90.2,89.7,89.5,89.25,89.13,89.07,89.06,89.15,89.38,89.4,89.51,89.62,89.65,89.68,89.92,90.26,90.89,91.08,91.13,91.83,92.66,93.45,93.95,94.12,94.31,94.25,94.51,94.58,94.85,95.31,95.75,96.06,96.4,96.57,96.47,96.34,96.22,96.2,96.71,97.05,97.82,98.22,98.5,98.94,99.5,99.89,100,100.1,100.16,100.05,100.03,100,100.32,100.53,100.49,100.38,100.22,100.5,100.57,100.6,100.23,100.29,100.01,100.13,100.22,100.2,100.34,100.73,100.29,101.11,101.09,101.01,101.27,101.57,101.69,101,101.43,101.13,101.23) > 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/19hud1476876038.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/28uw91476876038.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/3wcgt1476876038.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.965277673 0.930641037 0.893373965 0.855980597 [6] 0.815509371 0.774246650 0.732545344 0.691579964 0.652963639 [11] 0.618543907 0.587597988 0.559200456 0.534839057 0.512956645 [16] 0.492434779 0.472704642 0.453774709 0.435116820 0.416966140 [21] 0.398871388 0.380828533 0.364006921 0.347570089 0.330749637 [26] 0.314301731 0.297834581 0.281243023 0.265040613 0.247814338 [31] 0.230853272 0.211673566 0.191337855 0.169649887 0.146984589 [36] 0.123960968 0.101035700 0.078055523 0.055282500 0.032202868 [41] 0.009898773 -0.012428622 -0.034693434 -0.057633404 -0.080693608 [46] -0.103468168 -0.124965342 -0.146245054 -0.167691478 > (mypacf <- c(rpacf$acf)) [1] 0.965277673 -0.016412163 -0.056496751 -0.021685921 -0.064031924 [6] -0.034185160 -0.026783239 -0.012415273 0.012834050 0.039344011 [11] 0.028918640 0.013545524 0.034721730 0.011778330 -0.005514016 [16] -0.010647015 -0.009262072 -0.012243189 -0.004586837 -0.007657128 [21] -0.006166546 0.013836811 0.001344399 -0.012954921 -0.002402603 [26] -0.010180998 -0.013771754 -0.005700239 -0.026946988 -0.008422337 [31] -0.042108515 -0.030699790 -0.031336172 -0.028131664 -0.017413977 [36] -0.013268213 -0.016282543 -0.015114112 -0.025718399 -0.013640944 [41] -0.027391429 -0.028296395 -0.039220948 -0.032310609 -0.024418102 [46] -0.008430863 -0.022055117 -0.028713513 > 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/4ofz81476876038.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/5d4gs1476876038.tab") > > try(system("convert tmp/19hud1476876038.ps tmp/19hud1476876038.png",intern=TRUE)) character(0) > try(system("convert tmp/28uw91476876038.ps tmp/28uw91476876038.png",intern=TRUE)) character(0) > try(system("convert tmp/3wcgt1476876038.ps tmp/3wcgt1476876038.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.159 0.076 1.247