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(2465,1932,1993,2243,1758,1806,2063,1823,2137,2428,2139,2265,2615,2070,2794,2190,2434,2520,2063,2068,2537,1898,2139,2408,2725,2201,2311,2548,2276,2351,2280,2057,2479,2379,2295,2456,2546,2844,2260,2981,2678,3440,2842,2450,2669,2570,2540,2318,2930,2946,2799,2695,2498,2260,2160,2058,2533,2150,2172,2155,3016) > par7 = '0.95' > par6 = 'MA' > par5 = '12' > par4 = '1' > 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/1rn691259260029.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/2gch61259260029.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.339962300 0.397767503 0.246815771 0.204900574 [6] 0.050914229 0.095492176 0.005626267 0.011983555 -0.092176076 [11] -0.116740631 -0.152623796 -0.416136207 -0.202957575 -0.240483384 [16] -0.197076760 -0.232177685 -0.060083193 -0.123254276 -0.061195006 [21] -0.134874159 0.017867222 -0.028560228 0.129161718 0.052545718 [26] 0.196043790 0.103803966 0.173410882 0.107232554 0.077023559 [31] 0.060444432 0.065437848 0.142570041 0.039471577 0.011891418 [36] -0.054887007 -0.036122277 > (mypacf <- c(rpacf$acf)) [1] 0.339962300 0.319069379 0.058239561 0.013893581 -0.118292792 [6] 0.030483055 -0.021585239 -0.008635706 -0.103930709 -0.103433350 [11] -0.052788809 -0.375969579 0.069267203 0.057639902 -0.006506334 [16] -0.092078362 0.062471734 0.025652689 -0.038303410 -0.098943339 [21] 0.049541480 0.021674443 0.128584131 -0.190670093 0.131449852 [26] 0.010941416 0.016350249 -0.091007832 -0.016272168 0.042354746 [31] -0.032258926 0.089340248 -0.018706099 -0.092995963 0.002303038 [36] -0.110689351 > 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/3cp0l1259260029.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/45vx01259260029.tab") > system("convert tmp/1rn691259260029.ps tmp/1rn691259260029.png") > system("convert tmp/2gch61259260029.ps tmp/2gch61259260029.png") > > > proc.time() user system elapsed 0.565 0.321 0.813