R version 2.15.2 (2012-10-26) -- "Trick or Treat" Copyright (C) 2012 The R Foundation for Statistical Computing ISBN 3-900051-07-0 Platform: i686-pc-linux-gnu (32-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(97.51,96.65,95.91,95.86,95.7,95.57,95.57,95.57,94.87,95.07,95.13,95.48,95.38,95.38,95.48,95.77,94.78,92.51,92.17,91.75,90.43,90.55,90.37,90.4,90.41,90.41,90.41,89.77,89.77,89.77,89.37,89.81,89.07,89.84,89.73,90.02,88.39,90.13,90.13,90.37,89.73,89.73,89.73,89.73,89.6,89.63,86.42,86.8,86.51,86.41,86.39,86.62,85.85,87.36,87.28,87.35,87.35,87.35,87.38,88.17,88.37,87.44,87.44,87.47,87.47,87.48,87.11,87.11,86.26,86.28,86.28,86.28) > par8 = '' > par7 = '0.95' > par6 = 'White Noise' > par5 = '12' > par4 = '0' > par3 = '1' > par2 = '1' > par1 = '48' > par8 <- '' > par7 <- '0.95' > par6 <- 'White Noise' > par5 <- '12' > par4 <- '0' > par3 <- '1' > par2 <- '1' > par1 <- '48' > #'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/1sfvv1353096223.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/2gfsy1353096223.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/3df7e1353096223.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.165095356 0.098576410 -0.049155454 0.119311026 [6] -0.142028277 0.167507819 -0.249633902 -0.038959946 -0.184485106 [11] 0.164815229 -0.118507109 0.070131274 -0.238344571 0.061821893 [16] -0.032069124 0.250789328 -0.190749259 0.023302255 0.086159912 [21] 0.022391468 -0.138195259 0.138776065 -0.061912055 -0.013180434 [26] -0.020356047 0.133501779 -0.011984637 0.079372216 0.143043593 [31] 0.069386012 -0.103657408 0.052476958 -0.108327491 0.016249547 [36] -0.062711746 -0.116414454 -0.120789439 0.066259081 -0.047599652 [41] -0.041024740 0.010691632 -0.044462134 -0.063414726 0.134126453 [46] 0.043162893 -0.008185267 -0.012616163 0.028403233 > (mypacf <- c(rpacf$acf)) [1] -0.1650953555 0.0733183335 -0.0227073094 0.1046918539 -0.1079261950 [6] 0.1206271497 -0.2024434302 -0.1383651592 -0.1746103128 0.1004603300 [11] -0.0011042236 0.0032701097 -0.1936794976 -0.0826971094 0.0032050762 [16] 0.1727561254 -0.0922188504 -0.1167522945 0.1761744830 -0.0705008504 [21] -0.1882036077 -0.0357473840 0.1528178637 0.0190170139 -0.0819557922 [26] 0.0186380257 0.1478787860 0.0931776615 0.2112109175 0.0622468461 [31] -0.1347952137 0.0129162295 -0.0457094648 -0.0290236694 -0.0777483626 [36] 0.0341468649 0.0175253117 -0.0674615544 -0.0418443485 0.0004626076 [41] 0.0461058544 -0.0784467955 -0.0905341953 0.0088871643 -0.0350401041 [46] -0.0335740119 0.0483747204 -0.1176234476 > 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/48r2a1353096223.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/5h46i1353096223.tab") > > try(system("convert tmp/1sfvv1353096223.ps tmp/1sfvv1353096223.png",intern=TRUE)) character(0) > try(system("convert tmp/2gfsy1353096223.ps tmp/2gfsy1353096223.png",intern=TRUE)) character(0) > try(system("convert tmp/3df7e1353096223.ps tmp/3df7e1353096223.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.933 0.338 2.251