R version 3.0.2 (2013-09-25) -- "Frisbee Sailing" Copyright (C) 2013 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(1.464,1.474,1.479,1.517,1.575,1.627,1.613,1.558,1.545,1.406,1.269,1.191,1.231,1.276,1.281,1.312,1.363,1.419,1.374,1.422,1.378,1.38,1.409,1.398,1.445,1.452,1.506,1.531,1.524,1.52,1.499,1.491,1.496,1.493,1.507,1.569,1.593,1.597,1.633,1.686,1.683,1.646,1.658,1.636,1.67,1.634,1.618,1.622,1.688,1.723,1.776,1.809,1.754,1.714,1.733,1.783,1.818,1.81,1.764,1.73,1.742,1.785,1.769,1.743,1.721,1.73,1.753,1.764,1.758,1.7,1.678,1.688) > 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/18lda1418913015.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/24bio1418913015.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/3v8rm1418913015.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.4067201277 0.0773468088 -0.1395405780 -0.1426731293 [6] -0.1370329583 -0.2419528812 -0.1371698043 -0.1762211030 0.0002481908 [11] 0.0690623646 0.2287473519 0.1654881303 0.0410548771 -0.1017597870 [16] -0.1525223735 -0.0339025905 -0.0644925257 -0.0233881357 -0.0381481119 [21] 0.0134148329 0.0512332745 0.1498879788 0.1341943893 -0.0324632082 [26] -0.0925837050 -0.1171250766 -0.0473075580 -0.1381165982 -0.0937390014 [31] -0.0715778120 0.0584381933 0.0849968638 0.0129928356 0.0864655780 [36] 0.0704718654 0.0508119248 -0.0517079398 -0.0642514530 -0.0815156211 [41] -0.1347968787 -0.1210043865 0.0002741096 0.0585998438 0.0388966977 [46] -0.0420260024 -0.0506536677 -0.0308273226 0.0282512098 > (mypacf <- c(rpacf$acf)) [1] 0.4067201277 -0.1055316287 -0.1592143991 -0.0185157441 -0.0762321783 [6] -0.2268877510 0.0273024306 -0.1896204008 0.0710652112 0.0006367064 [11] 0.1583579717 -0.0566050564 -0.0232302924 -0.1535283062 -0.0150232344 [16] 0.0403358724 -0.0308324669 -0.0047166712 0.0194191587 -0.0423934037 [21] 0.0089343281 0.1013346387 -0.0218087745 -0.0961935505 0.0095786348 [26] -0.0159996606 -0.0143078196 -0.1452816381 -0.0048847016 -0.0576029366 [31] 0.0939279143 -0.0767974178 -0.0936595874 0.0459295781 0.0473388362 [36] -0.0427646766 0.0174285074 -0.0780889888 -0.0335039171 -0.0984932191 [41] -0.0482253500 0.0433333981 -0.0538879034 -0.0413008180 -0.1489558541 [46] -0.0326022654 -0.0939043016 0.0332613348 > 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/4judg1418913015.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/5g04d1418913015.tab") > > try(system("convert tmp/18lda1418913015.ps tmp/18lda1418913015.png",intern=TRUE)) character(0) > try(system("convert tmp/24bio1418913015.ps tmp/24bio1418913015.png",intern=TRUE)) character(0) > try(system("convert tmp/3v8rm1418913015.ps tmp/3v8rm1418913015.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.342 0.196 1.546