R version 2.12.1 (2010-12-16) 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(17.1,13.4,15.3,14,9.7,13.7,13.7,12.5,9.8,7,-1.9,-2.9,-6.8,-10.4,-17.2,-19.8,-16.8,-23.2,-21.7,-17.6,-13,-12.6,-4,-0.2,3.1,6.5,19.2,26.6,26.6,31.4,31.2,26.4,20.7,20.7,15,13.3,8.7,10.2,4.3,-0.1,-4.6,-3.9,-3.5,-3.4,-2.5,-1.1,0.3,-0.9,3.6,2.7,-0.2,-1,5.8,6.4,9.6,13.2,10.6,10.9,12.9,15.9,12.2,9.1,9,17.4,14.7,17,13.7,9.5,14.8,13.6,12.6,8.9,10.2,12.7,16,10.4,9.9,9.5,8.6,10,3.5,-4.2,-4.4,-1.5,-0.1,0.8,-2.4,-1.2,0.2,-1.9,-1.6,-4.2,-2.2,6.2,5.7,3.1,1.1,-0.9,0.1,-4,-4,-5.3,-8,-6.3,-3.6,-3.5,-5.1,-3.3) > 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.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/1woq51302622904.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/2cj111302622904.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/3sz6e1302622904.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.228316899 0.130998013 0.170077016 0.221880904 [6] 0.088513700 0.052733223 -0.045962839 -0.178945397 -0.147810602 [11] -0.077887415 0.053428689 -0.576804172 -0.293573576 -0.152666616 [16] -0.073086463 -0.197210344 -0.112029271 -0.174589078 0.024285722 [21] 0.094175194 0.078566193 0.092137680 -0.153628665 0.097094806 [26] 0.113693956 0.116864347 -0.044600111 0.099811749 0.024155116 [31] 0.198538268 0.030083638 0.016572607 0.021136780 -0.094519549 [36] 0.064779013 0.052309262 0.021600007 -0.095632646 0.084496982 [41] -0.039330254 0.068681666 -0.039405979 -0.004073419 -0.064730945 [46] -0.056220049 0.057334355 0.040483480 -0.030899592 > (mypacf <- c(rpacf$acf)) [1] 0.228316899 0.083206864 0.131369266 0.163067669 -0.009865848 [6] -0.010986145 -0.118452017 -0.222229233 -0.108917456 -0.006069357 [11] 0.194424589 -0.588482847 -0.041682036 -0.024796393 0.103860684 [16] -0.028658824 -0.034574418 -0.125170325 0.176637130 -0.044845752 [21] -0.060198357 -0.006296630 -0.048488047 -0.293168733 -0.107517018 [26] -0.014705707 0.048175175 0.096874290 -0.043396514 -0.005251515 [31] 0.003459853 0.051186930 -0.007669501 -0.090030209 -0.043177007 [36] -0.076432760 0.003816648 -0.022151794 0.041490015 -0.009002030 [41] -0.006526294 0.119342762 -0.004371879 -0.032528614 0.017181857 [46] 0.037423203 0.033532705 -0.038458580 > 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/46nqq1302622904.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/5t53s1302622904.tab") > > try(system("convert tmp/1woq51302622904.ps tmp/1woq51302622904.png",intern=TRUE)) character(0) > try(system("convert tmp/2cj111302622904.ps tmp/2cj111302622904.png",intern=TRUE)) character(0) > try(system("convert tmp/3sz6e1302622904.ps tmp/3sz6e1302622904.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.336 0.228 1.537