R version 3.0.1 (2013-05-16) -- "Good Sport" Copyright (C) 2013 The R Foundation for Statistical Computing Platform: i686-pc-linux-gnu (32-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(3207324 + ,3178086 + ,3148485 + ,3087246 + ,3693267 + ,3661164 + ,3207324 + ,2905563 + ,2934699 + ,2934699 + ,2967168 + ,3025542 + ,3207324 + ,3148485 + ,3239325 + ,3388641 + ,4238049 + ,4238049 + ,4056732 + ,3874950 + ,4024266 + ,4205949 + ,4238049 + ,4328892 + ,4601499 + ,4419732 + ,4419732 + ,4692342 + ,5448042 + ,5509281 + ,5357202 + ,4993734 + ,5266260 + ,5266260 + ,5295495 + ,5448042 + ,5568120 + ,5629359 + ,5629359 + ,5811042 + ,6508356 + ,6689670 + ,6718809 + ,6264966 + ,6508356 + ,6417513 + ,6235746 + ,6628434 + ,6718809 + ,6566727 + ,6598830 + ,6809748 + ,7597920 + ,7990056 + ,7990056 + ,7808739 + ,8080980 + ,7808739 + ,7656276 + ,8233527 + ,8323902 + ,8110134 + ,8654901 + ,8868684 + ,9504309 + ,9926133 + ,9867774 + ,9835290 + ,10078677 + ,10049076 + ,9686076 + ,10230759 + ,10412541 + ,10230759 + ,10986462 + ,11349927 + ,12196086 + ,12529950 + ,12439476 + ,12257691 + ,12409872 + ,12591555 + ,11985168 + ,12468612 + ,12773337 + ,12650394 + ,13438098 + ,13710240 + ,14861511 + ,15072414 + ,14800254 + ,14952351 + ,15043194 + ,15134034 + ,14556783 + ,15101568 + ,15403311 + ,15101568 + ,15980562 + ,16252821 + ,17433111 + ,17614893 + ,17673267 + ,17977893 + ,17977893 + ,18097971 + ,17553189 + ,17825814 + ,18007131 + ,17673267 + ,18642738 + ,18824436 + ,20034063 + ,20247849 + ,20549592 + ,20822217 + ,20851353 + ,20883456 + ,20338689 + ,20883456) > 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/fisher/rcomp/tmp/17mg41375885045.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/fisher/rcomp/tmp/2dy2l1375885045.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/fisher/rcomp/tmp/3av071375885045.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.014627538 0.026441646 0.001125607 -0.087592959 [6] 0.001834961 -0.362899446 0.033218804 -0.126056968 -0.022567074 [11] -0.025881403 0.001208248 0.803769798 -0.013925517 0.014578615 [16] 0.034216775 -0.055765752 -0.021585196 -0.288233355 0.006725881 [21] -0.098668237 -0.057542921 -0.044120800 0.010874963 0.629390899 [26] 0.019927113 -0.007039695 0.054565957 -0.028791291 -0.048222396 [31] -0.225764027 -0.030162442 -0.053341211 -0.083726434 -0.038177132 [36] 0.030391258 0.470026054 0.033882764 -0.043313378 0.066467794 [41] -0.013455840 -0.070123594 -0.172479742 -0.032952075 -0.015019817 [46] -0.123415042 -0.026287951 0.044058023 0.337294871 > (mypacf <- c(rpacf$acf)) [1] -0.0146275383 0.0262332946 0.0018876682 -0.0883236036 -0.0007496097 [6] -0.3611883633 0.0266979821 -0.1438999238 -0.0270045666 -0.1106655651 [11] 0.0023990488 0.7698327667 0.0390939015 -0.1573680049 0.0358486047 [16] 0.0104583902 -0.0123055934 0.1507170228 -0.1311303408 0.0779154097 [21] 0.0041514928 -0.0097240833 0.0163749853 -0.0315010816 0.0572212812 [26] 0.0271353152 -0.0780977096 0.0477130704 -0.0469664509 -0.0119353069 [31] -0.0141643151 0.0325285185 0.0063954014 0.0501223150 0.0115443301 [36] -0.0655487829 -0.0572057315 -0.0205671810 -0.0169940666 0.0218083592 [41] -0.0292113822 -0.0073903204 0.0652325023 -0.0014718264 -0.0984054964 [46] 0.0101432752 0.0052426367 -0.0250303416 > lengthx <- length(x) > sqrtn <- sqrt(lengthx) > > #Note: the /var/fisher/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/fisher/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/fisher/rcomp/tmp/4jl1w1375885045.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/fisher/rcomp/tmp/5gc5y1375885045.tab") > > try(system("convert tmp/17mg41375885045.ps tmp/17mg41375885045.png",intern=TRUE)) character(0) > try(system("convert tmp/2dy2l1375885045.ps tmp/2dy2l1375885045.png",intern=TRUE)) character(0) > try(system("convert tmp/3av071375885045.ps tmp/3av071375885045.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.820 0.491 2.290