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(3441,3431,3420,3400,3606,3596,3441,3338,3348,3348,3358,3379,3441,3472,3524,3565,3751,3730,3575,3348,3389,3431,3420,3472,3431,3503,3534,3544,3772,3730,3575,3348,3389,3358,3410,3524,3513,3493,3544,3575,3751,3761,3575,3307,3286,3348,3296,3462,3462,3400,3482,3534,3710,3761,3544,3286,3286,3203,3141,3276,3224,3100,3183,3255,3472,3555,3327,3162,3162,3100,3059,3141,3038,3017,3069,3141,3358,3400,3131,2935,2842,2749,2697,2800,2738,2749,2800,2842,3048,3079,2749,2594,2439,2335,2263,2366,2315,2397,2428,2459,2594,2676,2263,2160,1901,1736,1684,1829,1746,1850,1850,1860,1984,2067,1664,1519,1281,1126,1044,1250) > 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/1dj1u1471292913.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/2bqcn1471292913.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/3xbdb1471292913.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.948779869 0.879436621 0.814495630 0.759709609 [6] 0.719604803 0.693065109 0.678794590 0.669127578 0.661730297 [11] 0.658531308 0.657287044 0.641913737 0.596168859 0.534552622 [16] 0.475851969 0.427385934 0.395079984 0.373101925 0.364504783 [21] 0.359279608 0.353557772 0.351009846 0.351060046 0.338360667 [26] 0.301108640 0.250411135 0.203463812 0.164174587 0.137390802 [31] 0.121583542 0.116939590 0.115499376 0.109953438 0.107805359 [36] 0.108222833 0.098717335 0.070150037 0.030068594 -0.007876783 [41] -0.039851953 -0.061315876 -0.072496158 -0.073227482 -0.071591194 [46] -0.074850366 -0.076155251 -0.073330946 -0.078496995 > (mypacf <- c(rpacf$acf)) [1] 0.948779869 -0.207847038 0.040616840 0.048489255 0.091802891 [6] 0.079412686 0.090818543 0.031391004 0.047925177 0.077342267 [11] 0.050770272 -0.114180504 -0.251546815 -0.099151128 0.007532150 [16] 0.006735655 0.040231950 -0.030371270 0.069823602 0.004967388 [21] 0.020340626 0.049190748 0.051379836 -0.066629475 -0.127502037 [26] -0.050436142 0.022212336 -0.033561347 -0.009046401 -0.025887525 [31] 0.024294365 0.005977974 -0.021231280 0.042968250 0.034103318 [36] -0.033353301 -0.060534378 -0.032119664 0.004596280 -0.033753839 [41] -0.011393250 -0.028953668 0.012640957 -0.007778690 -0.021701714 [46] 0.017905846 0.041841656 -0.025928288 > 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/4qov41471292913.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/5kpgv1471292913.tab") > > try(system("convert tmp/1dj1u1471292913.ps tmp/1dj1u1471292913.png",intern=TRUE)) character(0) > try(system("convert tmp/2bqcn1471292913.ps tmp/2bqcn1471292913.png",intern=TRUE)) character(0) > try(system("convert tmp/3xbdb1471292913.ps tmp/3xbdb1471292913.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.222 0.115 1.354