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(135094,135411,135698,135880,135891,135971,136173,136358,136514,136506,136711,136891,137094,137182,137400,137479,137620,137687,137638,137612,137681,137772,137899,137983,137996,137913,137841,137656,137423,137245,137014,136747,136313,135804,135002,134383,133563,132837,132041,131381,130995,130493,130193,129962,129726,129505,129450,129320,129281,129246,129438,129715,130173,129981,129932,129873,129844,130015,130108,130260) > 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 11.7529679 135241.0 -158.784024 Feb 1 0.9119472 135395.8 14.288758 Mar 1 43.6708856 135550.6 103.761581 Apr 1 45.4199428 135704.8 129.761066 May 1 106.7690288 135859.1 -74.839478 Jun 1 22.2737536 136012.7 -63.960656 Jul 1 -2.6215933 136166.3 9.318239 Aug 1 -16.2672706 136318.2 56.055366 Sep 1 -45.1129801 136470.1 88.992525 Oct 1 -59.6061236 136614.5 -48.881113 Nov 1 -65.2993525 136758.9 17.445335 Dec 1 -41.8911459 136891.9 40.948858 Jan 2 11.7529679 137025.0 57.216475 Feb 2 0.9119472 137139.2 41.898023 Mar 2 43.6708856 137253.3 102.979613 Apr 2 45.4199428 137352.4 81.134968 May 2 106.7690288 137451.5 61.690294 Jun 2 22.2737536 137535.8 128.935395 Jul 2 -2.6215933 137620.0 20.580568 Aug 2 -16.2672706 137678.4 -50.146694 Sep 2 -45.1129801 137736.8 -10.673924 Oct 2 -59.6061236 137755.2 76.434063 Nov 2 -65.2993525 137773.6 190.742137 Dec 2 -41.8911459 137745.4 279.501701 Jan 3 11.7529679 137717.2 267.025358 Feb 3 0.9119472 137631.7 280.370994 Mar 3 43.6708856 137546.2 251.116672 Apr 3 45.4199428 137372.2 238.337075 May 3 106.7690288 137198.3 117.957450 Jun 3 22.2737536 136906.1 316.627212 Jul 3 -2.6215933 136613.9 402.697046 Aug 3 -16.2672706 136198.8 564.505295 Sep 3 -45.1129801 135783.6 574.513576 Oct 3 -59.6061236 135265.9 597.720980 Nov 3 -65.2993525 134748.2 319.128470 Dec 3 -41.8911459 134171.0 253.866704 Jan 4 11.7529679 133593.9 -42.630968 Feb 4 0.9119472 133015.6 -179.470335 Mar 4 43.6708856 132437.2 -439.909661 Apr 4 45.4199428 131921.2 -585.585083 May 4 106.7690288 131405.1 -516.860535 Jun 4 22.2737536 130996.7 -526.021998 Jul 4 -2.6215933 130588.4 -392.783389 Aug 4 -16.2672706 130308.1 -329.803177 Sep 4 -45.1129801 130027.7 -256.622933 Oct 4 -59.6061236 129877.9 -313.328240 Nov 4 -65.2993525 129728.1 -212.833462 Dec 4 -41.8911459 129677.0 -315.099293 Jan 5 11.7529679 129625.8 -356.601030 Feb 5 0.9119472 129632.2 -387.080592 Mar 5 43.6708856 129638.5 -244.160113 Apr 5 45.4199428 129696.6 -27.024557 May 5 106.7690288 129754.7 311.510971 Jun 5 22.2737536 129820.3 138.435071 Jul 5 -2.6215933 129885.9 48.759243 Aug 5 -16.2672706 129954.7 -65.471853 Sep 5 -45.1129801 130023.6 -134.502916 Oct 5 -59.6061236 130093.6 -18.985621 Nov 5 -65.2993525 130163.6 9.731760 Dec 5 -41.8911459 130234.0 67.890192 > 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] 2 > m$outer [1] 0 > postscript(file="/var/wessaorg/rcomp/tmp/1l5eq1322146010.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/22lsu1322146010.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/3zdb31322146010.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/47wtu1322146010.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/5jeub1322146010.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/6ptbe1322146010.tab") > > try(system("convert tmp/1l5eq1322146010.ps tmp/1l5eq1322146010.png",intern=TRUE)) character(0) > try(system("convert tmp/22lsu1322146010.ps tmp/22lsu1322146010.png",intern=TRUE)) character(0) > try(system("convert tmp/3zdb31322146010.ps tmp/3zdb31322146010.png",intern=TRUE)) character(0) > try(system("convert tmp/47wtu1322146010.ps tmp/47wtu1322146010.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.258 0.222 1.515