R version 3.2.2 (2015-08-14) -- "Fire Safety" Copyright (C) 2015 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(83.36,83.61,83.41,83.64,84.06,83.93,84.1,84.37,84.18,84.11,84.56,84.2,84.45,84.28,84.28,84.7,85.04,85.31,85.18,85.02,86.31,86.56,86.4,86.84,87.42,87.28,87.27,87.73,87.32,87.15,87.5,87.43,88.81,89.38,88.83,88.91,89.34,89.56,89.32,89.31,89.45,88.92,89.35,88.89,90.1,90.49,89.96,89.93,90.32,90.24,90.61,91.06,90.81,91.09,91.17,90.87,91.92,92.67,92.03,92.09,92.61,92.19,92.68,92.66,92.77,92.21,92.58,91.9,93.81,94.05,94.51,94.49,94.36,94.72,95.57,95.87,95.93,96.09,95.82,96.06,97.09,97.67,98.53,98.12,98.84,98.98,100.04,99.47,99.84,99.52,99.81,99.55,100.21,101.44,101,101.32,101.84,101.81,101.83,102.18,101.97,101.8,101.69,101.91,102.27,102.73,102.61,102.89) > 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/1gkbf1445599689.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/27ysq1445599689.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/3jor21445599689.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.9717186659 0.9452576433 0.9175258442 0.8909686038 [6] 0.8654655559 0.8400545378 0.8124470889 0.7845137095 0.7550729708 [11] 0.7255599285 0.6975372168 0.6673527399 0.6356983095 0.6036129211 [16] 0.5700981724 0.5406371532 0.5131817829 0.4847710581 0.4551196801 [21] 0.4244840335 0.3962864307 0.3673136864 0.3406288851 0.3150412641 [26] 0.2898497636 0.2625047449 0.2370973521 0.2141109333 0.1928020939 [31] 0.1709333162 0.1479164928 0.1249843026 0.1049987330 0.0863363966 [36] 0.0692567385 0.0530814042 0.0353399887 0.0170969463 -0.0005387307 [41] -0.0178746510 -0.0297917225 -0.0452600331 -0.0597187885 -0.0766742060 [46] -0.0913666880 -0.1053327700 -0.1191542064 -0.1344547066 > (mypacf <- c(rpacf$acf)) [1] 0.971718666 0.018300319 -0.035378093 0.005241123 0.006619284 [6] -0.011693003 -0.053628553 -0.022837692 -0.041044251 -0.020965630 [11] 0.008867613 -0.055241476 -0.048095570 -0.026142172 -0.043968554 [16] 0.048685099 0.020126492 -0.035085072 -0.041481197 -0.032231098 [21] 0.028768713 -0.037776756 0.013750895 0.003047223 -0.012388196 [26] -0.050391360 0.009768827 0.023645406 0.004759024 -0.033147374 [31] -0.034883410 -0.012799805 0.034556171 0.001076871 -0.003826064 [36] 0.001495944 -0.040785999 -0.025123293 -0.007135910 -0.017049588 [41] 0.066449144 -0.083065839 0.005068396 -0.052524070 0.017972596 [46] -0.013425645 -0.030787813 -0.038094585 > 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/4bwxj1445599689.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/5d1901445599689.tab") > > try(system("convert tmp/1gkbf1445599689.ps tmp/1gkbf1445599689.png",intern=TRUE)) character(0) > try(system("convert tmp/27ysq1445599689.ps tmp/27ysq1445599689.png",intern=TRUE)) character(0) > try(system("convert tmp/3jor21445599689.ps tmp/3jor21445599689.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.135 0.215 1.358