R version 2.12.0 (2010-10-15) Copyright (C) 2010 The R Foundation for Statistical Computing ISBN 3-900051-07-0 Platform: i486-pc-linux-gnu (32-bit) 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(6.7,6.7,6.5,6.3,6.3,6.3,6.5,6.6,6.5,6.3,6.3,6.5,7,7.1,7.3,7.3,7.4,7.4,7.3,7.4,7.5,7.7,7.7,7.7,7.7,7.7,7.8,8,8.1,8.1,8.2,8.2,8.2,8.1,8.1,8.2,8.3,8.3,8.4,8.5,8.5,8.4,8,7.9,8.1,8.5,8.8,8.8,8.6,8.3,8.3,8.3,8.4,8.4,8.5,8.6,8.6,8.6,8.6,8.6,8.5,8.4,8.4,8.4,8.5,8.5,8.6,8.6,8.4,8.2,8,8,8,8,7.9,7.9,7.8,7.8,8,7.8,7.4,7.2,7,7,7.2,7.2,7.2,7,6.9,6.8,6.8,6.8,6.9,7.2,7.2,7.2,7.1,7.2,7.3,7.5,7.6,7.7,7.7,7.7,7.8,8,8.1,8.1,8,8.1,8.2,8.3,8.4,8.4,8.4,8.5,8.5,8.6,8.6,8.5,8.5) > par8 = '' > 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: Dr. Ian E. Holliday > #To cite this work: Ian E. Holliday, 2009, 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: > #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 (par8 != '') par8 <- as.numeric(par8) > ox <- x > if (par8 == '') { + if (par2 == 0) { + x <- log(x) + } else { + x <- (x ^ par2 - 1) / par2 + } + } else { + x <- log(x,base=par8) + } > 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/1685k1293203552.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > op <- par(mfrow=c(2,1)) > plot(ox,type='l',main='Original Time Series',xlab='time',ylab='value') > if (par8=='') { + mytitle <- paste('Working Time Series (lambda=',par2,', d=',par3,', D=',par4,')',sep='') + mysub <- paste('(lambda=',par2,', d=',par3,', D=',par4,', CI=', par7, ', CI type=',par6,')',sep='') + } else { + mytitle <- paste('Working Time Series (base=',par8,', d=',par3,', D=',par4,')',sep='') + mysub <- paste('(base=',par8,', d=',par3,', D=',par4,', CI=', par7, ', CI type=',par6,')',sep='') + } > plot(x,type='l', main=mytitle,xlab='time',ylab='value') > par(op) > dev.off() null device 1 > postscript(file="/var/www/rcomp/tmp/2yh441293203552.ps",horizontal=F,onefile=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=mysub) > dev.off() null device 1 > postscript(file="/var/www/rcomp/tmp/3yh441293203552.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > rpacf <- pacf(x,par1,main='Partial Autocorrelation',xlab='lags',ylab='PACF',sub=mysub) > dev.off() null device 1 > (myacf <- c(racf$acf)) [1] 1.000000000 0.964637497 0.910220941 0.849590883 0.797724777 [6] 0.757274619 0.715221784 0.668697936 0.612360816 0.545892539 [11] 0.471290197 0.397241212 0.326556524 0.266835975 0.209035989 [16] 0.155293470 0.101748159 0.052851936 0.006467899 -0.042568135 [21] -0.093047904 -0.144774198 -0.190643142 -0.229885037 -0.261806714 [26] -0.287654701 -0.311028766 -0.333531587 -0.354469994 -0.368247127 [31] -0.375060194 -0.371564027 -0.367889785 -0.370289234 -0.381948596 [36] -0.397563878 -0.400376873 -0.387360303 -0.364867480 -0.345955294 [41] -0.338675396 -0.341762127 -0.348111609 -0.355847429 -0.356046692 [46] -0.346312004 -0.330440343 -0.311776874 -0.298296719 -0.289942483 [51] -0.284380055 -0.274721896 -0.264033549 -0.252690297 -0.243166063 [56] -0.233126734 -0.218279373 -0.199158207 -0.175209876 -0.149480793 [61] -0.124285935 > (mypacf <- c(rpacf$acf)) [1] 0.964637497 -0.292259161 -0.049283397 0.134671118 0.076192415 [6] -0.147186659 -0.064061356 -0.103576993 -0.130278853 -0.133150265 [11] -0.006569008 -0.046447320 0.065661881 -0.093895005 0.044459349 [16] -0.013571746 0.074030736 -0.050680190 -0.097871471 -0.072388546 [21] -0.055884973 -0.011318981 -0.016433204 -0.012597225 0.024052479 [26] -0.034677341 0.002495245 0.007006287 0.100547220 -0.008716294 [31] 0.054438291 -0.111190895 -0.131014556 -0.139536221 -0.057987136 [36] 0.136808074 0.096200461 -0.025533504 -0.088427515 -0.095589527 [41] -0.022005604 -0.022748161 -0.083798209 -0.017666655 0.030543146 [46] -0.036345832 0.010112533 -0.005333885 -0.019884516 -0.014773831 [51] 0.048197398 -0.040277559 -0.027239553 -0.086223604 -0.053421190 [56] 0.001474932 0.039106945 0.069110693 0.076406069 0.027020555 > 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/4ki3s1293203552.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/5niky1293203552.tab") > > try(system("convert tmp/1685k1293203552.ps tmp/1685k1293203552.png",intern=TRUE)) character(0) > try(system("convert tmp/2yh441293203552.ps tmp/2yh441293203552.png",intern=TRUE)) character(0) > try(system("convert tmp/3yh441293203552.ps tmp/3yh441293203552.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 0.900 0.530 1.419