R version 2.11.1 (2010-05-31) Copyright (C) 2010 The R Foundation for Statistical Computing ISBN 3-900051-07-0 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(257,256,255,253,251,250,251,253,254,254,255,257,260,251,255,252,245,239,240,247,251,255,259,260,259,266,261,243,232,225,229,238,240,241,239,246,242,251,246,219,203,192,197,203,208,207,208,212,208,215,200,170,162,150,148,152,155,150,146,147,142,146,130,102,98,90,86,104,108,94,88,92,93,95,81,50,49,34,27,45,47,42,32) > 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: Prof. Dr. P. Wessa > #To cite this work: AUTHOR(S), (YEAR), 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: Office for Research, Development, and Education > #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 (par2 == 0) { + x <- log(x) + } else { + x <- (x ^ par2 - 1) / par2 + } > 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/1kl0s1281972108.ps",horizontal=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=paste('(lambda=',par2,', d=',par3,', D=',par4,', CI=', par7, ', CI type=',par6,')',sep='')) > dev.off() null device 1 > postscript(file="/var/www/rcomp/tmp/2cczd1281972108.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > rpacf <- pacf(x,par1,main='Partial Autocorrelation',xlab='lags',ylab='PACF') > dev.off() null device 1 > (myacf <- c(racf$acf)) [1] 1.000000000 0.959885889 0.917227619 0.875994525 0.834358129 [6] 0.790439798 0.749667835 0.711898124 0.674020593 0.649322803 [11] 0.629728150 0.608456728 0.580388481 0.538157577 0.494552555 [16] 0.454423494 0.413273465 0.370342658 0.330786759 0.292424726 [21] 0.254356708 0.227510947 0.205866762 0.180365112 0.150730636 [26] 0.112350135 0.071098494 0.032014465 -0.004992131 -0.038420541 [31] -0.069206725 -0.097941752 -0.124762570 -0.139642281 -0.148788106 [36] -0.161589585 -0.178014232 -0.200233205 -0.226356810 -0.251463712 [41] -0.272920396 -0.291282383 -0.309432806 -0.325753257 -0.337179205 [46] -0.338683465 -0.337849054 -0.341256250 -0.345785573 -0.354550427 [51] -0.364968066 -0.373497558 -0.377153680 -0.381514130 -0.385298060 [56] -0.386422414 -0.383976258 -0.375335219 -0.364163825 -0.355164306 [61] -0.346712953 > (mypacf <- c(rpacf$acf)) [1] 0.959885889 -0.052828160 -0.003086975 -0.028284518 -0.051138207 [6] 0.017312844 0.011515636 -0.024171093 0.147933984 0.036356128 [11] -0.034219432 -0.098688847 -0.212935240 -0.035333202 0.032315147 [16] -0.029201710 -0.010326729 0.019057866 -0.034727917 -0.049318926 [21] 0.050785987 0.012096576 -0.040613668 -0.044105309 -0.134733088 [26] -0.063404220 -0.002140674 -0.001028159 0.064405211 0.017919797 [31] -0.029747639 -0.041579213 0.038394214 0.013373469 -0.023964528 [36] -0.028447994 -0.070626334 -0.059249414 -0.019312044 0.002899058 [41] 0.051521945 0.005252241 -0.029465562 -0.013603533 0.010789675 [46] -0.035138812 -0.039305108 0.006561067 -0.032246604 -0.007504116 [51] -0.006162581 0.016118132 -0.003188569 0.009056130 -0.023861941 [56] -0.022184715 -0.003590753 -0.007601412 -0.009157879 0.024837584 > 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/3yvyj1281972108.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/41df71281972108.tab") > > try(system("convert tmp/1kl0s1281972108.ps tmp/1kl0s1281972108.png",intern=TRUE)) character(0) > try(system("convert tmp/2cczd1281972108.ps tmp/2cczd1281972108.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 0.810 0.520 1.305