R version 3.0.2 (2013-09-25) -- "Frisbee Sailing" Copyright (C) 2013 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(70.38,70.38,70.29,70.42,70.29,70.59,70.64,70.64,70.68,70.78,70.9,71.04,71.15,71.15,71.15,71.07,71.17,71.24,71.23,71.23,71.23,71.24,71.28,71.52,71.52,71.52,71.6,71.61,71.78,71.66,71.86,71.86,71.82,71.8,72.22,72.51,72.56,72.56,72.78,72.88,73.05,73.02,73.08,73.08,73.24,73.82,74,74.37,74.38,74.38,74.36,74.42,74.59,75.07,75.19,75.19,75.21,75.18,75.86,75.93,76.01,73.23,73.23,73.2,73.24,73.36,73.4,73.49,73.49,73.57,73.82,74.08,74.08) > 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/wessaorg/rcomp/tmp/12csd1420276433.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/2p58m1420276433.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/3b4ba1420276433.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.953455752 0.904475255 0.853985086 0.817011731 [6] 0.778140237 0.739751864 0.700021847 0.658196276 0.623405598 [11] 0.594353704 0.569629407 0.541368617 0.487740753 0.429711150 [16] 0.375472705 0.326701891 0.286516152 0.246914906 0.203300624 [21] 0.158601536 0.115274970 0.075143432 0.035396431 -0.001582897 [26] -0.042070247 -0.084598875 -0.120345064 -0.149194567 -0.173256270 [31] -0.199530958 -0.225667574 -0.249879161 -0.277754185 -0.303220480 [36] -0.323565790 -0.340252363 -0.358362309 -0.377852235 -0.388599177 [41] -0.394839739 -0.400186171 -0.407277823 -0.415674636 -0.422856538 [46] -0.428823916 -0.424926592 -0.420654412 -0.412485228 > (mypacf <- c(rpacf$acf)) [1] 0.953455752 -0.050621505 -0.041697521 0.122860875 -0.049958100 [6] -0.020911553 -0.015000042 -0.054051214 0.057780199 0.037445038 [11] 0.014218155 -0.038260819 -0.294536968 -0.061899416 0.013799900 [16] -0.055714712 0.079685984 -0.016388899 -0.080685889 -0.003827084 [21] -0.075158086 -0.047180646 -0.046667119 -0.004475703 0.030778655 [26] -0.039608872 0.030098471 0.027360590 -0.058799157 -0.052550893 [31] 0.001519590 -0.004536435 -0.070640002 -0.005947713 0.038271266 [36] -0.018413807 -0.039907002 -0.030996823 0.030960896 -0.013527579 [41] -0.037545578 -0.015380540 -0.039765395 -0.014958564 0.018394459 [46] 0.067799769 -0.048018315 0.023067257 > 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/4rne71420276433.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/5mmd81420276433.tab") > > try(system("convert tmp/12csd1420276433.ps tmp/12csd1420276433.png",intern=TRUE)) character(0) > try(system("convert tmp/2p58m1420276433.ps tmp/2p58m1420276433.png",intern=TRUE)) character(0) > try(system("convert tmp/3b4ba1420276433.ps tmp/3b4ba1420276433.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.206 0.179 1.392