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(31514,27071,29462,26105,22397,23843,21705,18089,20764,25316,17704,15548,28029,29383,36438,32034,22679,24319,18004,17537,20366,22782,19169,13807,29743,25591,29096,26482,22405,27044,17970,18730,19684,19785,18479,10698,31956,29506,34506,27165,26736,23691,18157,17328,18205,20995,17382,9367,31124,26551,30651,25859,25100,25778,20418,18688,20424,24776,19814,12738,31566,30111,30019,31934,25826,26835,20205,17789,20520,22518,15572,11509,25447,24090,27786,26195,20516,22759,19028,16971,20036,22485,18730,14538) > 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 7051.6120 22084.33 2378.05459 Feb 1 4596.0759 22274.81 200.10923 Mar 1 8244.9693 22465.30 -1248.26570 Apr 1 5038.8745 22656.39 -1590.25976 May 1 699.7825 22847.47 -1150.25676 Jun 1 1915.0933 23031.74 -1103.82856 Jul 1 -3639.8827 23216.00 2128.88643 Aug 1 -5119.8561 23418.83 -209.97039 Sep 1 -2996.6888 23621.66 139.03193 Oct 1 -360.2638 23887.51 1788.75627 Nov 1 -4933.1229 24153.36 -1516.23541 Dec 1 -10496.5928 24206.13 1838.46634 Jan 2 7051.6120 24258.89 -3281.50659 Feb 2 4596.0759 24145.54 641.38204 Mar 2 8244.9693 24032.19 4160.84111 Apr 2 5038.8745 23937.53 3057.59383 May 2 699.7825 23842.87 -1863.65637 Jun 2 1915.0933 23737.25 -1333.34271 Jul 2 -3639.8827 23631.62 -1987.74225 Aug 2 -5119.8561 23396.41 -739.55573 Sep 2 -2996.6888 23161.20 201.48992 Oct 2 -360.2638 22927.69 214.57751 Nov 2 -4933.1229 22694.17 1407.94908 Dec 2 -10496.5928 22658.43 1645.16364 Jan 3 7051.6120 22622.68 68.70351 Feb 3 4596.0759 22603.89 -1608.96171 Mar 3 8244.9693 22585.09 -1734.05648 Apr 3 5038.8745 22494.95 -1051.82313 May 3 699.7825 22404.81 -699.59271 Jun 3 1915.0933 22401.78 2727.12701 Jul 3 -3639.8827 22398.75 -788.86647 Aug 3 -5119.8561 22590.03 1259.82628 Sep 3 -2996.6888 22781.31 -100.62183 Oct 3 -360.2638 22987.08 -2841.81723 Nov 3 -4933.1229 23192.85 219.27134 Dec 3 -10496.5928 23256.33 -2061.74161 Jan 4 7051.6120 23319.82 1584.57076 Feb 4 4596.0759 23300.02 1609.89916 Mar 4 8244.9693 23280.23 2980.79800 Apr 4 5038.8745 23202.71 -1076.58724 May 4 699.7825 23125.19 2911.02460 Jun 4 1915.0933 22959.08 -1183.17519 Jul 4 -3639.8827 22792.97 -996.08818 Aug 4 -5119.8561 22574.70 -126.84670 Sep 4 -2996.6888 22356.43 -1154.74607 Oct 4 -360.2638 22235.73 -880.46923 Nov 4 -4933.1229 22115.03 200.09160 Dec 4 -10496.5928 22178.68 -2315.08914 Jan 5 7051.6120 22242.33 1830.05545 Feb 5 4596.0759 22435.51 -480.58831 Mar 5 8244.9693 22628.69 -222.66162 Apr 5 5038.8745 22864.44 -2044.31721 May 5 699.7825 23100.19 1300.02427 Jun 5 1915.0933 23319.79 543.11883 Jul 5 -3639.8827 23539.38 518.50020 Aug 5 -5119.8561 23717.26 90.60062 Sep 5 -2996.6888 23895.13 -474.43982 Oct 5 -360.2638 24058.37 1077.89352 Nov 5 -4933.1229 24221.61 525.51084 Dec 5 -10496.5928 24304.79 -1070.19793 Jan 6 7051.6120 24387.97 126.41864 Feb 6 4596.0759 24372.10 1142.82082 Mar 6 8244.9693 24356.24 -2582.20655 Apr 6 5038.8745 24211.85 2683.27229 May 6 699.7825 24067.47 1058.74819 Jun 6 1915.0933 23774.99 1144.91975 Jul 6 -3639.8827 23482.50 362.37811 Aug 6 -5119.8561 23063.52 -154.66156 Sep 6 -2996.6888 22644.53 872.15791 Oct 6 -360.2638 22204.59 673.67098 Nov 6 -4933.1229 21764.65 -1259.53196 Dec 6 -10496.5928 21445.26 560.33153 Jan 7 7051.6120 21125.87 -2730.47966 Feb 7 4596.0759 21022.47 -1528.54679 Mar 7 8244.9693 20919.07 -1378.04349 Apr 7 5038.8745 21177.23 -21.10098 May 7 699.7825 21435.38 -1619.16141 Jun 7 1915.0933 21735.00 -891.08909 Jul 7 -3639.8827 22034.61 633.27005 Aug 7 -5119.8561 22368.18 -277.31908 Sep 7 -2996.6888 22701.74 330.95093 Oct 7 -360.2638 23067.24 -221.97163 Nov 7 -4933.1229 23432.73 230.38979 Dec 7 -10496.5928 23819.73 1214.85990 > m$win s t l 841 19 13 > m$deg s t l 0 1 1 > m$jump s t l 85 2 2 > m$inner [1] 2 > m$outer [1] 0 > postscript(file="/var/www/html/rcomp/tmp/1kalh1291910664.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/2kalh1291910664.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/3cj221291910664.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/4cj221291910664.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/59tit1291910664.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/6ctyh1291910664.tab") > > try(system("convert tmp/1kalh1291910664.ps tmp/1kalh1291910664.png",intern=TRUE)) character(0) > try(system("convert tmp/2kalh1291910664.ps tmp/2kalh1291910664.png",intern=TRUE)) character(0) > try(system("convert tmp/3cj221291910664.ps tmp/3cj221291910664.png",intern=TRUE)) character(0) > try(system("convert tmp/4cj221291910664.ps tmp/4cj221291910664.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.043 0.660 2.954