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(6,5,2,3,-2,-4,0,1,4,-3,-3,0,6,-1,0,-1,1,-4,-1,-1,0,3,0,8,8,8,8,11,13,5,12,13,9,11,7,12,11,10,13,14,10,13,12,13,17,15,6,9,6,11,12,13,11,16,16,19,14,15,12,14,16,13,13,15,12,13,12,15,10,8,11,8) > 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: 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/17pw51260188325.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/2l6b01260188325.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.00000000 0.83331442 0.79462884 0.75645390 0.73602364 0.68686998 [7] 0.62218440 0.57188180 0.54570686 0.49757447 0.47242080 0.44343735 [13] 0.43424113 0.36049173 0.31048700 0.26792908 0.22758392 0.16072813 [19] 0.10157447 0.05710165 0.02160757 -0.03520567 -0.05478487 -0.06151300 [25] -0.07232624 -0.09411820 -0.11450591 -0.10157447 -0.12251537 -0.11864775 [31] -0.14733333 -0.17146572 -0.17385343 -0.22602837 -0.27433097 -0.27467612 [37] -0.28548936 -0.28060047 -0.32383924 -0.30895035 -0.33814657 -0.32406619 [43] -0.30951773 -0.31062884 -0.32935697 -0.34685106 -0.34617494 -0.33132861 [49] -0.34392908 > (mypacf <- c(rpacf$acf)) [1] 0.833314421 0.327945537 0.139900996 0.120324180 -0.028599332 [6] -0.121092609 -0.066620792 0.038312651 -0.031473908 0.057472084 [11] 0.043229748 0.072187005 -0.189922274 -0.129504914 -0.070796829 [16] -0.054749746 -0.093429431 -0.038973953 0.008183029 -0.001576639 [21] -0.063311937 0.048370533 0.094971785 0.031819554 0.026535247 [26] -0.015853708 0.065969064 -0.069766246 0.078605148 -0.050028649 [31] -0.095958727 0.005823798 -0.164051183 -0.225911256 -0.013554621 [36] 0.025943294 0.088422538 -0.094764981 0.029776730 -0.153063567 [41] -0.019026334 0.129708362 0.069609145 -0.024335234 -0.013482626 [46] 0.067769451 0.002377032 -0.041698746 > 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/3i2uo1260188325.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/4stbz1260188325.tab") > > system("convert tmp/17pw51260188325.ps tmp/17pw51260188325.png") > system("convert tmp/2l6b01260188325.ps tmp/2l6b01260188325.png") > > > proc.time() user system elapsed 0.560 0.318 0.684