R version 3.3.3 (2017-03-06) -- "Another Canoe" Copyright (C) 2017 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(90.33,90.62,91.22,91.39,91.72,91.32,91.1,91.05,91.45,91.53,91.63,91.78,92.32,92.8,92.65,93.35,93.63,93.76,93.83,93.37,93.41,93.84,94.66,94.65,94.91,95.81,95.87,95.84,96.31,96.17,96.16,96.48,96.61,97.68,97.83,97.88,98.63,99.25,99.64,100.47,101.12,101.33,100.5,99.93,99.81,99.74,99.72,99.87,100.39,100.09,100.03,101.2,99.96,99.94,100.01,98.69,98.19,98.08,98.46,98.75,99.25,99.68,99.64,101.46,100.99,101.12,100.6,100.24,100.16,101.25,100.74,100.61) > 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/13zdr1489961343.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/235ic1489961343.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/3m2l61489961343.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.957634103 0.914864187 0.871812849 0.830185011 [6] 0.791531022 0.749557349 0.702301562 0.656089872 0.612059767 [11] 0.573966555 0.533121711 0.493140571 0.452149072 0.413560815 [16] 0.373945159 0.335635462 0.299447597 0.261575297 0.222045203 [21] 0.182085322 0.137616893 0.100416759 0.067911058 0.029450226 [26] -0.008703393 -0.042580598 -0.079264413 -0.115636707 -0.149209985 [31] -0.188227121 -0.231038634 -0.268873039 -0.303987336 -0.327981547 [36] -0.347033097 -0.365082723 -0.378518968 -0.387844942 -0.397397902 [41] -0.396454941 -0.387917506 -0.377033933 -0.370606129 -0.368378978 [46] -0.364285987 -0.360693262 -0.357159981 -0.351196260 > (mypacf <- c(rpacf$acf)) [1] 0.9576341025 -0.0265127636 -0.0257091360 -0.0057824935 0.0130074617 [6] -0.0621973683 -0.0876186507 -0.0131198471 -0.0007854873 0.0399791444 [11] -0.0614485335 -0.0103700834 -0.0320417890 0.0019061042 -0.0505266743 [16] -0.0178709870 0.0029447855 -0.0460390463 -0.0497417781 -0.0423778553 [21] -0.0831036818 0.0457060695 0.0243936965 -0.1094269770 -0.0281946887 [26] 0.0306406134 -0.0738814223 -0.0615147524 -0.0046710576 -0.0986263006 [31] -0.0906374814 0.0063422240 -0.0215412792 0.0855451531 0.0316951176 [36] -0.0227783858 0.0235713988 0.0350313808 -0.0556471886 0.0746750978 [41] 0.0936335854 0.0075822224 -0.0705382718 -0.0479892085 0.0007798977 [46] -0.0581756082 -0.0111307576 0.0146769169 > 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/4b1lr1489961343.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/59y2y1489961343.tab") > > try(system("convert tmp/13zdr1489961343.ps tmp/13zdr1489961343.png",intern=TRUE)) character(0) > try(system("convert tmp/235ic1489961343.ps tmp/235ic1489961343.png",intern=TRUE)) character(0) > try(system("convert tmp/3m2l61489961343.ps tmp/3m2l61489961343.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.502 0.105 1.717