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(79.55,80.08,80.15,80.69,81.56,81.23,81.39,81.61,82.25,82.06,82.82,82.3,83.09,83.21,83.13,84.31,83.62,83.75,84.1,83.71,84.2,85.13,86.16,86.65,87.44,87.62,88.03,89.1,89.68,89.47,90.13,89.49,89.52,89.86,89.77,89.8,90.89,90.82,90.68,90.92,90.82,90.09,89.71,89.34,89.2,89.48,89.72,89.58,90.65,90.93,91.42,91.52,91.76,91.47,91.37,91.35,91.74,91.78,91.88,91.99,92.55,92.94,92.81,93.35,93.72,93.94,94.03,93.66,93.78,94.1,94.85,94.83,95.06,95.87,95.97,95.96,96.3,96.17,96.18,96.55,96.76,97.63,97.86,97.82,98.62,99.24,99.63,100.27,100.84,101.05,100.38,100.02,99.97,99.95,100,100.04,100.51,100.29,100.22,101.29,100.29,100.26,100.39,99.3,98.9,98.76,99.12,99.28) > 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/wessaorg/rcomp/tmp/18lpg1445678338.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/2n8881445678338.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/3pjee1445678338.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.000000e+00 1.177252e-02 1.004634e-01 2.690970e-01 -1.142587e-01 [6] -6.777581e-02 1.944434e-02 -8.225227e-02 -4.451867e-02 5.030700e-02 [11] -7.959309e-05 3.008830e-03 2.259647e-01 2.459098e-02 1.859517e-02 [16] 6.865877e-02 -1.725411e-01 -2.033213e-01 1.820376e-02 -2.701034e-01 [21] -4.609652e-02 -5.807343e-03 -4.916297e-02 2.586773e-02 1.505015e-01 [26] 4.087856e-02 9.049091e-02 -5.705172e-02 -1.272795e-02 -6.366367e-02 [31] -1.059964e-01 -1.371086e-01 -1.118245e-01 6.498537e-02 -4.987277e-02 [36] -2.927578e-03 1.683741e-01 1.385023e-02 3.429755e-02 -6.156336e-02 [41] -6.215744e-02 -8.772499e-02 -5.362508e-02 -5.906059e-02 -9.255625e-02 [46] -3.115655e-02 4.819789e-02 -4.300916e-02 1.386130e-01 > (mypacf <- c(rpacf$acf)) [1] 0.011772523 0.100338716 0.269603042 -0.133787134 -0.133751200 [6] -0.028134613 0.009669180 -0.003948196 0.043811523 0.020952189 [11] -0.005223983 0.205478293 0.026165958 -0.033840958 -0.063560753 [16] -0.160436419 -0.195538961 0.068855449 -0.138868268 0.031791968 [21] -0.053365196 0.048378968 -0.004863810 0.114821857 0.024101363 [26] 0.063901934 -0.190145861 0.044360143 0.020989303 -0.027534225 [31] -0.104173062 -0.131677284 0.106457809 0.007038315 -0.031286044 [36] -0.020540188 0.032493070 -0.080771829 -0.099114522 -0.065061223 [41] 0.032354288 0.045987249 0.044100331 -0.100496749 -0.009995349 [46] 0.021831319 -0.027405422 0.023887242 > 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/4v9xr1445678338.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/5zrca1445678338.tab") > > try(system("convert tmp/18lpg1445678338.ps tmp/18lpg1445678338.png",intern=TRUE)) character(0) > try(system("convert tmp/2n8881445678338.ps tmp/2n8881445678338.png",intern=TRUE)) character(0) > try(system("convert tmp/3pjee1445678338.ps tmp/3pjee1445678338.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.129 0.192 1.338