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(42.33600 + ,42.14710 + ,40.25640 + ,39.18980 + ,39.13170 + ,38.15070 + ,38.27070 + ,39.13350 + ,40.12190 + ,41.28450 + ,42.57490 + ,43.90190 + ,43.18350 + ,43.61880 + ,44.76240 + ,45.19720 + ,44.38810 + ,43.55520 + ,43.56780 + ,44.21350 + ,45.14510 + ,45.80790 + ,42.32820 + ,37.89990 + ,34.79640 + ,35.21440 + ,36.37270 + ,36.25020 + ,36.82610 + ,36.77230 + ,36.90420 + ,37.04940 + ,36.82590 + ,36.13570 + ,36.03000 + ,35.79270 + ,35.91740 + ,35.40080 + ,35.17230 + ,34.92110 + ,35.02920 + ,34.77390 + ,34.89990 + ,34.90540 + ,34.56800 + ,34.40600 + ,34.45780 + ,34.73160 + ,34.26020 + ,33.88490 + ,34.05490 + ,34.27550 + ,34.13930 + ,34.15870 + ,34.53860 + ,33.79870 + ,33.49730 + ,33.68020 + ,34.32840 + ,34.15380 + ,33.91840 + ,34.32620 + ,34.77500 + ,35.01190 + ,34.55130 + ,34.69510 + ,35.47300 + ,35.97940 + ,36.47890 + ,36.39100 + ,36.67040 + ,37.41620 + ,37.11850 + ,36.30010 + ,35.70020 + ,35.58590 + ,35.67770 + ,35.24080 + ,34.80160 + ,34.43890 + ,34.98810 + ,36.06800 + ,36.35660 + ,36.12540 + ,34.87100 + ,35.21990 + ,34.33900 + ,33.82340 + ,34.51990 + ,35.53000 + ,35.79660 + ,33.84840 + ,33.98710 + ,34.11610 + ,33.82350 + ,32.45400 + ,31.87740 + ,31.11500 + ,31.04360 + ,30.88680 + ,31.30010 + ,30.05070 + ,28.67990 + ,27.64380 + ,27.23940 + ,26.85490 + ,27.01580 + ,26.91880 + ,26.49660 + ,26.78500 + ,26.83980 + ,26.44780 + ,25.17280 + ,24.87840 + ,25.40150 + ,25.77160 + ,26.11810 + ,26.3969 + ,26.65710 + ,25.18390 + ,23.83940 + ,23.86190 + ,24.25810 + ,25.10980 + ,26.16170 + ,26.80870 + ,25.65770 + ,27.09820 + ,27.46650 + ,28.28900 + ,28.69330 + ,27.24010 + ,27.27980 + ,27.64040 + ,26.83100 + ,26.24670 + ,25.22120 + ,25.36530 + ,26.25920 + ,27.22790 + ,26.33150 + ,25.89810 + ,26.68980) > par8 = 'FALSE' > par7 = '1' > par6 = '' > par5 = '1' > par4 = '' > par3 = '0' > par2 = 'periodic' > par1 = '12' > main = 'Seasonal Decomposition by Loess' > par1 <- 5 > if (par2 != 'periodic') par2 <- as.numeric(par2) #s.window > par3 <- as.numeric(par3) #s.degree > if (par4 == '') par4 <- NULL else par4 <- as.numeric(par4)#t.window > par5 <- as.numeric(par5)#t.degree > if (par6 != '') par6 <- as.numeric(par6)#l.window > par7 <- as.numeric(par7)#l.degree > if (par8 == 'FALSE') par8 <- FALSE else par9 <- TRUE #robust > nx <- length(x) > x <- ts(x,frequency=par1) > if (par6 != '') { + m <- stl(x,s.window=par2, s.degree=par3, t.window=par4, t.degre=par5, l.window=par6, l.degree=par7, robust=par8) + } else { + m <- stl(x,s.window=par2, s.degree=par3, t.window=par4, t.degre=par5, l.degree=par7, robust=par8) + } > m$time.series Time Series: Start = c(1, 1) End = c(29, 3) Frequency = 5 seasonal trend remainder 1.0 0.07224993 42.28696 -0.0232114226 1.2 0.07358595 41.45491 0.6186060135 1.4 -0.05486548 40.65578 -0.3445164720 1.6 -0.06326401 39.88143 -0.6283666937 1.8 -0.02770644 39.10631 0.0530998651 2.0 0.07224993 38.83659 -0.7581410503 2.2 0.07358595 38.97717 -0.7800536418 2.4 -0.05486548 39.47308 -0.2847107536 2.6 -0.06326401 40.32366 -0.1385002141 2.8 -0.02770644 41.33239 -0.0201840429 3.0 0.07224993 42.21279 0.2898562200 3.2 0.07358595 42.93731 0.8909997361 3.4 -0.05486548 43.56745 -0.3290833595 3.6 -0.06326401 44.02574 -0.3436763831 3.8 -0.02770644 44.24856 0.5415467437 4.0 0.07224993 44.32066 0.8042935884 4.2 0.07358595 44.27685 0.0376616742 4.4 -0.05486548 44.17983 -0.5697667636 4.6 -0.06326401 44.20956 -0.5784976741 4.8 -0.02770644 44.33699 -0.0957823938 5.0 0.07224993 44.08308 0.9897661359 5.2 0.07358595 43.02642 2.7078981671 5.4 -0.05486548 41.23473 1.1483371350 5.6 -0.06326401 39.16950 -1.2063395041 5.8 -0.02770644 37.35840 -2.5342919731 6.0 0.07224993 36.26556 -1.1234062968 6.2 0.07358595 36.02456 0.2745562912 6.4 -0.05486548 36.28776 0.0173036684 6.6 -0.06326401 36.58782 0.3015439389 6.8 -0.02770644 36.76132 0.0386857705 7.0 0.07224993 36.82198 0.0099688839 7.2 0.07358595 36.74703 0.2287874397 7.4 -0.05486548 36.58220 0.2985697224 7.6 -0.06326401 36.36494 -0.1659790261 7.8 -0.02770644 36.11861 -0.0609005877 8.0 0.07224993 35.87433 -0.1538749585 8.2 0.07358595 35.65900 0.1848105310 8.4 -0.05486548 35.45957 -0.0039027884 8.6 -0.06326401 35.26740 -0.0318340445 8.8 -0.02770644 35.08443 -0.1356212595 9.0 0.07224993 34.96369 -0.0067443698 9.2 0.07358595 34.89819 -0.1978757761 9.4 -0.05486548 34.82752 0.1272504331 9.6 -0.06326401 34.73359 0.2350698580 9.8 -0.02770644 34.65220 -0.0564977064 10.0 0.07224993 34.58076 -0.2470086911 10.2 0.07358595 34.48312 -0.0989085719 10.4 -0.05486548 34.37511 0.4113515495 10.6 -0.06326401 34.28907 0.0343940692 10.8 -0.02770644 34.21115 -0.2985480085 11.0 0.07224993 34.13671 -0.1540594146 11.2 0.07358595 34.13652 0.0653910569 11.4 -0.05486548 34.19346 0.0007049325 11.6 -0.06326401 34.16932 0.0526402702 11.8 -0.02770644 34.05372 0.5125875036 12.0 0.07224993 33.95713 -0.2306802790 12.2 0.07358595 33.92011 -0.4963991887 12.4 -0.05486548 33.90872 -0.1736522717 12.6 -0.06326401 33.96092 0.4307433184 12.8 -0.02770644 34.09691 0.0845942838 13.0 0.07224993 34.26654 -0.4203850436 13.2 0.07358595 34.41581 -0.1631956524 13.4 -0.05486548 34.54739 0.2824737168 13.6 -0.06326401 34.70052 0.3746488546 13.8 -0.02770644 34.89210 -0.3130929766 14.0 0.07224993 35.13177 -0.5089170999 14.2 0.07358595 35.44583 -0.0464115369 14.4 -0.05486548 35.82250 0.2117660063 14.6 -0.06326401 36.20844 0.3337205641 14.8 -0.02770644 36.54801 -0.1293029376 15.0 0.07224993 36.75621 -0.1580634353 15.2 0.07358595 36.77870 0.5639154774 15.4 -0.05486548 36.64868 0.5246864671 15.6 -0.06326401 36.39615 -0.0327854662 15.8 -0.02770644 36.05498 -0.3270738115 16.0 0.07224993 35.70985 -0.1962031766 16.2 0.07358595 35.41726 0.1868582602 16.4 -0.05486548 35.18433 0.1113398749 16.6 -0.06326401 35.05996 -0.1950923554 16.8 -0.02770644 35.11031 -0.6436986984 17.0 0.07224993 35.32314 -0.4072935672 17.2 0.07358595 35.57267 0.4217396204 17.4 -0.05486548 35.71106 0.7004098239 17.6 -0.06326401 35.65716 0.5315067945 17.8 -0.02770644 35.34575 -0.4470441223 18.0 0.07224993 34.91096 0.2366941381 18.2 0.07358595 34.63889 -0.3734765838 18.4 -0.05486548 34.64888 -0.7706129500 18.6 -0.06326401 34.74754 -0.1643756097 18.8 -0.02770644 34.77378 0.7839216555 19.0 0.07224993 34.73917 0.9851827168 19.2 0.07358595 34.58422 -0.8094010413 19.4 -0.05486548 34.22487 -0.1829068859 19.6 -0.06326401 33.73054 0.4488209557 19.8 -0.02770644 33.23289 0.6183201398 20.0 0.07224993 32.66600 -0.2842529549 20.2 0.07358595 32.04949 -0.2456719374 20.4 -0.05486548 31.53989 -0.3700269425 20.6 -0.06326401 31.20454 -0.0976713879 20.8 -0.02770644 30.86619 0.0483145840 21.0 0.07224993 30.37877 0.8490794781 21.2 0.07358595 29.72029 0.2568237027 21.4 -0.05486548 28.93668 -0.2019161775 21.6 -0.06326401 28.13749 -0.4304291040 21.8 -0.02770644 27.52392 -0.2568106803 22.0 0.07224993 27.14858 -0.3659262922 22.2 0.07358595 26.93403 0.0081844984 22.4 -0.05486548 26.83477 0.1388924065 22.6 -0.06326401 26.78393 -0.2240683020 22.8 -0.02770644 26.65055 0.1621536729 23.0 0.07224993 26.37570 0.3918489651 23.2 0.07358595 26.04380 0.3304101770 23.4 -0.05486548 25.74231 -0.5146453208 23.6 -0.06326401 25.53964 -0.5979799783 23.8 -0.02770644 25.52632 -0.0971100703 24.0 0.07224993 25.73694 -0.0375858254 24.2 0.07358595 25.98533 0.0591833771 24.4 -0.05486548 25.98059 0.4711791538 24.6 -0.06326401 25.66504 1.0553214768 24.8 -0.02770644 25.19563 0.0159805207 25.0 0.07224993 24.74524 -0.9780875461 25.2 0.07358595 24.52028 -0.7319644074 25.4 -0.05486548 24.71290 -0.3999357908 25.6 -0.06326401 25.18957 -0.0165021311 25.8 -0.02770644 25.67409 0.5153127247 26.0 0.07224993 26.15289 0.5835552400 26.2 0.07358595 26.60984 -1.0257278928 26.4 -0.05486548 27.03668 0.1163868084 26.6 -0.06326401 27.44247 0.0872947928 26.8 -0.02770644 27.72798 0.5887309933 27.0 0.07224993 27.81581 0.8052394591 27.2 0.07358595 27.74677 -0.5802561914 27.4 -0.05486548 27.48574 -0.1510731009 27.6 -0.06326401 27.08673 0.6169338148 27.8 -0.02770644 26.66608 0.1926296045 28.0 0.07224993 26.27051 -0.0960629184 28.2 0.07358595 26.02677 -0.8791529469 28.4 -0.05486548 26.01915 -0.5989847940 28.6 -0.06326401 26.12289 0.1995692472 28.8 -0.02770644 26.21931 1.0363003650 29.0 0.07224993 26.35972 -0.1004683886 29.2 0.07358595 26.47909 -0.6545732956 29.4 -0.05486548 26.56818 0.1764888535 > m$win s t l 1431 9 5 > m$deg s t l 0 1 1 > m$jump s t l 144 1 1 > m$inner [1] 2 > m$outer [1] 0 > postscript(file="/var/www/rcomp/tmp/1zq301292010560.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > plot(m,main=main) > dev.off() null device 1 > mylagmax <- nx/2 > postscript(file="/var/www/rcomp/tmp/2rz2l1292010560.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > op <- par(mfrow = c(2,2)) > acf(as.numeric(x),lag.max = mylagmax,main='Observed') > acf(as.numeric(m$time.series[,'trend']),na.action=na.pass,lag.max = mylagmax,main='Trend') > acf(as.numeric(m$time.series[,'seasonal']),na.action=na.pass,lag.max = mylagmax,main='Seasonal') > acf(as.numeric(m$time.series[,'remainder']),na.action=na.pass,lag.max = mylagmax,main='Remainder') > par(op) > dev.off() null device 1 > postscript(file="/var/www/rcomp/tmp/3rz2l1292010560.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > op <- par(mfrow = c(2,2)) > spectrum(as.numeric(x),main='Observed') > spectrum(as.numeric(m$time.series[!is.na(m$time.series[,'trend']),'trend']),main='Trend') > spectrum(as.numeric(m$time.series[!is.na(m$time.series[,'seasonal']),'seasonal']),main='Seasonal') > spectrum(as.numeric(m$time.series[!is.na(m$time.series[,'remainder']),'remainder']),main='Remainder') > par(op) > dev.off() null device 1 > postscript(file="/var/www/rcomp/tmp/4k91o1292010560.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > op <- par(mfrow = c(2,2)) > cpgram(as.numeric(x),main='Observed') > cpgram(as.numeric(m$time.series[!is.na(m$time.series[,'trend']),'trend']),main='Trend') > cpgram(as.numeric(m$time.series[!is.na(m$time.series[,'seasonal']),'seasonal']),main='Seasonal') > cpgram(as.numeric(m$time.series[!is.na(m$time.series[,'remainder']),'remainder']),main='Remainder') > par(op) > dev.off() null device 1 > > #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,'Seasonal Decomposition by Loess - Parameters',4,TRUE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'Component',header=TRUE) > a<-table.element(a,'Window',header=TRUE) > a<-table.element(a,'Degree',header=TRUE) > a<-table.element(a,'Jump',header=TRUE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'Seasonal',header=TRUE) > a<-table.element(a,m$win['s']) > a<-table.element(a,m$deg['s']) > a<-table.element(a,m$jump['s']) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'Trend',header=TRUE) > a<-table.element(a,m$win['t']) > a<-table.element(a,m$deg['t']) > a<-table.element(a,m$jump['t']) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'Low-pass',header=TRUE) > a<-table.element(a,m$win['l']) > a<-table.element(a,m$deg['l']) > a<-table.element(a,m$jump['l']) > a<-table.row.end(a) > a<-table.end(a) > table.save(a,file="/var/www/rcomp/tmp/5g0hf1292010560.tab") > a<-table.start() > a<-table.row.start(a) > a<-table.element(a,'Seasonal Decomposition by Loess - Time Series Components',6,TRUE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'t',header=TRUE) > a<-table.element(a,'Observed',header=TRUE) > a<-table.element(a,'Fitted',header=TRUE) > a<-table.element(a,'Seasonal',header=TRUE) > a<-table.element(a,'Trend',header=TRUE) > a<-table.element(a,'Remainder',header=TRUE) > a<-table.row.end(a) > for (i in 1:nx) { + a<-table.row.start(a) + a<-table.element(a,i,header=TRUE) + a<-table.element(a,x[i]) + a<-table.element(a,x[i]+m$time.series[i,'remainder']) + a<-table.element(a,m$time.series[i,'seasonal']) + a<-table.element(a,m$time.series[i,'trend']) + a<-table.element(a,m$time.series[i,'remainder']) + a<-table.row.end(a) + } > a<-table.end(a) > table.save(a,file="/var/www/rcomp/tmp/6jjyk1292010560.tab") > > try(system("convert tmp/1zq301292010560.ps tmp/1zq301292010560.png",intern=TRUE)) character(0) > try(system("convert tmp/2rz2l1292010560.ps tmp/2rz2l1292010560.png",intern=TRUE)) character(0) > try(system("convert tmp/3rz2l1292010560.ps tmp/3rz2l1292010560.png",intern=TRUE)) character(0) > try(system("convert tmp/4k91o1292010560.ps tmp/4k91o1292010560.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.670 0.370 2.023