R version 2.15.3 (2013-03-01) -- "Security Blanket" Copyright (C) 2013 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(547084.00,639842.00,770730.00,911599.00,971249.00,925102.00,906046.00,1006991.00,1013942.00,991188.00,819356.00,793778.00,601962.00,685640.00,785923.00,954888.00,1029140.00,972811.00,951330.00,1012865.00,1005502.00,987489.00,828421.00,817308.00,625827.00,683491.00,848657.00,978027.00,1019467.00,980306.00,992574.00,1080411.00,1047988.00,1023560.00,871245.00,824793.00,645999.00,736888.00,874488.00,992614.00,1107708.00,955938.00,1024122.00,1081598.00,1028158.00,1006457.00,826725.00,839116.00,591481.00,671244.00,788395.00,912291.00,987428.00,873452.00,952046.00,1037521.00,958597.00,965368.00,780741.00,814377.00,594739.00,668940.00,815882.00,928023.00,1025552.00,945840.00,1020639.00,1109899.00,1033403.00,1050530.00,840420.00,820378.00,609379.00,678402.00,889241.00,998445.00,1054502.00,1076699.00,1093802.00,1134793.00,1054084.00,1068675.00,857337.00,855380.00) > 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/fisher/rcomp/tmp/1drc41363700437.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/fisher/rcomp/tmp/23fz41363700437.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/fisher/rcomp/tmp/37zzt1363700437.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.68989918 0.32608180 -0.08694857 -0.32870452 -0.43436333 [7] -0.52731073 -0.46138612 -0.34658796 -0.10792280 0.29310424 0.56919245 [13] 0.78035195 0.51401741 0.20397318 -0.13328858 -0.33557514 -0.40773845 [19] -0.48596094 -0.43331871 -0.33259470 -0.13821879 0.20855530 0.44339981 [25] 0.61735890 0.40121092 0.14026802 -0.12044387 -0.28208442 -0.34073396 [31] -0.40722702 -0.37019286 -0.27520886 -0.10607568 0.18977880 0.39049809 [37] 0.52474063 0.35534289 0.15010676 -0.05903412 -0.19044211 -0.23465505 [43] -0.29683584 -0.27520896 -0.19311024 -0.06213843 0.17012008 0.31689393 [49] 0.41724031 > (mypacf <- c(rpacf$acf)) [1] 0.6898991787 -0.2860074146 -0.3718771775 -0.0448026151 -0.0928342100 [6] -0.4040961128 -0.0328607220 -0.0988114517 -0.0395679572 0.4904916073 [11] 0.1252143946 0.3427944982 -0.4504172159 0.0485074498 -0.0500781816 [16] 0.0212715115 0.0008162302 0.0037177606 -0.0396188035 -0.1479543898 [21] -0.1240023424 -0.0788886166 0.0972096082 -0.0127529520 -0.0509453167 [26] -0.0312752864 -0.0046035891 -0.0538370013 -0.0785940664 0.0633493119 [31] -0.0035621428 0.0289804004 -0.0175341384 -0.0580362062 0.0360096428 [36] -0.0409593389 0.0401154140 0.0825249747 -0.0172249487 0.0273193727 [41] 0.0643926894 -0.0484693962 0.0429776060 0.0859165357 -0.0646815007 [46] 0.0080236619 -0.0408931882 -0.0025393767 > lengthx <- length(x) > sqrtn <- sqrt(lengthx) > > #Note: the /var/fisher/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/fisher/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/fisher/rcomp/tmp/4mbeh1363700438.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/fisher/rcomp/tmp/5zy0r1363700438.tab") > > try(system("convert tmp/1drc41363700437.ps tmp/1drc41363700437.png",intern=TRUE)) character(0) > try(system("convert tmp/23fz41363700437.ps tmp/23fz41363700437.png",intern=TRUE)) character(0) > try(system("convert tmp/37zzt1363700437.ps tmp/37zzt1363700437.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.824 0.300 2.110