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(1.65,1.66,1.66,1.67,1.68,1.68,1.68,1.68,1.69,1.7,1.7,1.71,1.72,1.73,1.74,1.74,1.75,1.75,1.75,1.76,1.79,1.83,1.84,1.85,1.87,1.87,1.87,1.88,1.88,1.88,1.88,1.89,1.89,1.89,1.9,1.89,1.89,1.89,1.89,1.89,1.89,1.89,1.89,1.89,1.89,1.89,1.89,1.89,1.89,1.89,1.89,1.89,1.89,1.89,1.89,1.9,1.9,1.92,1.93,1.92,1.95,1.96,1.96,1.96,1.96,1.96,1.97,1.97,1.97,1.97,1.97,1.97) > 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/1hxy41358282376.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/2urku1358282376.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/3w5171358282376.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.258686780 0.113396287 0.299923976 0.042701665 [6] 0.058774808 0.023427497 0.059671095 0.064664693 0.009146927 [11] 0.085731434 0.019134123 0.031229994 0.027132682 -0.180657810 [16] -0.106061940 -0.080897887 -0.035563380 -0.019490237 -0.075008003 [21] -0.011491677 -0.059907170 -0.135595391 -0.029749520 -0.056005922 [26] -0.181125960 -0.023859635 -0.079377401 -0.103645166 -0.067401569 [31] -0.031157971 -0.086675736 -0.131113956 0.046322823 0.031145967 [36] -0.042553617 0.155053617 0.121694942 -0.054845551 0.102420775 [41] 0.078153009 0.022635243 -0.062143886 -0.106582106 -0.009827145 [46] -0.025004001 0.011239597 -0.053369078 -0.059455026 > (mypacf <- c(rpacf$acf)) [1] 0.258686780 0.049810712 0.278443363 -0.112714720 0.057057595 [6] -0.097974039 0.116116869 -0.007857307 0.024055782 0.036283301 [11] -0.028656247 0.035632270 -0.034641336 -0.199305933 -0.047279839 [16] -0.044843751 0.129292189 -0.020839128 -0.028053200 -0.046545146 [21] -0.030723174 -0.091979642 0.047820383 -0.012439853 -0.126728778 [26] 0.089648019 -0.080680385 -0.012643351 -0.111847080 0.048593150 [31] -0.086883610 -0.009212703 0.102676056 0.051196525 -0.023135731 [36] 0.123059264 0.051676198 -0.118599370 0.058428473 0.017576413 [41] 0.015000843 -0.154112552 -0.144411802 -0.003497190 0.020698582 [46] 0.020914993 -0.139095600 -0.007631707 > 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/49hjc1358282376.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/5eh2q1358282376.tab") > > try(system("convert tmp/1hxy41358282376.ps tmp/1hxy41358282376.png",intern=TRUE)) character(0) > try(system("convert tmp/2urku1358282376.ps tmp/2urku1358282376.png",intern=TRUE)) character(0) > try(system("convert tmp/3w5171358282376.ps tmp/3w5171358282376.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.820 0.281 2.095