R version 3.0.2 (2013-09-25) -- "Frisbee Sailing" 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(6714.580043,7702.883281,9855.858483,8326.43136,9268.841212,7035.408602,10341.50586,11681.94192,10303.57287,11384.5829,9777.225921,8882.366455,7896.590139,6929.564098,9544.753788,9110.342185,7458.710291,7319.772861,10017.34419,12307.13647,11072.29609,10748.84755,9588.810984,9080.170402,7384.440407,8062.058679,8510.578229,8684.345395,8305.968153,7642.565124,10577.49554,13747.19397,11783.27459,11611.42999,9945.741914,8692.951724,7302.520182,7609.123374,9423.286031,8583.625656,7586.252878,6842.894335,11810.62427,13413.53598,12102.72578,11501.16989,8212.500701,7981.599542,7687,7180,7862,8043,8340,6692,10065,12684,11587,9843,8110,7940,6475,6121,9669,7778,7826,7403,10741,14023,11519,10236,8075,8157) > 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/1oica1389351149.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/213v41389351149.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/3mchd1389351149.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.551148792 0.076694445 -0.196251744 -0.286113940 [6] -0.271707270 -0.421227328 -0.335869154 -0.274948941 -0.175479443 [11] 0.140504031 0.508288375 0.747072119 0.439422601 0.007786405 [16] -0.231217017 -0.272029664 -0.249402059 -0.364589478 -0.296333585 [21] -0.222417285 -0.099284484 0.124550999 0.412624153 0.617889128 [26] 0.329526978 -0.049118720 -0.218257949 -0.212203375 -0.166678358 [31] -0.266946857 -0.233454498 -0.172606045 -0.039761391 0.127818319 [36] 0.308490355 0.425485053 0.199835090 -0.042583912 -0.155121879 [41] -0.124364350 -0.084223662 -0.180235910 -0.154295314 -0.098141181 [46] -0.010348809 0.091467349 0.181546381 0.252209074 0.106520635 [51] -0.035442876 -0.107850529 -0.060040613 -0.013960119 -0.100137618 [56] -0.089103513 -0.057636703 -0.001075679 0.077648985 0.087109105 [61] 0.137217573 > (mypacf <- c(rpacf$acf)) [1] 0.551148792 -0.326140659 -0.116615725 -0.109804155 -0.108811177 [6] -0.447976361 0.040411462 -0.420861273 -0.222014565 0.105400845 [11] 0.368906853 0.277696453 -0.098460662 -0.083339162 -0.154226764 [16] 0.016898641 -0.024854950 -0.062771352 0.139484822 -0.059895793 [21] -0.056763046 -0.237406092 0.038096541 -0.004538969 -0.109461563 [26] -0.043399595 0.061098781 -0.018882945 -0.012764538 0.004166389 [31] -0.026270393 -0.091852410 0.125164816 -0.173248244 -0.056175675 [36] -0.137623031 -0.035306720 0.016753956 0.084533788 -0.050632083 [41] -0.036064322 0.006521141 -0.038605712 -0.040072119 0.023257983 [46] -0.040421283 -0.029069741 -0.120253343 0.016851175 -0.037071941 [51] -0.068320953 -0.027644077 0.010343487 -0.105831669 -0.003616947 [56] -0.015470153 -0.090490612 0.110297712 -0.054085164 0.001226473 > 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/4gshp1389351149.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/5vcql1389351149.tab") > > try(system("convert tmp/1oica1389351149.ps tmp/1oica1389351149.png",intern=TRUE)) character(0) > try(system("convert tmp/213v41389351149.ps tmp/213v41389351149.png",intern=TRUE)) character(0) > try(system("convert tmp/3mchd1389351149.ps tmp/3mchd1389351149.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.682 0.354 2.040