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(84.71,85.17,84.93,85.1,85.19,85.38,85.95,86.04,85.68,85.79,85.79,86.05,86.14,86.82,86.93,87.03,87.13,87.09,87.65,87.6,87.03,87.12,87.08,87.56,87.31,87.89,88.2,87.7,88.19,88.65,89.48,89.65,89.34,89.73,89.77,90.26,90.03,91.09,90.94,91.03,91.14,91.51,91.99,91.91,91.8,91.8,91.44,91.83,91.46,92.17,91.91,92.06,92.33,92.73,93.35,93.28,93.22,93.31,93.21,93.14,93.82,94.18,94.44,94.35,94.38,94.72,95.25,95.16,94.9,95.09,95.22,95.39,96.57,97.05,97.11,97.08,97.5,97.92,98.44,98.44,98.06,98.2,98.19,98.36,98.41,98.97,99.45,98.95,99.7,100.12,100.62,100.75,100.47,100.71,100.85,101.03,101.13,101.38,101.73,101.89,102.02,102.11,102.77,102.49,102.52,102.69,102.32,102.6) > 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/1qi4u1445592698.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/2m8821445592698.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/3kuvk1445592698.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.9732019989 0.9480698795 0.9204801678 0.8934293600 [6] 0.8659805911 0.8368113237 0.8105588478 0.7834270737 0.7551768160 [11] 0.7274187172 0.7001305077 0.6735384937 0.6447071514 0.6175586288 [16] 0.5905314611 0.5645736196 0.5369955029 0.5085943977 0.4826013534 [21] 0.4562255556 0.4301427209 0.4025668555 0.3759120624 0.3509838779 [26] 0.3236066397 0.2974337464 0.2715778395 0.2446414894 0.2172114414 [31] 0.1900918694 0.1660251132 0.1427747250 0.1192147880 0.0966542036 [36] 0.0740150710 0.0531790051 0.0335002420 0.0164294700 -0.0008349461 [41] -0.0178886956 -0.0354876886 -0.0532081133 -0.0687384550 -0.0840812302 [46] -0.1003360966 -0.1165975570 -0.1335097265 -0.1491558294 > (mypacf <- c(rpacf$acf)) [1] 0.9732019989 0.0179233550 -0.0584393083 -0.0069223842 -0.0192774305 [6] -0.0485324591 0.0382415928 -0.0252655570 -0.0427471466 -0.0053044258 [11] -0.0044129792 -0.0068819963 -0.0545608542 0.0115511016 -0.0120945102 [16] 0.0008968638 -0.0449016494 -0.0345388709 0.0228122743 -0.0183747962 [21] -0.0159482245 -0.0436072885 -0.0072278447 0.0127558519 -0.0569814518 [26] -0.0053286707 -0.0087182682 -0.0485626309 -0.0284242983 -0.0075800442 [31] 0.0257445723 -0.0010539691 -0.0259227871 -0.0012109835 -0.0272855274 [36] 0.0075036393 0.0143329035 0.0271191619 -0.0250523424 -0.0208637202 [41] -0.0264367370 -0.0205052478 0.0154745335 -0.0066961730 -0.0402414847 [46] -0.0206339534 -0.0341827798 -0.0060583232 > 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/4gc2i1445592698.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/5qct11445592698.tab") > > try(system("convert tmp/1qi4u1445592698.ps tmp/1qi4u1445592698.png",intern=TRUE)) character(0) > try(system("convert tmp/2m8821445592698.ps tmp/2m8821445592698.png",intern=TRUE)) character(0) > try(system("convert tmp/3kuvk1445592698.ps tmp/3kuvk1445592698.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.122 0.208 1.333