R version 3.3.3 (2017-03-06) -- "Another Canoe" Copyright (C) 2017 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(91.46,92.17,91.91,92.06,92.33,92.73,93.35,93.28,93.22,93.31,93.21,93.14,93.82,94.18,94.44,94.35,94.38,94.72,95.25,95.16,94.9,95.09,95.22,95.39,96.57,97.05,97.11,97.08,97.5,97.92,98.44,98.44,98.06,98.2,98.19,98.36,98.41,98.97,99.45,98.95,99.7,100.12,100.62,100.75,100.47,100.71,100.85,101.03,101.13,101.38,101.73,101.89,102.02,102.11,102.77,102.49,102.52,102.69,102.32,102.6,103.03,103.7,103.17,103.88,104.09,104.32,104.88,105.06,104.66,105.41,105.41,105.48) > par8 = '' > par7 = '0.95' > par6 = 'White Noise' > par5 = '12' > par4 = '0' > par3 = '0' > par2 = '1' > par1 = '60' > par8 <- '' > par7 <- '0.95' > par6 <- 'White Noise' > par5 <- '12' > par4 <- '0' > par3 <- '0' > par2 <- '1' > par1 <- '60' > #'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/1iho71489961445.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/2znx51489961445.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/3hpte1489961445.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.955428317 0.914132610 0.870140855 0.829433459 [6] 0.786438092 0.744585380 0.706931481 0.668332652 0.629787029 [11] 0.594217068 0.553772315 0.514711057 0.478069848 0.442601001 [16] 0.405717791 0.368790809 0.329887544 0.289326112 0.253842630 [21] 0.216213374 0.176661615 0.137830862 0.101289265 0.064057151 [26] 0.031570983 0.001372881 -0.029137932 -0.058944942 -0.089231038 [31] -0.118404204 -0.142630531 -0.165135342 -0.186838157 -0.211292395 [36] -0.233533209 -0.252878001 -0.274163359 -0.292911498 -0.308809105 [41] -0.328464367 -0.346680500 -0.363641559 -0.376378683 -0.386367265 [46] -0.395870043 -0.405403172 -0.414193109 -0.420033325 -0.419965335 [51] -0.418139675 -0.413419370 -0.407548234 -0.402626574 -0.398431368 [56] -0.387720024 -0.377323847 -0.366743600 -0.356243606 -0.346812197 [61] -0.334007577 > (mypacf <- c(rpacf$acf)) [1] 0.9554283175 0.0147933462 -0.0511945601 0.0121297534 -0.0452246824 [6] -0.0146041564 0.0277962138 -0.0321174697 -0.0247369037 0.0141790729 [11] -0.0796336077 -0.0139858568 0.0113194588 -0.0172427763 -0.0376810175 [16] -0.0243108606 -0.0563412583 -0.0485518913 0.0338239912 -0.0547273368 [21] -0.0566348687 -0.0181493270 -0.0161376408 -0.0431605680 0.0310386952 [26] -0.0063960407 -0.0411147226 -0.0130562745 -0.0474927182 -0.0253970833 [31] 0.0418182690 -0.0084531716 -0.0317184257 -0.0508096027 -0.0190529488 [36] 0.0009895003 -0.0374065380 -0.0051934523 -0.0005155098 -0.0779042487 [41] -0.0238479294 -0.0203190602 0.0155339513 0.0172532893 -0.0315971014 [46] -0.0457227034 -0.0201516662 0.0033868740 0.0489004833 0.0124997129 [51] 0.0039072359 -0.0144717472 -0.0362571292 -0.0242969036 0.0676041654 [56] -0.0017045585 -0.0117573887 -0.0276231570 -0.0493899822 0.0330006151 > 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/48erx1489961445.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/5vhg31489961445.tab") > > try(system("convert tmp/1iho71489961445.ps tmp/1iho71489961445.png",intern=TRUE)) character(0) > try(system("convert tmp/2znx51489961445.ps tmp/2znx51489961445.png",intern=TRUE)) character(0) > try(system("convert tmp/3hpte1489961445.ps tmp/3hpte1489961445.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.329 0.112 1.464