R version 2.15.3 (2013-03-01) -- "Security Blanket" Copyright (C) 2013 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(85.3,85.65,85.15,84.94,85.15,85.15,85.15,85.14,85.37,85.61,85.59,85.54,85.54,85.5,85.78,86.16,86.38,86.49,86.49,86,85.9,85.66,85.64,85.6,85.6,85.57,85.81,86.29,86.37,86.41,86.41,86.38,86.62,87.08,87.19,87.21,87.21,87.24,87.16,87.05,87.04,86.98,86.98,86.94,86.96,86.98,86.86,86.82,86.82,86.84,86.91,86.85,86.61,86.65,86.65,86.36,86.33,86.43,86.36,86.29,86.29,86.44,86.51,86.72,86.93,86.79,86.79) > 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/17r1b1363721792.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/2jsah1363721792.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/3e2we1363721792.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.9409997744 0.8738382077 0.7881663167 0.6963252870 [6] 0.6217344837 0.5550872146 0.4929038539 0.4311765715 0.3805032501 [11] 0.3394216369 0.2991257473 0.2582256665 0.2200315968 0.1878176247 [16] 0.1757110174 0.1789898715 0.1825823487 0.1738990513 0.1542770153 [21] 0.1078844836 0.0585952605 -0.0006431305 -0.0559031445 -0.1112786984 [26] -0.1631465481 -0.2075063722 -0.2457828797 -0.2694196730 -0.2933997545 [31] -0.3190796196 -0.3410139854 -0.3605845705 -0.3723717908 -0.3698479379 [36] -0.3599705177 -0.3488563192 -0.3482934704 -0.3485071971 -0.3439175874 [41] -0.3402105222 -0.3242775995 -0.3038135597 -0.2781917908 -0.2477838711 [46] -0.2145749172 -0.1787510621 -0.1545293079 -0.1344753419 > (mypacf <- c(rpacf$acf)) [1] 0.9409997744 -0.1016628213 -0.1945193409 -0.0869669278 0.1321631416 [6] 0.0266138596 -0.0621182166 -0.0830034862 0.0769620911 0.0719934119 [11] -0.0664821555 -0.1004074055 0.0159174931 0.0852068666 0.1572939065 [16] 0.0526793678 -0.1020165558 -0.1597929975 -0.0327092599 -0.1658345445 [21] -0.0219013200 -0.1099464578 0.0279304040 -0.0328965524 -0.0277325892 [26] -0.0577429322 -0.0203667038 0.0669853305 -0.0364220067 -0.0806847618 [31] -0.0095718415 -0.0096603252 -0.0160509392 -0.0064041579 -0.0160377954 [36] -0.0229589864 -0.0900265792 -0.0029342147 0.1230938916 0.0001102063 [41] 0.0919153767 0.0385378039 0.0826051908 -0.0001901724 -0.0209408359 [46] 0.0024809808 -0.1000284312 0.0184254285 > 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/4f68f1363721792.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/5eeks1363721792.tab") > > try(system("convert tmp/17r1b1363721792.ps tmp/17r1b1363721792.png",intern=TRUE)) character(0) > try(system("convert tmp/2jsah1363721792.ps tmp/2jsah1363721792.png",intern=TRUE)) character(0) > try(system("convert tmp/3e2we1363721792.ps tmp/3e2we1363721792.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.753 0.272 2.011