R version 3.3.1 (2016-06-21) -- "Bug in Your Hair" Copyright (C) 2016 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(1230,1360,1360,1250,1420,1390,1280,1330,1400,1370,1290,1500,1260,1360,1320,1300,1440,1360,1330,1420,1510,1280,1310,1460,1280,1370,1390,1390,1460,1410,1230,1260,1590,1250,1400,1450,1220,1290,1400,1400,1460,1450,1270,1260,1550,1230,1380,1490,1180,1190,1400,1380,1510,1400,1290,1200,1600,1220,1380,1450,1260,1130,1390,1380,1570,1320,1210,1190,1580,1150,1330,1420,1260,1040,1450,1360,1500,1240,1260,1220,1680,1210,1350,1480,1270,1040,1450,1310,1510,1160,1290,1230,1680,1190,1310,1480,1320,1050,1380,1320,1480,1150,1250,1260,1680,1150,1310,1470) > 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.327 (Mon, 30 Nov 2015 06:58:35 +0000) > #Author: root > #To cite this work: Wessa P., (2015), (Partial) Autocorrelation Function (v1.0.12) 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) > x <- na.omit(x) > 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/1zqld1471277007.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/2yqmz1471277007.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/352801471277007.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.288637541 -0.202921050 -0.010785307 0.171331385 [6] -0.209758320 0.322965598 -0.195158798 0.110316905 0.005082086 [11] -0.185555009 -0.265831825 0.824585259 -0.255143288 -0.198249220 [16] 0.012218233 0.155985640 -0.199718962 0.304429379 -0.164681276 [21] 0.022518545 0.026335672 -0.147058240 -0.211676594 0.655402758 [26] -0.205365697 -0.226242203 0.055501716 0.132652193 -0.175489202 [31] 0.241225513 -0.104761460 -0.026611081 0.030002593 -0.112767870 [36] -0.173163802 0.491124135 -0.153383013 -0.231290505 0.086747817 [41] 0.087160168 -0.150287579 0.154243298 -0.049752533 -0.072618329 [46] 0.046716311 -0.085158871 -0.142474983 0.339212857 > (mypacf <- c(rpacf$acf)) [1] -0.288637541 -0.312246440 -0.214876844 0.031205266 -0.216153041 [6] 0.301615542 -0.083977258 0.232563161 0.142907133 -0.277210523 [11] -0.383199031 0.658926533 0.057070937 0.065094015 0.118863137 [16] -0.090736904 0.045986754 -0.017357732 0.011692771 -0.133277703 [21] -0.064379539 0.002865003 0.066052455 -0.008659131 0.064117211 [26] -0.081012685 0.028511649 0.009612502 0.002815829 -0.103782840 [31] 0.004583655 0.056182382 -0.057488260 0.060432016 -0.042489607 [36] -0.135129860 -0.020798481 -0.001557431 0.001484089 -0.079075536 [41] -0.026780817 -0.116984175 -0.060086579 -0.029147731 -0.024363594 [46] -0.021780857 -0.028896698 -0.064584840 > 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/4ff321471277007.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/57tyo1471277007.tab") > > try(system("convert tmp/1zqld1471277007.ps tmp/1zqld1471277007.png",intern=TRUE)) character(0) > try(system("convert tmp/2yqmz1471277007.ps tmp/2yqmz1471277007.png",intern=TRUE)) character(0) > try(system("convert tmp/352801471277007.ps tmp/352801471277007.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.222 0.078 1.312