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(193,223,254,284,294,304,314,314,314,314,324,335,335,335,345,365,365,385,385,385,395,395,405,405,416,416,426,436,446,446,466,476,476,476,476,486,497,507,517,527,527,547,547,557,557,557,567,567,598,598,618,628,638,669,679,689,689,689,689,709,719,729,790,831,942,952,962,1013,1033,1033,1043,1043,1053,1114,1155,1215,1236,1296,1317,1327,1347,1367,1367,1387,1408,1468,1479,1499,1499,1509,1519,1529,1539,1590,1620,1620,1651,1671,1691,1711,1721,1732,1732,1742,1762,1782,1813,1883,1904,1924,1934,1964,1985,1995,1995,2035,2066,2086,2157,2157) > 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.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/1339r1470921335.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/2vo1l1470921335.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/3zff01470921335.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.235545590 0.262808427 0.150991624 0.038579673 [6] 0.009567160 -0.041084294 -0.040316563 0.078170690 0.184980399 [11] 0.220190301 0.381632995 0.156218072 0.224588741 0.159205940 [16] -0.028770485 0.034404661 -0.060557419 -0.019480007 0.014285844 [21] 0.009185046 0.133699398 0.103326605 0.071449023 -0.006194241 [26] -0.010569447 0.005602842 -0.056430824 -0.131844931 0.016607428 [31] 0.024241173 0.033110870 0.101983746 0.059919345 0.075494448 [36] -0.062078418 -0.087624395 -0.027140461 -0.074056747 -0.097808108 [41] -0.010039069 -0.061973964 -0.014721684 0.121391334 0.016447679 [46] 0.069779643 -0.127958029 -0.022636802 -0.036260859 > (mypacf <- c(rpacf$acf)) [1] 0.235545590 0.219505231 0.056698968 -0.062049063 -0.037852742 [6] -0.044148356 -0.014899260 0.127731234 0.201082325 0.144789920 [11] 0.266318258 -0.057450423 0.039696433 0.053972158 -0.112160504 [16] 0.036912619 -0.023299651 0.001755783 -0.029435090 -0.090596526 [21] 0.047286434 -0.073426360 -0.041135542 -0.153242076 -0.071401861 [26] 0.095236545 -0.072305665 -0.084247431 0.107379518 0.052392071 [31] 0.037395426 0.035119552 0.081587793 0.066107587 -0.111707691 [36] -0.046611539 0.075944850 0.077805181 -0.065373001 -0.048543213 [41] -0.040672533 -0.103776278 0.052971520 -0.019234005 0.050320726 [46] -0.161214971 -0.031565265 0.018037829 > 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/432by1470921335.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/5c8xl1470921335.tab") > > try(system("convert tmp/1339r1470921335.ps tmp/1339r1470921335.png",intern=TRUE)) character(0) > try(system("convert tmp/2vo1l1470921335.ps tmp/2vo1l1470921335.png",intern=TRUE)) character(0) > try(system("convert tmp/3zff01470921335.ps tmp/3zff01470921335.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.189 0.119 1.328