R version 2.13.0 (2011-04-13) Copyright (C) 2011 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(617,614,647,580,614,636,388,356,639,753,611,639,630,586,695,552,619,681,421,307,754,690,644,643,608,651,691,627,634,731,475,337,803,722,590,724,627,696,825,677,656,785,412,352,839,729,696,641,695,638,762,635,721,854,418,367,824,687,601,676,740,691,683,594,729,731,386,331,706,715,657,653,642,643,718,654,632,731,392,344,792,852,649,629,685,617,715,715,629,916,531,357,917,828,708,858,775,785,1006,789,734,906,532,387,991,841,892,782,811,792,978,773,796,946,594,438,1023,868,791,760,779,852,1001,734,996,869,599,426,1138) > par8 = 'FALSE' > par7 = '1' > par6 = '' > par5 = '1' > par4 = '' > par3 = '0' > par2 = 'periodic' > par1 = '12' > main = 'Seasonal Decomposition by Loess' > #'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: Write here your technical program description (don't use hard returns!) > par1 <- as.numeric(par1) #seasonal period > 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 seasonal trend remainder Jan 1 16.810178 578.8171 21.3727031 Feb 1 10.725005 580.6487 22.6262558 Mar 1 113.730748 582.4804 -49.2111071 Apr 1 -14.599837 584.2517 10.3481332 May 1 22.614927 586.0230 5.3620241 Jun 1 114.118578 587.5524 -65.6709334 Jul 1 -218.377910 589.0817 17.2962482 Aug 1 -324.879067 590.5382 90.3409151 Sep 1 165.892451 591.9946 -118.8870941 Oct 1 91.250064 593.3729 68.3770257 Nov 1 4.214934 594.7512 12.0338878 Dec 1 18.499931 595.4255 25.0745868 Jan 2 16.810178 596.0998 17.0900363 Feb 2 10.725005 596.8183 -21.5433492 Mar 2 113.730748 597.5369 -16.2676502 Apr 2 -14.599837 598.4751 -31.8752460 May 2 22.614927 599.4133 -3.0281911 Jun 2 114.118578 600.5795 -33.6980760 Jul 2 -218.377910 601.7457 37.6321782 Aug 2 -324.879067 604.2663 27.6127862 Sep 2 165.892451 606.7868 -18.6792820 Oct 2 91.250064 609.4917 -10.7417938 Nov 2 4.214934 612.1966 27.5884367 Dec 2 18.499931 615.0755 9.4246090 Jan 3 16.810178 617.9543 -26.7644682 Feb 3 10.725005 621.1023 19.1727448 Mar 3 113.730748 624.2502 -46.9809578 Apr 3 -14.599837 626.8367 14.7631626 May 3 22.614927 629.4231 -18.0380663 Jun 3 114.118578 631.9447 -15.0633181 Jul 3 -218.377910 634.4663 58.9115691 Aug 3 -324.879067 639.0693 22.8097806 Sep 3 165.892451 643.6722 -6.5646840 Oct 3 91.250064 648.1532 -17.4033041 Nov 3 4.214934 652.6342 -66.8491820 Dec 3 18.499931 654.7198 50.7802450 Jan 4 16.810178 656.8054 -46.6155775 Feb 4 10.725005 658.1026 27.1724010 Mar 4 113.730748 659.3998 51.8694638 Apr 4 -14.599837 661.3716 30.2282542 May 4 22.614927 663.3434 -29.9583048 Jun 4 114.118578 663.4964 7.3850484 Jul 4 -218.377910 663.6494 -33.2714592 Aug 4 -324.879067 661.5718 15.3073005 Sep 4 165.892451 659.4942 13.6133840 Oct 4 91.250064 658.7232 -20.9732842 Nov 4 4.214934 657.9523 33.8327899 Dec 4 18.499931 659.9200 -37.4199802 Jan 5 16.810178 661.8878 16.3020001 Feb 5 10.725005 663.0562 -35.7812394 Mar 5 113.730748 664.2246 -15.9553944 Apr 5 -14.599837 662.8089 -13.2090479 May 5 22.614927 661.3931 36.9919493 Jun 5 114.118578 660.8717 79.0097437 Jul 5 -218.377910 660.3502 -23.9723228 Aug 5 -324.879067 659.5600 32.3190905 Sep 5 165.892451 658.7697 -0.6621724 Oct 5 91.250064 655.8033 -60.0533856 Nov 5 4.214934 652.8369 -56.0518565 Dec 5 18.499931 648.6196 8.8805180 Jan 6 16.810178 644.4022 78.7876430 Feb 6 10.725005 641.1856 39.0894392 Mar 6 113.730748 637.9689 -68.6996803 Apr 6 -14.599837 635.5986 -26.9987623 May 6 22.614927 633.2283 73.1568063 Jun 6 114.118578 630.9104 -14.0289899 Jul 6 -218.377910 628.5926 -24.2146470 Aug 6 -324.879067 626.7829 29.0962155 Sep 6 165.892451 624.9731 -84.8655980 Oct 6 91.250064 624.7149 -0.9649434 Nov 6 4.214934 624.4566 28.3284535 Dec 6 18.499931 624.4111 10.0889703 Jan 7 16.810178 624.3656 0.8242377 Feb 7 10.725005 626.8912 5.3838021 Mar 7 113.730748 629.4168 -25.1475492 Apr 7 -14.599837 633.3503 35.2495648 May 7 22.614927 637.2837 -27.8986706 Jun 7 114.118578 639.5978 -22.7164043 Jul 7 -218.377910 641.9119 -31.5339988 Aug 7 -324.879067 643.0818 25.7972527 Sep 7 165.892451 644.2517 -18.1441719 Oct 7 91.250064 646.8753 113.8746508 Nov 7 4.214934 649.4989 -4.7137841 Dec 7 18.499931 655.5683 -45.0682147 Jan 8 16.810178 661.6377 6.5521051 Feb 8 10.725005 668.2200 -61.9449566 Mar 8 113.730748 674.8022 -73.5329340 Apr 8 -14.599837 681.9158 47.6840057 May 8 22.614927 689.0295 -82.6444038 Jun 8 114.118578 700.0564 101.8250633 Jul 8 -218.377910 711.0832 38.2946695 Aug 8 -324.879067 724.8577 -42.9786208 Sep 8 165.892451 738.6321 12.4754128 Oct 8 91.250064 749.2538 -12.5038755 Nov 8 4.214934 759.8755 -56.0904216 Dec 8 18.499931 764.8856 74.6144612 Jan 9 16.810178 769.8957 -11.7059055 Feb 9 10.725005 772.6088 1.6661877 Mar 9 113.730748 775.3219 116.9473651 Apr 9 -14.599837 778.4675 25.1323599 May 9 22.614927 781.6131 -70.2279947 Jun 9 114.118578 783.0468 8.8345979 Jul 9 -218.377910 784.4806 -34.1026703 Aug 9 -324.879067 785.0962 -73.2170980 Sep 9 165.892451 785.7118 39.3957983 Oct 9 91.250064 787.6697 -37.9197200 Nov 9 4.214934 789.6276 98.1575039 Dec 9 18.499931 793.6949 -30.1948695 Jan 10 16.810178 797.7623 -3.5724925 Feb 10 10.725005 800.5411 -19.2660947 Mar 10 113.730748 803.3199 60.9493874 Apr 10 -14.599837 803.1737 -15.5738803 May 10 22.614927 803.0276 -29.6424973 Jun 10 114.118578 801.0233 30.8581598 Jul 10 -218.377910 799.0190 13.3589561 Aug 10 -324.879067 798.8730 -35.9939273 Sep 10 165.892451 798.7270 58.3805133 Oct 10 91.250064 801.1421 -24.3921786 Nov 10 4.214934 803.5572 -16.7721281 Dec 10 18.499931 806.5067 -65.0066093 Jan 11 16.810178 809.4562 -47.2663399 Feb 11 10.725005 814.3568 26.9181471 Mar 11 113.730748 819.2575 68.0117184 Apr 11 -14.599837 825.4026 -76.8028046 May 11 22.614927 831.5478 141.8373230 Jun 11 114.118578 838.0712 -83.1897678 Jul 11 -218.377910 844.5946 -27.2167195 Aug 11 -324.879067 851.1525 -100.2733922 Sep 11 165.892451 857.7103 114.3972591 > m$win s t l 1291 19 13 > m$deg s t l 0 1 1 > m$jump s t l 130 2 2 > m$inner [1] 2 > m$outer [1] 0 > postscript(file="/var/wessaorg/rcomp/tmp/143lr1323182197.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/wessaorg/rcomp/tmp/2zxh91323182197.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/wessaorg/rcomp/tmp/3tmm21323182197.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/wessaorg/rcomp/tmp/4dkkt1323182197.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/wessaorg/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/wessaorg/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/wessaorg/rcomp/tmp/57zcr1323182197.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/wessaorg/rcomp/tmp/62zt31323182197.tab") > > try(system("convert tmp/143lr1323182197.ps tmp/143lr1323182197.png",intern=TRUE)) character(0) > try(system("convert tmp/2zxh91323182197.ps tmp/2zxh91323182197.png",intern=TRUE)) character(0) > try(system("convert tmp/3tmm21323182197.ps tmp/3tmm21323182197.png",intern=TRUE)) character(0) > try(system("convert tmp/4dkkt1323182197.ps tmp/4dkkt1323182197.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.698 0.230 1.954