R version 2.15.2 (2012-10-26) -- "Trick or Treat" Copyright (C) 2012 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(39.28,39.36,39.55,39.64,39.8,39.79,39.79,39.86,39.91,40,40.01,40.01,40.01,39.96,40,39.76,39.68,39.7,39.7,39.73,39.64,39.56,39.67,39.66,39.66,40.05,39.99,40.06,40.08,40.1,40.1,40.12,40.07,40.24,40.58,40.72,40.72,40.89,40.9,41.04,41.27,41.29,41.29,41.33,41.34,41.37,41.33,41.37,41.37,41.42,41.61,41.58,41.75,41.75,41.75,41.85,41.84,41.97,42.01,42.04,42.04,42.06,41.93,41.93,41.99,42.03,42.03,42.12,42.22,42.21,42.23,42.22) > par8 = '' > par7 = '0.95' > par6 = 'White Noise' > par5 = '12' > par4 = '0' > par3 = '1' > par2 = '1' > par1 = '48' > par8 <- '' > par7 <- '0.95' > par6 <- 'White Noise' > par5 <- '12' > par4 <- '0' > par3 <- '1' > 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/11p4r1354448121.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/2z7fk1354448121.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/337k31354448121.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.081288241 0.091859631 0.169180246 -0.096851443 [6] 0.083047800 0.090196096 -0.070156639 0.005047323 0.060252865 [11] -0.065216813 -0.106975498 -0.050252728 -0.153209913 -0.174570562 [16] 0.189646566 0.026204483 -0.046201758 -0.011148333 -0.309955209 [21] -0.127717548 -0.046137278 -0.155251201 0.014427067 -0.093942514 [26] 0.010336883 -0.084377651 0.027127789 -0.097077167 -0.154025692 [31] 0.140280405 0.064424723 0.081945497 0.144649349 -0.034351451 [36] -0.051153830 0.035812487 -0.166660327 0.044075301 0.019478193 [41] -0.027073701 0.028957424 -0.002867922 0.069576047 -0.070374261 [46] 0.021644358 0.041668228 0.049137097 0.090893988 > (mypacf <- c(rpacf$acf)) [1] 0.081288241 0.085818926 0.157571920 -0.131814876 0.076475867 [6] 0.073474802 -0.062643552 -0.038281088 0.072373443 -0.043057111 [11] -0.144480829 -0.041008543 -0.084837206 -0.155086027 0.243180692 [16] 0.098717367 -0.078550460 -0.123011209 -0.253391898 -0.101781913 [21] -0.049017895 -0.022740833 0.062956067 -0.138711486 0.051315103 [26] -0.131948904 0.075362918 -0.084429722 -0.089484131 0.084162014 [31] -0.005398738 -0.023904006 -0.025311700 0.050502274 -0.051388784 [36] -0.066396030 -0.183325758 -0.058726485 -0.056090292 -0.047935792 [41] -0.015622626 -0.051718220 0.073319526 -0.025585804 -0.036473703 [46] -0.026340032 -0.016697869 -0.142801788 > 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/4rxdc1354448121.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/56m3o1354448121.tab") > > try(system("convert tmp/11p4r1354448121.ps tmp/11p4r1354448121.png",intern=TRUE)) character(0) > try(system("convert tmp/2z7fk1354448121.ps tmp/2z7fk1354448121.png",intern=TRUE)) character(0) > try(system("convert tmp/337k31354448121.ps tmp/337k31354448121.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.912 0.421 2.312