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(467037,460070,447988,442867,436087,431328,484015,509673,512927,502831,470984,471067,476049,474605,470439,461251,454724,455626,516847,525192,522975,518585,509239,512238,519164,517009,509933,509127,500857,506971,569323,579714,577992,565464,547344,554788,562325,560854,555332,543599,536662,542722,593530,610763,612613,611324,594167,595454,590865,589379,584428,573100,567456,569028,620735,628884,628232,612117,595404,597141) > par8 = 'TRUE' > 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 1810.0918 461536.5 3690.41287 Feb 1 -3306.3172 462738.7 637.57436 Mar 1 -12375.5813 463941.0 -3577.40913 Apr 1 -22318.6437 465159.9 25.75418 May 1 -31408.0302 466378.8 1116.24159 Jun 1 -31654.5947 467601.6 -4619.04735 Jul 1 21709.2756 468824.5 -6518.77110 Aug 1 33220.5707 470062.3 6390.14724 Sep 1 30320.5184 471300.1 11306.41294 Oct 1 16448.2321 472810.6 13572.11794 Nov 1 -1759.3757 474321.2 -1577.85549 Dec 1 -686.1453 476066.9 -4313.71646 Jan 2 1810.0918 477812.5 -3573.58417 Feb 2 -3306.3172 479724.3 -1813.02795 Mar 2 -12375.5813 481636.2 1178.38329 Apr 2 -22318.6437 484239.1 -669.49197 May 2 -31408.0302 486842.1 -710.04313 Jun 2 -31654.5947 490137.4 -2856.76898 Jul 2 21709.2756 493432.7 1705.07034 Aug 2 33220.5707 497010.1 -5038.62801 Sep 2 30320.5184 500587.5 -7932.97900 Oct 2 16448.2321 504382.4 -2245.63747 Nov 2 -1759.3757 508177.4 2821.02563 Dec 2 -686.1453 512326.6 597.57089 Jan 3 1810.0918 516475.8 878.10942 Feb 3 -3306.3172 520746.6 -431.26194 Mar 3 -12375.5813 525017.4 -2708.77828 Apr 3 -22318.6437 528918.2 2527.46226 May 3 -31408.0302 532819.0 -553.97311 Jun 3 -31654.5947 536387.9 2237.71917 Jul 3 21709.2756 539956.7 7656.97663 Aug 3 33220.5707 543438.5 3054.96209 Sep 3 30320.5184 546920.2 751.29492 Oct 3 16448.2321 550099.9 -1084.16959 Nov 3 -1759.3757 553279.7 -4176.31252 Dec 3 -686.1453 556087.2 -613.03995 Jan 4 1810.0918 558894.7 1620.22589 Feb 4 -3306.3172 561655.1 2505.23850 Mar 4 -12375.5813 564415.5 3292.10612 Apr 4 -22318.6437 567453.4 -1535.74228 May 4 -31408.0302 570491.3 -2421.26658 Jun 4 -31654.5947 573460.1 916.44734 Jul 4 21709.2756 576429.0 -4608.27357 Aug 4 33220.5707 579020.4 -1477.97682 Sep 4 30320.5184 581611.8 680.66728 Oct 4 16448.2321 584070.9 10804.89218 Nov 4 -1759.3757 586529.9 9396.43866 Dec 4 -686.1453 588816.6 7323.57488 Jan 5 1810.0918 591103.2 -2048.29563 Feb 5 -3306.3172 592797.2 -111.84156 Mar 5 -12375.5813 594491.1 2312.46752 Apr 5 -22318.6437 595078.3 340.35099 May 5 -31408.0302 595665.5 3198.55856 Jun 5 -31654.5947 596162.5 4520.09363 Jul 5 21709.2756 596659.5 2366.19387 Aug 5 33220.5707 597101.1 -1437.70662 Sep 5 30320.5184 597542.7 368.74024 Oct 5 16448.2321 597918.5 -2249.76864 Nov 5 -1759.3757 598294.3 -1130.95594 Dec 5 -686.1453 598622.9 -795.80102 > m$win s t l 601 19 13 > m$deg s t l 0 1 1 > m$jump s t l 61 2 2 > m$inner [1] 1 > m$outer [1] 15 > postscript(file="/var/wessaorg/rcomp/tmp/1es1i1322561175.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/2biik1322561175.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/3s79r1322561175.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/46s5m1322561175.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/52a0u1322561175.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/64o9n1322561175.tab") > > try(system("convert tmp/1es1i1322561175.ps tmp/1es1i1322561175.png",intern=TRUE)) character(0) > try(system("convert tmp/2biik1322561175.ps tmp/2biik1322561175.png",intern=TRUE)) character(0) > try(system("convert tmp/3s79r1322561175.ps tmp/3s79r1322561175.png",intern=TRUE)) character(0) > try(system("convert tmp/46s5m1322561175.ps tmp/46s5m1322561175.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.321 0.214 1.553