R version 3.0.1 (2013-05-16) -- "Good Sport" Copyright (C) 2013 The R Foundation for Statistical Computing 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(1155168,1144638,1133976,1111920,1330188,1318626,1155168,1046484,1056978,1056978,1068672,1089696,1155168,1133976,1166694,1220472,1526400,1526400,1461096,1395624,1449402,1514838,1526400,1559118,1657302,1591836,1591836,1690020,1962198,1984254,1929480,1798572,1896726,1896726,1907256,1962198,2005446,2027502,2027502,2092938,2344086,2409390,2419884,2256426,2344086,2311368,2245902,2387334,2419884,2365110,2376672,2452638,2736510,2877744,2877744,2812440,2910492,2812440,2757528,2965434,2997984,2920992,3117198,3194196,3423126,3575052,3554034,3542334,3629994,3619332,3488592,3684768,3750240,3684768,3956946,4087854,4392612,4512858,4480272,4414800,4469610,4535046,4316646,4490766,4600518,4556238,4839942,4937958,5352606,5428566,5330544,5385324,5418042,5450760,5242854,5439066,5547744,5439066,5755650,5853708,6278808,6344280,6365304,6475020,6475020,6518268,6322056,6420246,6485550,6365304,6714474,6779916,7215582,7292580,7401258,7499448,7509942,7521504,7325298,7521504) > 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.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/fisher/rcomp/tmp/18xry1373027676.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/fisher/rcomp/tmp/2125y1373027676.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/fisher/rcomp/tmp/33h2c1373027676.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.974719147 0.950395300 0.923515853 0.895875006 [6] 0.869071766 0.842311098 0.816445954 0.789799879 0.766716865 [11] 0.743585819 0.722906877 0.700637257 0.675178610 0.649833469 [16] 0.622246406 0.594464577 0.567805106 0.541510989 0.515622059 [21] 0.489258109 0.466547308 0.444629432 0.425049457 0.404081120 [26] 0.381287691 0.359168966 0.334732434 0.310250519 0.286982442 [31] 0.263936876 0.240165606 0.215911448 0.195336128 0.175408210 [36] 0.157581018 0.139018240 0.119110647 0.100155637 0.079028173 [41] 0.057995915 0.038273215 0.018141765 -0.001973206 -0.022262242 [46] -0.039939860 -0.056615655 -0.071657372 -0.087162982 -0.103813603 [51] -0.119634605 -0.136567261 -0.153920495 -0.169468006 -0.184434506 [56] -0.199431308 -0.213685033 -0.225837744 -0.237557681 -0.248249184 [61] -0.259059105 > (mypacf <- c(rpacf$acf)) [1] 9.747191e-01 6.367533e-03 -6.331095e-02 -3.119687e-02 4.157267e-03 [6] -1.118540e-02 2.064313e-03 -3.006262e-02 5.481488e-02 -1.043104e-02 [11] 3.025755e-02 -4.571010e-02 -8.095370e-02 -1.400530e-02 -4.948813e-02 [16] -2.327952e-02 1.297063e-02 -8.739526e-03 -6.113981e-03 -3.034949e-02 [21] 4.835673e-02 2.178024e-03 1.736216e-02 -4.315382e-02 -5.301462e-02 [26] -7.707018e-05 -4.698796e-02 -2.506073e-02 1.652203e-02 -1.139592e-02 [31] -2.633698e-02 -3.544030e-02 4.594650e-02 -2.611638e-03 4.284550e-03 [36] -3.219892e-02 -4.507919e-02 5.670846e-03 -4.436011e-02 -2.829395e-02 [41] 1.854785e-02 -2.286799e-02 -8.316415e-03 -2.997997e-02 2.162218e-02 [46] 3.955080e-03 -9.773109e-03 -3.005132e-02 -4.205673e-02 1.117371e-03 [51] -2.223685e-02 -4.389686e-02 2.688599e-02 2.112891e-03 -1.062406e-02 [56] -1.322851e-02 1.164561e-02 -7.904585e-03 -2.242494e-02 -2.540841e-02 > lengthx <- length(x) > sqrtn <- sqrt(lengthx) > > #Note: the /var/fisher/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/fisher/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/fisher/rcomp/tmp/4ql3h1373027676.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/fisher/rcomp/tmp/5jx4i1373027676.tab") > > try(system("convert tmp/18xry1373027676.ps tmp/18xry1373027676.png",intern=TRUE)) character(0) > try(system("convert tmp/2125y1373027676.ps tmp/2125y1373027676.png",intern=TRUE)) character(0) > try(system("convert tmp/33h2c1373027676.ps tmp/33h2c1373027676.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.844 0.575 3.409