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(85.13,85.54,85.47,85.78,86.07,86.05,86.32,86.43,86.41,86.38,86.59,86.68,86.87,87.32,87.13,87.42,87.22,87.17,87.52,87.49,87.53,87.93,88.54,88.96,89.3,90.01,90.52,90.64,91.25,91.59,92.09,91.81,92.03,92.15,91.98,92.11,92.28,92.53,91.97,92.05,91.87,91.49,91.48,91.63,91.46,91.61,91.7,91.87,92.21,92.65,92.83,93.02,93.33,93.35,93.45,93.51,93.8,93.94,94.02,94.26,94.71,95.26,95.54,95.69,96.03,96.4,96.55,96.45,96.65,96.84,97.21,97.31,97.91,98.51,98.54,98.52,98.66,98.53,98.71,98.92,98.96,99.25,99.32,99.41,99.36,99.58,99.77,99.77,100.03,100.2,100.24,100.1,100.03,100.18,100.29,100.41,100.6,100.75,100.79,100.44,100.29,100.34,100.46,100.12,100.06,100.28,100.28,100.4) > 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/13anv1445590509.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/2crvw1445590509.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/3dzyu1445590509.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.976346304 0.953046544 0.928315832 0.903728361 [6] 0.878803997 0.852149309 0.825983135 0.799227083 0.771244034 [11] 0.741492105 0.711853446 0.682194565 0.652773570 0.624534353 [16] 0.595407024 0.566957677 0.537286586 0.506391991 0.476358753 [21] 0.446119624 0.416019973 0.386528977 0.358651062 0.332004748 [26] 0.305230454 0.280256470 0.256511082 0.233257234 0.211728634 [31] 0.191249452 0.172515442 0.152218631 0.132525603 0.112504106 [36] 0.091533854 0.071953224 0.053418397 0.035356662 0.015910752 [41] -0.003383913 -0.023305127 -0.045144648 -0.067175077 -0.088385709 [46] -0.109977424 -0.131257309 -0.152273281 -0.171959149 > (mypacf <- c(rpacf$acf)) [1] 0.976346304 -0.004397219 -0.042485246 -0.010218778 -0.019189371 [6] -0.050638226 -0.004121169 -0.024727635 -0.042305683 -0.053214228 [11] -0.012892612 -0.016631333 -0.012027771 0.009811755 -0.034230193 [16] -0.005932730 -0.041590770 -0.046087432 -0.001379449 -0.022020369 [21] -0.021293676 -0.006864443 0.013768794 0.005547996 -0.022577351 [26] 0.020618824 0.008597076 -0.014360224 0.017563411 0.002394274 [31] 0.012506212 -0.054408156 -0.010849008 -0.025455305 -0.045684524 [36] 0.006789443 0.006388738 -0.016201179 -0.051156686 -0.020364882 [41] -0.032514487 -0.065557666 -0.030505417 -0.001280158 -0.039947989 [46] -0.019984453 -0.017985219 0.007353327 > 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/4bjv21445590509.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/5t2581445590509.tab") > > try(system("convert tmp/13anv1445590509.ps tmp/13anv1445590509.png",intern=TRUE)) character(0) > try(system("convert tmp/2crvw1445590509.ps tmp/2crvw1445590509.png",intern=TRUE)) character(0) > try(system("convert tmp/3dzyu1445590509.ps tmp/3dzyu1445590509.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.085 0.225 1.322