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(115.47,103.34,102.60,100.69,105.67,123.61,113.08,106.46,123.38,109.87,95.74,123.06,123.39,120.28,115.33,110.4,114.49,132.03,123.16,118.82,128.32,112.24,104.53,132.57,122.52,131.8,124.55,120.96,122.6,145.52,118.57,134.25,136.7,121.37,111.63,134.42,137.65,137.86,119.77,130.69,128.28,147.45,128.42,136.9,143.95,135.64,122.48,136.83,153.04,142.71,123.46,144.37,146.15,147.61,158.51,147.4,165.05,154.64,126.2,157.36,154.15,123.21,113.07,110.45,113.57,122.44,114.93,111.85,126.04,121.34) > par8 = 'FALSE' > par7 = '1' > par6 = '' > par5 = '1' > par4 = '' > par3 = '1' > 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 8.7783765 106.2964 0.3952048 Feb 1 0.6956556 107.0463 -4.4019935 Mar 1 -9.6204164 107.7963 4.4241594 Apr 1 -6.6964534 108.5645 -1.1780456 May 1 -4.7024964 109.3327 1.0397556 Jun 1 9.9612133 110.1426 3.5061435 Jul 1 -0.3567520 110.9525 2.4842064 Aug 1 -0.2752196 111.7981 -5.0628491 Sep 1 11.2646335 112.6436 -0.5282253 Oct 1 0.2192008 113.4855 -3.8347107 Nov 1 -16.9540216 114.3274 -1.6334062 Dec 1 7.6862844 115.2454 0.1283578 Jan 2 8.7783765 116.1633 -1.5516642 Feb 2 0.6956556 116.9788 2.6055248 Mar 2 -9.6204164 117.7944 7.1560650 Apr 2 -6.6964534 118.3530 -1.2565717 May 2 -4.7024964 118.9117 0.2807977 Jun 2 9.9612133 119.2560 2.8127581 Jul 2 -0.3567520 119.6004 3.9163935 Aug 2 -0.2752196 120.1047 -1.0094944 Sep 2 11.2646335 120.6091 -3.5537031 Oct 2 0.2192008 121.3515 -9.3306597 Nov 2 -16.9540216 122.0938 -0.6098264 Dec 2 7.6862844 122.9481 1.9356570 Jan 3 8.7783765 123.8023 -10.0606455 Feb 3 0.6956556 124.6557 6.4486260 Mar 3 -9.6204164 125.5092 8.6612485 Apr 3 -6.6964534 126.2240 1.4324684 May 3 -4.7024964 126.9388 0.3636943 Jun 3 9.9612133 127.3563 8.2024743 Jul 3 -0.3567520 127.7738 -8.8470707 Aug 3 -0.2752196 128.0747 6.4504868 Sep 3 11.2646335 128.3756 -2.9402765 Oct 3 0.2192008 128.7502 -7.5993964 Nov 3 -16.9540216 129.1247 -0.5407265 Dec 3 7.6862844 129.6932 -2.9594846 Jan 4 8.7783765 130.2617 -1.3900286 Feb 4 0.6956556 130.9599 6.2044790 Mar 4 -9.6204164 131.6581 -2.2676623 Apr 4 -6.6964534 132.4058 4.9806061 May 4 -4.7024964 133.1536 -0.1711195 Jun 4 9.9612133 133.8095 3.6793260 Jul 4 -0.3567520 134.4653 -5.6885535 Aug 4 -0.2752196 135.0551 2.1200726 Sep 4 11.2646335 135.6450 -2.9596219 Oct 4 0.2192008 136.4925 -1.0716686 Nov 4 -16.9540216 137.3399 2.0940747 Dec 4 7.6862844 138.5431 -9.3993847 Jan 5 8.7783765 139.7463 4.5153700 Feb 5 0.6956556 141.2343 0.7800940 Mar 5 -9.6204164 142.7222 -9.6418308 Apr 5 -6.6964534 144.1012 6.9652155 May 5 -4.7024964 145.4802 5.3722679 Jun 5 9.9612133 146.2558 -8.6070330 Jul 5 -0.3567520 147.0314 11.8353411 Aug 5 -0.2752196 146.4106 1.2646112 Sep 5 11.2646335 145.7898 7.9955606 Oct 5 0.2192008 143.6968 10.7240413 Nov 5 -16.9540216 141.6037 1.5503117 Dec 5 7.6862844 138.5045 11.1691914 Jan 6 8.7783765 135.4053 9.9662851 Feb 6 0.6956556 132.2133 -9.6989201 Mar 6 -9.6204164 129.0212 -6.3307741 Apr 6 -6.6964534 126.0001 -8.8536911 May 6 -4.7024964 122.9791 -4.7066019 Jun 6 9.9612133 119.9458 -7.4669888 Jul 6 -0.3567520 116.9125 -1.6257008 Aug 6 -0.2752196 113.9641 -1.8389224 Sep 6 11.2646335 111.0158 3.7595352 Oct 6 0.2192008 108.1897 12.9311283 > m$win s t l 701 19 13 > m$deg s t l 0 1 1 > m$jump s t l 71 2 2 > m$inner [1] 2 > m$outer [1] 0 > postscript(file="/var/www/html/rcomp/tmp/1habg1259862436.ps",horizontal=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/2u6uc1259862436.ps",horizontal=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/3iuvv1259862436.ps",horizontal=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/4mo5v1259862436.ps",horizontal=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/5rrz31259862436.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/6rm8u1259862436.tab") > > system("convert tmp/1habg1259862436.ps tmp/1habg1259862436.png") > system("convert tmp/2u6uc1259862436.ps tmp/2u6uc1259862436.png") > system("convert tmp/3iuvv1259862436.ps tmp/3iuvv1259862436.png") > system("convert tmp/4mo5v1259862436.ps tmp/4mo5v1259862436.png") > > > proc.time() user system elapsed 0.979 0.632 1.188