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(196.09,192.64,189.19,182.29,252.11,248.66,196.09,161.18,164.62,164.62,168.08,175.35,154.27,133.16,115.88,115.88,182.29,189.19,136.61,77.14,108.60,108.60,133.16,147.34,143.89,108.60,126.26,119.33,178.80,164.62,108.60,66.75,105.15,115.88,126.26,140.07,112.05,87.87,98.25,101.70,192.64,192.64,140.07,133.16,154.27,143.89,171.90,206.82,213.75,164.62,150.79,136.61,231.38,238.31,220.65,238.31,234.83,206.82,238.31,273.23,287.40,245.21,217.20,238.31,329.25,357.26,350.36,364.16,360.71,325.80,385.28,399.45,420.19,357.26,332.70,360.71,427.46,486.94,472.76,472.76,479.70,455.47,518.44,518.44,507.71,448.20,458.93,465.86,511.50,570.98,528.79,549.90,532.24,521.88,602.47,584.81,560.25,525.34,560.25,577.91,598.99,627.00,598.99,616.28,595.20,591.75,679.23,686.51,658.50,609.37,651.22,668.85,689.96,721.42,689.96,714.52,703.80,665.40,745.98,745.98) > 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/1ryge1376327122.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/2qzk61376327122.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/3l1w31376327122.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.00000000 0.96641600 0.93166502 0.91182752 0.89732063 0.88764294 [7] 0.87380107 0.84652034 0.81509540 0.78761341 0.77088386 0.76564782 [13] 0.75421072 0.71580102 0.67671662 0.65122114 0.63216882 0.61630210 [19] 0.59781431 0.56695035 0.53161219 0.50093102 0.48079657 0.46930925 [25] 0.45255339 0.41531878 0.37630610 0.34946680 0.32537183 0.30521819 [31] 0.28492451 0.25077365 0.21513486 0.18530043 0.16562150 0.15199921 [37] 0.13116619 0.09561108 0.05958622 0.03189595 0.00385249 -0.01665016 [43] -0.03591061 -0.06643016 -0.09818432 -0.12379744 -0.13845101 -0.14994983 [49] -0.16709254 > (mypacf <- c(rpacf$acf)) [1] 0.966416003 -0.034749713 0.208404099 0.063767695 0.117399646 [6] -0.037908334 -0.169758508 -0.089856830 -0.040229410 0.096086828 [11] 0.158376510 -0.025343937 -0.334459618 -0.030766234 0.064349274 [16] 0.019986792 -0.002394399 0.007751814 -0.062078570 -0.037210065 [21] -0.031923878 0.010407968 0.031298508 0.016618090 -0.133462740 [26] -0.049402259 0.018740606 -0.074219662 0.005431621 0.017235448 [31] -0.079194501 0.027806671 -0.018734609 0.026979814 -0.021639330 [36] -0.042845782 -0.054532593 -0.031964978 -0.030196591 -0.122967103 [41] 0.051244226 0.020090517 -0.002539567 0.005905773 -0.015474428 [46] 0.058260907 -0.040549519 -0.009782890 > 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/4t4om1376327122.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/5t2af1376327122.tab") > > try(system("convert tmp/1ryge1376327122.ps tmp/1ryge1376327122.png",intern=TRUE)) character(0) > try(system("convert tmp/2qzk61376327122.ps tmp/2qzk61376327122.png",intern=TRUE)) character(0) > try(system("convert tmp/3l1w31376327122.ps tmp/3l1w31376327122.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 3.067 0.678 3.758