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(17,18,23.8,25.5,25.6,23.7,22,21.3,20.7,20.4,20.3,20.4,19.8,19.5,23.1,23.5,23.5,22.9,21.9,21.5,20.5,20.2,19.4,19.2,18.8,18.8,22.6,23.3,23,21.4,19.9,18.8,18.6,18.4,18.6,19.9,19.2,18.4,21.1,20.5,19.1,18.1,17,17.1,17.4,16.8,15.3,14.3,13.4,15.3,22.1,23.7,22.2,19.5,16.6,17.3,19.8,21.2,21.5,20.6,19.1,19.6,23.5,24) > par7 = '0.95' > par6 = 'White Noise' > par5 = '12' > par4 = '0' > par3 = '0' > par2 = '1' > par1 = '60' > #'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/14an41260213802.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/2z3pq1260213802.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.0000000000 0.7421888343 0.3298889080 0.0703275469 -0.0021533929 [6] 0.0769709739 0.1457409726 0.1177217277 0.0443710611 0.0475130287 [11] 0.1476841398 0.3094887690 0.4015963775 0.2269033811 0.0003014079 [16] -0.1118016931 -0.1660026153 -0.1694596865 -0.1763555622 -0.2003369688 [21] -0.1946660262 -0.1160837616 0.0160541960 0.1527857005 0.2026175680 [26] 0.0364872093 -0.1639502735 -0.2553238710 -0.2799605266 -0.2454987262 [31] -0.1992134392 -0.1752306117 -0.1565037412 -0.1056488973 -0.0347803112 [36] 0.0375373423 0.0558893243 -0.0699664885 -0.2011906892 -0.2236181170 [41] -0.2030762424 -0.1630752597 -0.1478204933 -0.1635353775 -0.1575504166 [46] -0.0873943691 0.0394561222 0.1578868416 0.1850223841 0.0534347529 [51] -0.0956773902 -0.1164265925 -0.0633592983 0.0199028054 0.0707261400 [56] 0.0561348469 0.0210074025 0.0134480423 0.0457432239 0.0865330119 [61] 0.0855436876 > (mypacf <- c(rpacf$acf)) [1] 0.742188834 -0.491934848 0.206047564 -0.007765761 0.200337123 [6] -0.130090917 0.009634459 -0.008551571 0.212898750 0.065598587 [11] 0.257512827 -0.060976064 -0.359023718 0.286439907 -0.207482585 [16] -0.161882055 -0.115223320 -0.068354366 -0.012441282 -0.005596553 [21] 0.016347113 0.104439765 0.103661958 -0.079507486 -0.106119724 [26] 0.028131781 -0.120217945 0.032966881 -0.089645013 0.033329839 [31] -0.031843764 -0.031671171 0.002883835 -0.085832431 0.023536803 [36] -0.124707194 -0.003180928 -0.030790811 0.078056217 -0.036965033 [41] 0.014217378 -0.100802038 -0.021771825 -0.008087697 -0.014957364 [46] 0.125315845 -0.020795457 0.025387802 -0.020740696 0.013439200 [51] 0.067949187 -0.021071484 0.047616250 -0.031839468 -0.004242633 [56] -0.091117617 -0.044737712 -0.097673120 -0.070381147 -0.014195334 > 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/3rief1260213802.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/4j9ab1260213802.tab") > > system("convert tmp/14an41260213802.ps tmp/14an41260213802.png") > system("convert tmp/2z3pq1260213802.ps tmp/2z3pq1260213802.png") > > > proc.time() user system elapsed 0.588 0.319 0.936