R version 3.2.2 (2015-08-14) -- "Fire Safety" 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(71.59,71.65,71.47,71.82,71.76,71.88,73.31,73.22,72.74,72.95,73.71,74.45,76.54,77.41,76.87,76.51,75.66,75.09,75.16,75,75.05,74.78,75.43,75.61,77.12,83.09,86.09,87.64,88.29,89.3,89.99,90.43,91.03,91.4,92.19,92.45,92.42,90.2,88.23,84.91,82.92,81.8,81.7,83.22,82.7,82.83,83.66,84.28,84.37,86.49,87.62,88.59,89.74,89.73,89.14,88.37,88.65,89.16,89.56,89.37,89.67,93.04,94.4,95.5,101.66,102.86,102.48,102.02,101.83,101.3,101.29,100.53,100.45,101.88,101.95,102.18,100.95,100.52,100.39,99.61,99.43,99.34,100.73,102.14,102.22,101.14,100.91,101.62,100,99.92,100.07,98.48,98.3,98.86,98.96,99.52,99.06,100.47,100.24,86.43,85.14,85.41,86.13,86.19,86.29,87.55,87.87,88.37) > par8 = '' > par7 = '0.95' > par6 = 'White Noise' > par5 = '12' > par4 = '0' > par3 = '1' > par2 = '1' > par1 = '36' > par8 <- '' > par7 <- '0.95' > par6 <- 'White Noise' > par5 <- '12' > par4 <- '0' > par3 <- '1' > par2 <- '1' > par1 <- '36' > #'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/1kjpz1445595442.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/2stuq1445595442.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/37sio1445595442.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.286488933 0.058525443 0.097888658 -0.002871144 [6] -0.033260033 -0.097126678 -0.031969296 0.007590861 -0.032503024 [11] -0.063098307 -0.011583788 -0.077685144 -0.039623876 0.003021009 [16] -0.010545813 -0.066157731 -0.055366325 0.052919088 0.051535732 [21] 0.043252963 0.039353089 0.037756029 0.041723896 -0.051954086 [26] -0.059736850 -0.108187173 -0.096561891 -0.019305764 -0.016447266 [31] 0.022505504 0.042442149 0.056736081 0.046667947 -0.030590392 [36] -0.200496519 0.017286994 > (mypacf <- c(rpacf$acf)) [1] 0.2864889328 -0.0256562237 0.0959772247 -0.0618570963 -0.0174095380 [6] -0.0995012716 0.0326913359 0.0122287917 -0.0236226186 -0.0583066480 [11] 0.0173194170 -0.0930606711 0.0220526764 0.0062348860 -0.0029812824 [16] -0.0864307480 -0.0166848571 0.0681422934 0.0295814421 0.0302568851 [21] 0.0012880191 -0.0043032033 0.0242564148 -0.0687872801 -0.0220139576 [26] -0.1077877246 -0.0258159494 0.0211797164 -0.0004806341 0.0403764842 [31] 0.0213309926 0.0282587348 0.0067534866 -0.0543169948 -0.1999748169 [36] 0.1333844984 > 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/4543t1445595442.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/5nz7t1445595442.tab") > > try(system("convert tmp/1kjpz1445595442.ps tmp/1kjpz1445595442.png",intern=TRUE)) character(0) > try(system("convert tmp/2stuq1445595442.ps tmp/2stuq1445595442.png",intern=TRUE)) character(0) > try(system("convert tmp/37sio1445595442.ps tmp/37sio1445595442.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.069 0.259 1.319