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(2421.21,2378.63,2336.00,2250.79,3113.00,3070.38,2421.21,1990.13,2032.71,2032.71,2075.33,2165.17,1904.92,1644.25,1430.79,1430.79,2250.79,2336.00,1686.83,952.46,1340.96,1340.96,1644.25,1819.29,1776.67,1340.96,1559.04,1473.42,2207.79,2032.71,1340.96,824.25,1298.33,1430.79,1559.04,1729.46,1383.54,1084.92,1213.17,1255.75,2378.63,2378.63,1729.46,1644.25,1904.92,1776.67,2122.58,2553.67,2639.29,2032.71,1861.88,1686.83,2856.96,2942.58,2724.50,2942.58,2899.54,2553.67,2942.58,3373.67,3548.71,3027.79,2681.88,2942.58,4065.42,4411.33,4326.13,4496.50,4453.92,4022.83,4757.21,4932.25,5188.29,4411.33,4108.04,4453.92,5278.13,6012.50,5837.46,5837.46,5923.08,5624.00,6401.42,6401.42,6268.96,5534.17,5666.63,5752.25,6315.79,7050.17,6529.21,6789.92,6571.83,6444.00,7439.08,7221.00,6917.71,6486.63,6917.71,7135.79,7396.04,7741.92,7396.04,7609.50,7349.21,7306.63,8386.88,8476.71,8130.83,7524.29,8041.00,8258.67,8519.33,8907.83,8519.33,8822.63,8690.17,8216.04,9211.08,9211.08) > 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.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/1585o1471082458.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/2baee1471082458.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/346xi1471082458.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.018817162 -0.301952623 -0.309553033 -0.140991371 [6] 0.190834813 0.300910041 0.175894029 -0.089058094 -0.332197134 [11] -0.286088182 0.065212377 0.798031953 0.003690066 -0.253092162 [16] -0.244858939 -0.117946955 0.127764365 0.273749706 0.152461780 [21] -0.087045642 -0.325780326 -0.188679089 0.079851908 0.605594256 [26] -0.041288989 -0.189746818 -0.144887361 -0.140570770 0.033676993 [31] 0.280724676 0.155507581 -0.050021505 -0.330089847 -0.180604957 [36] 0.077280132 0.424386839 -0.026096694 -0.115720730 -0.068791991 [41] -0.163472390 -0.056719889 0.274980398 0.183469987 -0.016885356 [46] -0.316521547 -0.159941038 0.038161298 0.317646267 > (mypacf <- c(rpacf$acf)) [1] 0.018817162 -0.302413789 -0.326419722 -0.304045775 -0.070775258 [6] 0.095369585 0.211232776 0.185050332 -0.031131839 -0.240332976 [11] -0.235165155 0.676210209 -0.030312746 0.081387166 0.126619901 [16] 0.182844689 -0.102569296 0.015195554 -0.035663302 -0.122820855 [21] -0.095902393 0.175433204 -0.048514450 -0.064559677 -0.054794774 [26] 0.100361272 0.054769329 -0.125404094 -0.166682602 0.074829406 [31] 0.059927924 0.106192716 -0.059266498 -0.134827670 -0.082750890 [36] -0.121370239 0.009596691 -0.133512957 -0.005239048 0.023999121 [41] 0.085497733 0.061593205 0.090511026 -0.034850670 -0.019567357 [46] 0.039176345 -0.023387350 -0.016668018 > 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/4euoh1471082458.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/56jzk1471082459.tab") > > try(system("convert tmp/1585o1471082458.ps tmp/1585o1471082458.png",intern=TRUE)) character(0) > try(system("convert tmp/2baee1471082458.ps tmp/2baee1471082458.png",intern=TRUE)) character(0) > try(system("convert tmp/346xi1471082458.ps tmp/346xi1471082458.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.452 0.118 1.601