R version 2.13.0 (2011-04-13) Copyright (C) 2011 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(500,510,590,490,540,530,550,510,390,480,530,690,570,460,540,510,520,520,580,480,410,530,540,670,570,400,510,570,470,640,650,500,340,450,600,680,630,480,400,520,470,610,670,500,290,470,660,650,570,500,400,500,340,530,680,480,340,460,630,650,550,470,240,430,390,570,700,620,280,480,560,560,560,550,140,380,390,500,750,680,280,360,590,580,490,610,170,320,440,510,770,660,300,350,580,620,490,640,150,290,370,560,780,690,310,280,590,590) > par8 = '' > par7 = '0.95' > par6 = 'White Noise' > par5 = '12' > par4 = '0' > par3 = '0' > par2 = '1' > par1 = '60' > #'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/wessaorg/rcomp/tmp/1d1ir1312927824.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/2mr2p1312927824.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/38l4l1312927824.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.248040501 -0.352495456 -0.437854826 -0.259773744 [6] 0.129399243 0.524694365 0.212476646 -0.223280652 -0.366626644 [11] -0.287484817 0.142840416 0.793791077 0.280305416 -0.307912414 [16] -0.379628225 -0.221834825 0.027540090 0.432582322 0.266629143 [21] -0.140924814 -0.341245389 -0.248628676 0.065004706 0.617049048 [26] 0.294553248 -0.259056652 -0.344200440 -0.195445523 -0.033743697 [31] 0.327844748 0.282102600 -0.055048797 -0.298786230 -0.227798600 [36] -0.003200667 0.420280829 0.276033584 -0.174319428 -0.296404623 [41] -0.178632662 -0.073383431 0.209593364 0.287173218 0.023104187 [46] -0.240251226 -0.212332130 -0.044979256 0.266653004 0.230828636 [51] -0.133066931 -0.255752962 -0.124275561 -0.055648357 0.146445189 [56] 0.237945066 0.048520375 -0.201798304 -0.201440793 -0.058825977 [61] 0.161784684 > (mypacf <- c(rpacf$acf)) [1] 0.248040501 -0.441161614 -0.267817564 -0.299765593 -0.032315916 [6] 0.312033166 -0.058704379 -0.010339396 -0.090894456 -0.192189462 [11] 0.096140483 0.682583074 -0.088604220 0.152763957 0.217837510 [16] 0.091344416 -0.073196889 -0.023011399 0.024658960 0.052019274 [21] -0.189617394 0.012174964 -0.004056890 -0.046911911 -0.060469183 [26] -0.058018386 0.004220031 -0.063437295 -0.078628745 -0.063778087 [31] -0.059346066 0.023381861 -0.024116857 -0.038406399 -0.011488154 [36] -0.141631266 -0.012511505 -0.045707460 -0.082207866 -0.052174513 [41] -0.024415494 -0.115277124 0.048655020 -0.061909497 0.078870427 [46] 0.021212258 0.035825157 0.057134060 0.014911668 -0.138317911 [51] 0.010348387 0.039832418 0.003930037 0.066439556 -0.041470587 [56] 0.067981738 -0.010279786 -0.065481479 -0.003710403 -0.021087461 > 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/4577q1312927824.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/5jtho1312927824.tab") > > try(system("convert tmp/1d1ir1312927824.ps tmp/1d1ir1312927824.png",intern=TRUE)) character(0) > try(system("convert tmp/2mr2p1312927824.ps tmp/2mr2p1312927824.png",intern=TRUE)) character(0) > try(system("convert tmp/38l4l1312927824.ps tmp/38l4l1312927824.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.076 0.199 1.273