R version 2.12.0 (2010-10-15) Copyright (C) 2010 The R Foundation for Statistical Computing ISBN 3-900051-07-0 Platform: i486-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(5745,4549,5074,3602,2732,2589,2148,2330,2752,3241,4517,6550,6778,6240,5570,3558,3299,2447,2380,2378,2947,3651,4816,6436,7090,4682,4198,3860,3056,2563,2568,2472,2821,4015,4686,5418,5649,4572,4695,3766,2900,2528,2549,2478,2828,4139,5390,5621,5291,5272,4677,3520,2842,2723,2581,2429,2606,3787,4630,5505) > 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.0.44 () > #Author: Dr. Ian E. Holliday > #To cite this work: Ian E. Holliday, 2009, YOUR SOFTWARE TITLE (vNUMBER) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_YOURPAGE.wasp/ > #Source of accompanying publication: > #Technical description: > 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/www/rcomp/tmp/1x4kp1292666994.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/www/rcomp/tmp/28vja1292666994.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/www/rcomp/tmp/38vja1292666994.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.7765634974 0.4096087773 -0.0343939099 -0.4396543029 [6] -0.7125534562 -0.8040135139 -0.6939938091 -0.4017949422 0.0004383688 [11] 0.3990663076 0.6828512864 0.7521731922 0.5740989392 0.2704925839 [16] -0.0744360789 -0.3506257504 -0.5495581116 -0.5933902369 -0.4859988179 [21] -0.2662761439 0.0386904973 0.3368724743 0.5070412434 0.5272404284 [26] 0.3874614880 0.1860064505 -0.0532883843 -0.2688192375 -0.4035924267 [31] -0.4267738966 -0.3447903494 -0.1844025817 0.0428240185 0.2467192633 [36] 0.3755704611 0.3654783653 0.2452588124 0.1041595928 -0.0579324577 [41] -0.1941796271 -0.2668620735 -0.2739658280 -0.2094092442 -0.1015812880 [46] 0.0394698062 0.1405191594 0.1862193848 0.1670606539 > (mypacf <- c(rpacf$acf)) [1] 0.776563497 -0.487322106 -0.426375335 -0.315254706 -0.259244894 [6] -0.263718891 -0.214013377 -0.091333272 0.026627035 0.068174242 [11] 0.071630710 -0.073493289 -0.280133107 -0.059570993 0.031595454 [16] 0.191920645 -0.041574955 0.021245229 -0.045370551 -0.168183857 [21] -0.016843605 0.112035674 -0.018235724 0.050010786 -0.047215023 [26] 0.088960371 -0.082307421 -0.094282842 0.083545712 0.079624470 [31] 0.029001781 -0.092338703 0.040403488 -0.016915192 0.059483066 [36] -0.075033386 -0.132540167 0.038579241 0.068874115 0.001396753 [41] 0.075613434 -0.036788483 -0.011896660 -0.118208735 -0.076624511 [46] -0.137002533 -0.060059558 0.020976997 > lengthx <- length(x) > sqrtn <- sqrt(lengthx) > > #Note: the /var/www/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/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/www/rcomp/tmp/4m5hj1292666994.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/www/rcomp/tmp/5feg41292666994.tab") > > try(system("convert tmp/1x4kp1292666994.ps tmp/1x4kp1292666994.png",intern=TRUE)) character(0) > try(system("convert tmp/28vja1292666994.ps tmp/28vja1292666994.png",intern=TRUE)) character(0) > try(system("convert tmp/38vja1292666994.ps tmp/38vja1292666994.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 0.830 0.590 1.399