R version 2.9.0 (2009-04-17) Copyright (C) 2009 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(99.026,101.851,99.958,97.875,97.927,95.149,94.551,93.999,93.297,89.901,89.742,87.096,86.863,86.718,80.020,63.483,51.289,44.071,43.654,66.115,84.518,83.395,78.307,80.049,78.346,78.317,75.918,73.739,74.530,74.179,76.974,75.408,73.336,69.210,67.286,64.606,64.159,64.423,66.411,64.270,56.521,50.599,54.751,62.227,63.932,65.391,75.744,74.590,76.035,74.427,73.354,73.081,75.309,75.463,75.910,76.151,76.882,78.632,80.137,82.490,79.896,81.303,79.344,81.355,82.328,79.669,77.249,75.101,72.520,72.438,72.653,71.429,69.189,66.451,63.354,61.379,61.880,62.274,62.429,63.905,63.917,64.295,61.930,60.440,59.353,58.695,60.569,60.386,60.938,61.795,63.304,64.270,63.492,61.333,59.341,58.412,58.725,59.277,58.562,57.858,58.790,58.243,57.044,57.339,59.429,60.575,61.950,61.712) > par7 = '0.95' > par6 = 'White Noise' > par5 = '12' > par4 = '0' > par3 = '0' > par2 = '1' > par1 = '36' > #'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/html/rcomp/tmp/1kahi1260467448.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/html/rcomp/tmp/2bgif1260467448.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.915362200 0.768957482 0.627354368 0.515237515 [6] 0.433857068 0.381472482 0.331375164 0.277565504 0.223639864 [11] 0.170837549 0.115139209 0.061130005 0.008550720 -0.038277308 [16] -0.058040137 -0.040688867 0.002279663 0.056752535 0.097530862 [21] 0.092233141 0.064827066 0.060358950 0.070956841 0.064644575 [26] 0.044480639 0.010627172 -0.033701647 -0.082151765 -0.120890202 [31] -0.149781778 -0.168571892 -0.172639909 -0.172476033 -0.172620724 [36] -0.173045572 -0.168986182 > (mypacf <- c(rpacf$acf)) [1] 0.915362200 -0.425202672 0.100938087 0.043404182 0.027897436 [6] 0.063363390 -0.112780539 0.003628202 -0.009325820 -0.038414929 [11] -0.061296339 -0.027823431 -0.050927097 -0.009174878 0.124811026 [16] 0.101813190 0.061800346 0.067859533 -0.054584595 -0.180906462 [21] 0.080882831 0.167985285 -0.088938212 -0.190963132 -0.014623857 [26] -0.053372364 -0.043087259 -0.092932556 0.009501415 0.034105432 [31] 0.028397506 0.086896176 -0.024311214 -0.029373810 -0.058116052 [36] 0.051326942 > lengthx <- length(x) > sqrtn <- sqrt(lengthx) > > #Note: the /var/www/html/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/html/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/html/rcomp/tmp/30w421260467448.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/html/rcomp/tmp/4wedd1260467448.tab") > > system("convert tmp/1kahi1260467448.ps tmp/1kahi1260467448.png") > system("convert tmp/2bgif1260467448.ps tmp/2bgif1260467448.png") > > > proc.time() user system elapsed 0.555 0.319 0.703