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(49915,47469,45652,43492,41087,42931,67256,72316,65624,59450,52851,51214,44092,43752,40320,40551,38329,39530,59648,61031,55560,43877,38510,36085,35994,32617,30001,27894,26083,28817,48742,49915,40264,34276,30426,30793,29855,28081,26820,25782,22654,27373,43675,45096,38145,34017,31537,33814,36531,36935,36497,35110,33137,37407,53963,56602,49694,43957,41723,45599,42503,42153,39098,37449,34748,36548,53639,55289,47774,42156,38019) > 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 -2735.807 51889.04 761.76920 Feb 1 -3863.296 52064.28 -731.98906 Mar 1 -5780.117 52239.53 -807.41462 Apr 1 -6937.674 52343.46 -1913.78440 May 1 -9116.898 52447.38 -2243.48730 Jun 1 -6218.484 52456.41 -3306.92359 Jul 1 12971.428 52465.43 1819.14246 Aug 1 15298.746 52422.96 4594.29336 Sep 1 8207.065 52380.49 5036.44362 Oct 1 1800.013 52173.67 5476.31508 Nov 1 -2163.538 51966.85 3047.68546 Dec 1 -1461.443 51346.33 1329.10841 Jan 2 -2735.807 50725.82 -3898.01018 Feb 2 -3863.296 49829.01 -2213.71482 Mar 2 -5780.117 48932.20 -2832.08676 Apr 2 -6937.674 47932.87 -444.19332 May 2 -9116.898 46933.53 512.36698 Jun 2 -6218.484 45993.30 -244.81695 Jul 2 12971.428 45053.07 1623.50146 Aug 2 15298.746 44120.44 1611.80971 Sep 2 8207.065 43187.82 4165.11733 Oct 2 1800.013 42155.63 -78.64351 Nov 2 -2163.538 41123.44 -449.90542 Dec 2 -1461.443 40074.87 -2528.42424 Jan 3 -2735.807 39026.29 -296.48461 Feb 3 -3863.296 38051.83 -1571.53116 Mar 3 -5780.117 37077.36 -1296.24502 Apr 3 -6937.674 36288.34 -1456.66320 May 3 -9116.898 35499.31 -299.41451 Jun 3 -6218.484 34955.86 79.62610 Jul 3 12971.428 34412.40 1358.16905 Aug 3 15298.746 34032.85 583.40544 Sep 3 8207.065 33653.29 -1596.35880 Oct 3 1800.013 33375.91 -899.92046 Nov 3 -2163.538 33098.52 -508.98321 Dec 3 -1461.443 32851.02 -596.58044 Jan 4 -2735.807 32603.53 -12.71921 Feb 4 -3863.296 32378.92 -434.62093 Mar 4 -5780.117 32154.31 445.81004 Apr 4 -6937.674 32081.07 638.59983 May 4 -9116.898 32007.84 -236.94351 Jun 4 -6218.484 32227.68 1363.79926 Jul 4 12971.428 32447.53 -1743.95563 Aug 4 15298.746 33040.51 -3243.25639 Sep 4 8207.065 33633.49 -3695.55778 Oct 4 1800.013 34502.77 -2285.78195 Nov 4 -2163.538 35372.04 -1671.50720 Dec 4 -1461.443 36382.42 -1106.97375 Jan 5 -2735.807 37392.79 1874.01815 Feb 5 -3863.296 38387.29 2411.00960 Mar 5 -5780.117 39381.78 2895.33375 Apr 5 -6937.674 40217.98 1829.69317 May 5 -9116.898 41054.18 1199.71947 Jun 5 -6218.484 41686.32 1939.16301 Jul 5 12971.428 42318.46 -1326.89111 Aug 5 15298.746 42734.58 -1431.32528 Sep 5 8207.065 43150.70 -1663.76008 Oct 5 1800.013 43401.87 -1244.88766 Nov 5 -2163.538 43653.05 233.48368 Dec 5 -1461.443 43752.84 3307.60756 Jan 6 -2735.807 43852.62 1386.18991 Feb 6 -3863.296 43636.12 2380.17197 Mar 6 -5780.117 43419.63 1458.48673 Apr 6 -6937.674 43035.17 1351.50843 May 6 -9116.898 42650.70 1214.19699 Jun 6 -6218.484 42236.46 530.02158 Jul 6 12971.428 41822.22 -1154.65150 Aug 6 15298.746 41356.79 -1366.53968 Sep 6 8207.065 40891.36 -1324.42850 Oct 6 1800.013 40384.47 -28.48616 Nov 6 -2163.538 39877.58 304.95509 > m$win s t l 711 19 13 > m$deg s t l 0 1 1 > m$jump s t l 72 2 2 > m$inner [1] 2 > m$outer [1] 0 > postscript(file="/var/www/html/rcomp/tmp/1xxfp1293563490.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/html/rcomp/tmp/286xa1293563490.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/html/rcomp/tmp/386xa1293563490.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/html/rcomp/tmp/4ifev1293563490.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/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,'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/html/rcomp/tmp/5w7t41293563490.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/html/rcomp/tmp/6i8as1293563490.tab") > > try(system("convert tmp/1xxfp1293563490.ps tmp/1xxfp1293563490.png",intern=TRUE)) character(0) > try(system("convert tmp/286xa1293563490.ps tmp/286xa1293563490.png",intern=TRUE)) character(0) > try(system("convert tmp/386xa1293563490.ps tmp/386xa1293563490.png",intern=TRUE)) character(0) > try(system("convert tmp/4ifev1293563490.ps tmp/4ifev1293563490.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.005 0.671 4.260