R version 2.12.1 (2010-12-16) 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(2250,2102,2957,2485,2871,2447,2622,1840,2682,2369,2119,2531,2214,3206,2709,2734,2348,2702,2642,2064,2647,2534,2297,2718,2321,3112,2664,2808,2668,2934,2616,2228,2463,2416,2407,2582,2101,3305,2818,2401,3019,2507,2948,2210,2467,2596,2451,2233,2393,3122,2801,2656,2782,2604,2803,2178,2324,2536,2408,2261,2166,3243,2296,2719,2734,2297,2732,1904,2397,2473,1967,2471,2203,3053,2350,2807,2639,2646,2577,1860,2624,2590,2261,3342,2840,3328,3245,3025,2915,3579,2787,2397,3065,2154,2689,3187,2540,3469,3005,2573,2998,2768,2556,2414,2467,2136,2493,2735,2316,3042,2364,2248,2714,2583,2631,1965,2209,1964,2132) > par8 = '' > par7 = '0.95' > par6 = 'White Noise' > par5 = '12' > par4 = '1' > par3 = '0' > par2 = '1' > par1 = '48' > #'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/1hjv71323962332.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/2eapl1323962332.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/3ipov1323962332.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.0000000000 0.1451368338 0.4143318784 0.4549209438 0.1334321141 [6] 0.3265539152 0.3973792239 0.0101742246 0.3274006963 0.1530219815 [11] -0.0811248680 0.1734508865 -0.1126690131 -0.1276741055 0.0435287573 [16] -0.1357680144 -0.1392297287 -0.0742307611 -0.2499647215 -0.2225423826 [21] -0.1562204719 -0.2572419033 -0.2551222921 -0.0920834597 -0.3345253336 [26] -0.1369795814 -0.2231041667 -0.2271468378 -0.1752433003 -0.0969079661 [31] -0.1735926357 0.0094705504 -0.1115525040 -0.0691566199 -0.0553046196 [36] -0.0179432948 -0.0477159049 0.0283939553 0.0394044837 0.0002848962 [41] 0.0627499618 0.0336984102 0.0067862318 0.0275874062 0.0645109425 [46] -0.0295314404 0.1456646149 -0.0232641574 0.0168458058 > (mypacf <- c(rpacf$acf)) [1] 0.145136834 0.401729489 0.439294801 -0.060659905 -0.017319735 [6] 0.293271222 -0.173861786 -0.062380924 0.022250549 -0.232001294 [11] -0.141500101 -0.153898855 -0.096270787 -0.020252169 0.130090874 [16] 0.027472198 -0.112107905 0.014003951 -0.095420563 -0.085987493 [21] 0.040952739 -0.147875967 0.070909541 -0.083370951 0.030255586 [26] -0.085190669 0.067806064 0.010539361 -0.003045758 0.102834908 [31] 0.067689252 -0.079076297 -0.016032813 -0.163731271 0.026671072 [36] -0.080795370 -0.065829497 0.034014997 -0.031685630 0.017674164 [41] -0.013304392 0.052199977 -0.081870078 -0.022502451 -0.034699791 [46] -0.025514814 -0.047329505 -0.073129559 > 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/4611t1323962332.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/55u8r1323962332.tab") > > try(system("convert tmp/1hjv71323962332.ps tmp/1hjv71323962332.png",intern=TRUE)) character(0) > try(system("convert tmp/2eapl1323962332.ps tmp/2eapl1323962332.png",intern=TRUE)) character(0) > try(system("convert tmp/3ipov1323962332.ps tmp/3ipov1323962332.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.096 0.212 1.309