R version 2.11.1 (2010-05-31) Copyright (C) 2010 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(130,129,128,126,146,145,130,120,121,121,122,124,123,125,120,124,146,149,138,133,135,149,146,141,139,141,138,139,166,179,167,154,151,162,148,143,145,143,148,139,169,186,174,161,151,158,144,135,139,137,149,136,169,185,177,164,145,147,142,126,130,136,139,120,151,166,156,150,141,141,130,110,110,123,133,108,136,148,146,142,132,128,116,90,94,112,130,106,124,139,140,129,113,110,102,78,79,94,121,99,126,137,141,119,96,96,88,64,66,92,120,101,135,146,149,134,101,100,91,70) > 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/rcomp/tmp/1tgr51281700776.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/rcomp/tmp/2tgr51281700776.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.798110918 0.589938367 0.451038512 0.329357226 [6] 0.193332311 0.106851326 0.213246343 0.370025959 0.440805126 [11] 0.533451069 0.666974173 0.776135665 0.596015054 0.400402705 [16] 0.265613216 0.167126056 0.055050513 -0.024757567 0.061424603 [21] 0.196813962 0.249318374 0.298495077 0.378797278 0.466148590 [26] 0.322846171 0.151362198 0.028453403 -0.044754318 -0.126349488 [31] -0.200696575 -0.128673948 -0.008026872 0.041607916 0.067886470 [36] 0.119049354 0.190961034 0.075557072 -0.069505615 -0.175576418 [41] -0.231794790 -0.286982852 -0.351466028 -0.290524424 -0.173290956 [46] -0.124490103 -0.104997293 -0.066508039 -0.001774495 > (mypacf <- c(rpacf$acf)) [1] 0.798110918 -0.129587362 0.063355210 -0.060180821 -0.112702521 [6] 0.039620357 0.444119921 0.236971020 -0.005498725 0.237412960 [11] 0.279514608 0.325071994 -0.519570457 -0.011937030 -0.169231069 [16] 0.090913476 -0.140000498 -0.155938173 -0.200827857 -0.070478153 [21] 0.043448226 -0.176298675 -0.017699865 0.083639655 -0.006528150 [26] 0.006957180 -0.071682255 0.070184846 0.034546435 0.042437716 [31] -0.041131865 -0.073631908 0.093593335 -0.056335612 0.035114711 [36] -0.116587344 -0.021469174 0.005056921 -0.027705912 -0.071712940 [41] -0.071804789 0.018119157 -0.042412934 0.040241771 -0.080987111 [46] 0.007347159 0.066453965 0.036970176 > lengthx <- length(x) > sqrtn <- sqrt(lengthx) > > #Note: the /var/www/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/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/rcomp/tmp/378pw1281700776.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/rcomp/tmp/4tq5k1281700776.tab") > > try(system("convert tmp/1tgr51281700776.ps tmp/1tgr51281700776.png",intern=TRUE)) character(0) > try(system("convert tmp/2tgr51281700776.ps tmp/2tgr51281700776.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 0.840 0.200 1.024