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(500.01,500.02,500.03,500.04,500.05,500.06,500.07,500.08,500.09,500.10,500.11,500.12,500.13,500.14,500.15,500.16,500.17,500.18,500.19,500.20,500.21,500.22,500.23,500.24,500.25,500.26,500.27,500.28,500.29,500.30,500.31,500.32,500.33,500.34,500.35,500.36,500.37,500.38,500.39,500.40,500.41,500.42,500.43,500.44,500.45,500.46,500.47,500.48,500.49,500.50,500.51,500.52,500.53,500.54,500.55,500.56,500.57,500.58,500.59,500.60,500.61,500.62,500.63,500.64,500.65,500.66,500.67,500.68,500.69,500.70,500.71) > par8 = '' > par7 = '0.95' > par6 = 'White Noise' > par5 = '12' > par4 = '0' > par3 = '0' > par2 = '1' > par1 = '48' > par8 <- '' > par7 <- '0.95' > par6 <- 'White Noise' > par5 <- '12' > par4 <- '0' > par3 <- '0' > 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/fisher/rcomp/tmp/1sfbc1387732664.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/2eb6e1387732664.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/3ylca1387732664.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.0000000000 0.9577464789 0.9155264923 0.8733735748 0.8313212609 [6] 0.7894030852 0.7476525822 0.7061032864 0.6647887324 0.6237424547 [11] 0.5829979879 0.5425888665 0.5025486251 0.4629107981 0.4237089202 [16] 0.3849765258 0.3467471496 0.3090543260 0.2719315895 0.2354124748 [21] 0.1995305164 0.1643192488 0.1298122066 0.0960429242 0.0630449363 [26] 0.0308517773 -0.0005030181 -0.0309859155 -0.0605633803 -0.0892018779 [31] -0.1168678739 -0.1435278337 -0.1691482227 -0.1936955064 -0.2171361502 [36] -0.2394366197 -0.2605633803 -0.2804828974 -0.2991616365 -0.3165660630 [41] -0.3326626425 -0.3474178404 -0.3607981221 -0.3727699531 -0.3832997988 [46] -0.3923541247 -0.3998993964 -0.4059020791 -0.4103286385 > (mypacf <- c(rpacf$acf)) [1] 0.957746479 -0.021177344 -0.021229633 -0.021283224 -0.021337691 [6] -0.021392590 -0.021447448 -0.021501767 -0.021555021 -0.021606648 [11] -0.021656050 -0.021702592 -0.021745593 -0.021784328 -0.021818018 [16] -0.021845830 -0.021866873 -0.021880187 -0.021884746 -0.021879446 [21] -0.021863105 -0.021834451 -0.021792121 -0.021734653 -0.021660478 [26] -0.021567915 -0.021455167 -0.021320306 -0.021161276 -0.020975880 [31] -0.020761779 -0.020516482 -0.020237343 -0.019921557 -0.019566158 [36] -0.019168016 -0.018723838 -0.018230166 -0.017683389 -0.017079739 [41] -0.016415309 -0.015686057 -0.014887827 -0.014016361 -0.013067323 [46] -0.012036316 -0.010918914 -0.009710681 > 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/4s86p1387732664.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/5fh0q1387732665.tab") > > try(system("convert tmp/1sfbc1387732664.ps tmp/1sfbc1387732664.png",intern=TRUE)) character(0) > try(system("convert tmp/2eb6e1387732664.ps tmp/2eb6e1387732664.png",intern=TRUE)) character(0) > try(system("convert tmp/3ylca1387732664.ps tmp/3ylca1387732664.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 3.427 1.056 4.456