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(111.5,108.1,124.5,106.3,111.1,121.3,116.5,117.4,123.6,98.4,107.2,118.9,111.9,115.2,124.4,104.6,117,126.2,117.5,122.2,124.1,105.8,107.5,125.6,112.1,120.1,130.6,109.8,122.1,129.5,132.1,133.3,128.4,114.7,114.1,136.9,123.4,134,137,127.8,140.1,140.4,157.8,151.8,141.1,138.8,141.1,139.5,150.7,144.4,146,143.6,143.1,156.4,164.8,145.1,153.4,133.2,131.4,145.9) > par7 = '0.95' > par6 = 'White Noise' > par5 = '12' > par4 = '1' > par3 = '1' > par2 = '0.4' > 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/1m6161259782489.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/28rfh1259782489.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.582351120 -0.074622610 0.442496060 -0.373511321 [6] 0.106678780 0.146024546 -0.247532873 0.174620666 -0.002725889 [11] -0.153652850 0.194727716 -0.102911715 -0.119510832 0.199057245 [16] -0.089502428 -0.054336334 0.069821046 -0.003669911 -0.068572091 [21] 0.080280686 -0.012225355 -0.112390836 0.181497111 -0.128466589 [26] 0.017796205 0.050551087 -0.008456170 -0.101408046 0.098563877 [31] 0.024185611 -0.105398620 0.068232790 0.038663514 -0.110035335 [36] 0.117138939 -0.077738845 > (mypacf <- c(rpacf$acf)) [1] -0.582351120 -0.626079572 0.018003170 0.013839133 0.082747875 [6] 0.100319834 -0.031957847 -0.009217874 0.014595899 -0.059885054 [11] 0.020605577 0.008042076 -0.199567667 -0.201764200 -0.033300812 [16] 0.085022531 -0.037143771 0.016980955 -0.065349352 -0.018261700 [21] 0.067833851 -0.098480914 0.019528576 -0.038378639 0.013879935 [26] -0.132498954 0.122219018 -0.077605489 -0.164702656 -0.030213626 [31] 0.069839831 0.003826706 0.075289886 -0.045874949 0.002449572 [36] -0.046289331 > 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/3xwky1259782489.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/41nrj1259782489.tab") > system("convert tmp/1m6161259782489.ps tmp/1m6161259782489.png") > system("convert tmp/28rfh1259782489.ps tmp/28rfh1259782489.png") > > > proc.time() user system elapsed 0.549 0.323 0.651