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(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,13,9,8,8,6,8,6,12,16) > 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/14iox1260379519.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/2kpzp1260379519.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.774743612 0.733172781 0.673216810 0.623270790 [6] 0.577672287 0.528283033 0.491853408 0.450969651 0.371846697 [11] 0.353754828 0.286643815 0.287470161 0.196181267 0.137552059 [16] 0.103906266 0.069016633 0.040014510 0.003454578 -0.004982724 [21] -0.030513941 -0.076420443 -0.063594003 -0.066629485 -0.076156627 [26] -0.064645104 -0.080344062 -0.063134567 -0.094873138 -0.091547267 [31] -0.117185099 -0.158969159 -0.176279186 -0.204404698 -0.252656727 [36] -0.220698843 -0.222336485 -0.221012604 -0.259136221 -0.214751783 [41] -0.278344505 -0.272684953 -0.288537910 -0.319873714 -0.313444166 [46] -0.325932832 -0.336632738 -0.279833591 -0.270075290 > (mypacf <- c(rpacf$acf)) [1] 0.774743612 0.332552068 0.102513518 0.039013584 0.019069160 [6] -0.011380750 0.010797858 -0.005717332 -0.128086466 0.036291413 [11] -0.071954283 0.088694446 -0.158796693 -0.106727426 0.001390595 [16] 0.018991980 0.010123783 -0.038220599 0.050170030 -0.025465860 [21] -0.040533504 0.052076622 0.057609248 -0.030791495 0.063424776 [26] -0.016909058 0.019087377 -0.093732524 -0.018533604 -0.079540855 [31] -0.142691411 -0.052499117 -0.036189205 -0.139675173 0.087406587 [36] 0.093128243 -0.009352225 -0.086250450 0.136800151 -0.141784850 [41] -0.002587208 -0.029714025 -0.089136130 0.016846004 -0.043953264 [46] -0.006280517 0.102868052 0.033507333 > 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/3klqp1260379519.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/437oi1260379519.tab") > > system("convert tmp/14iox1260379519.ps tmp/14iox1260379519.png") > system("convert tmp/2kpzp1260379519.ps tmp/2kpzp1260379519.png") > > > proc.time() user system elapsed 0.599 0.326 0.741