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 = '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/fisher/rcomp/tmp/14lwq1363701246.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/2dw8s1363701246.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/32z9z1363701246.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.130124423 0.144618724 -0.262761426 -0.223508313 [6] -0.042144241 -0.297488997 -0.054233281 -0.225571049 -0.308316926 [11] 0.157055345 0.106505846 0.809268629 0.109550650 0.093565982 [16] -0.186704570 -0.207471266 -0.013489706 -0.249469770 -0.062306773 [21] -0.177473399 -0.288526432 0.140700218 0.104048540 0.650648315 [26] 0.099884058 0.065986859 -0.134805184 -0.169608263 -0.003829509 [31] -0.187579863 -0.069119194 -0.149853374 -0.244531155 0.113861008 [36] 0.101244571 0.498849285 0.096246256 0.063238126 -0.099067505 [41] -0.115729438 -0.024837988 -0.131630244 -0.083456103 -0.113678111 [46] -0.197555006 0.085014538 0.084918698 0.354302982 > (mypacf <- c(rpacf$acf)) [1] 0.130124423 0.129885630 -0.306303266 -0.190962009 0.113051190 [6] -0.367270204 -0.136120223 -0.156215032 -0.623944849 0.117186089 [11] 0.006498493 0.548553035 -0.088189500 -0.149266486 -0.000595169 [16] 0.007044159 -0.060574788 0.002180554 -0.006257653 0.038299105 [21] 0.046521398 -0.121562831 0.034577584 -0.004882881 -0.044140802 [26] 0.056127113 -0.058161224 0.025985436 0.024399448 -0.008599515 [31] -0.019206354 0.001710437 0.040144379 -0.027858164 0.006338761 [36] -0.070656513 0.041943414 0.075064566 -0.040453514 0.047840183 [41] -0.059011856 0.031219530 -0.017724120 0.051418361 -0.003253355 [46] 0.017840654 -0.017397181 -0.092815955 > 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/4ph6n1363701246.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/530sn1363701246.tab") > > try(system("convert tmp/14lwq1363701246.ps tmp/14lwq1363701246.png",intern=TRUE)) character(0) > try(system("convert tmp/2dw8s1363701246.ps tmp/2dw8s1363701246.png",intern=TRUE)) character(0) > try(system("convert tmp/32z9z1363701246.ps tmp/32z9z1363701246.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.795 0.277 2.049