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(423.4,404.1,500,472.6,496.1,562,434.8,538.2,577.6,518.1,625.2,561.2,523.3,536.1,607.3,637.3,606.9,652.9,617.2,670.4,729.9,677.2,710,844.3,748.2,653.9,742.6,854.2,808.4,1819,1936.5,1966.1,2083.1,1620.1,1527.6,1795,1685.1,1851.8,2164.4,1981.8,1726.5,2144.6,1758.2,1672.9,1837.3,1596.1,1446,1898.4,1964.1,1755.9,2255.3,1881.2,2117.9,1656.5,1544.1,2098.9,2133.3,1963.5,1801.2,2365.4,1936.5,1667.6,1983.5,2058.6,2448.3,1858.1,1625.4,2130.6,2515.7,2230.2,2086.9,2235,2100.2,2288.6,2490,2573.7,2543.8,2004.7,2390,2338.4,2724.5,2292.5,2386,2477.9,2337,2605.1,2560.8,2839.3,2407.2,2085.2,2735.6,2798.7,3053.2,2405,2471.9,2727.3,2790.7,2385.4,3206.6,2705.6,3518.4,1954.9,2584.3,2535.8,2685.9,2866,2236.6,2934.9,2668.6,2371.2,3165.9,2887.2,3112.2,2671.2,2432.6,2812.3,3095.7,2862.9,2607.3,2862.5) > 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 -66.02086 449.4982 39.922687 Feb 1 -153.03559 460.0811 97.054508 Mar 1 141.35951 470.6640 -112.023513 Apr 1 45.28545 481.2503 -53.935767 May 1 117.12126 491.8366 -112.857890 Jun 1 -135.46808 502.2087 195.259334 Jul 1 -85.43745 512.5809 7.656596 Aug 1 48.64834 523.2229 -33.671263 Sep 1 219.76414 533.8650 -176.029135 Oct 1 -41.24078 545.1162 14.224534 Nov 1 -175.07554 556.3675 243.908052 Dec 1 84.09955 567.1716 -90.071103 Jan 2 -66.02086 577.9756 11.345243 Feb 2 -153.03559 588.9077 100.227907 Mar 2 141.35951 599.8398 -133.899272 Apr 2 45.28545 611.6975 -19.682955 May 2 117.12126 623.5552 -133.776507 Jun 2 -135.46808 638.7641 149.604014 Jul 2 -85.43745 653.9729 48.664572 Aug 2 48.64834 671.5518 -49.800164 Sep 2 219.76414 689.1308 -178.994912 Oct 2 -41.24078 712.6965 5.744263 Nov 2 -175.07554 736.2623 148.813287 Dec 2 84.09955 798.6274 -38.426987 Jan 3 -66.02086 860.9926 -46.771758 Feb 3 -153.03559 959.8513 -152.915674 Mar 3 141.35951 1058.7099 -457.469432 Apr 3 45.28545 1160.4549 -351.540379 May 3 117.12126 1262.1999 -570.921195 Jun 3 -135.46808 1356.8543 597.613796 Jul 3 -85.43745 1451.5086 570.428825 Aug 3 48.64834 1548.7995 368.652117 Sep 3 219.76414 1646.0905 217.245397 Oct 3 -41.24078 1719.2901 -57.949309 Nov 3 -175.07554 1792.4897 -89.814166 Dec 3 84.09955 1819.5120 -108.611543 Jan 4 -66.02086 1846.5343 -95.413416 Feb 4 -153.03559 1843.1301 161.705479 Mar 4 141.35951 1839.7260 183.314532 Apr 4 45.28545 1833.3828 103.131746 May 4 117.12126 1827.0396 -217.660909 Jun 4 -135.46808 1822.7548 457.313233 Jul 4 -85.43745 1818.4700 25.167412 Aug 4 48.64834 1818.2385 -193.986842 Sep 4 219.76414 1818.0070 -200.471108 Oct 4 -41.24078 1820.9416 -183.600835 Nov 4 -175.07554 1823.8763 -202.800714 Dec 4 84.09955 1828.3501 -14.049671 Jan 5 -66.02086 1832.8240 197.296875 Feb 5 -153.03559 1847.6826 61.252994 Mar 5 141.35951 1862.5412 251.399271 Apr 5 45.28545 1885.0613 -49.146711 May 5 117.12126 1907.5813 93.197438 Jun 5 -135.46808 1923.3977 -131.429587 Jul 5 -85.43745 1939.2140 -309.676575 Aug 5 48.64834 1942.8290 107.422673 Sep 5 219.76414 1946.4439 -32.908090 Oct 5 -41.24078 1955.8718 48.868985 Nov 5 -175.07554 1965.2996 10.975908 Dec 5 84.09955 1978.5410 302.759418 Jan 6 -66.02086 1991.7824 10.738431 Feb 6 -153.03559 2004.2804 -183.644828 Mar 6 141.35951 2016.7784 -174.637930 Apr 6 45.28545 2030.8447 -17.530202 May 6 117.12126 2044.9111 286.267657 Jun 6 -135.46808 2064.9214 -71.353312 Jul 6 -85.43745 2084.9317 -374.094243 Aug 6 48.64834 2115.2715 -33.319821 Sep 6 219.76414 2145.6113 150.324590 Oct 6 -41.24078 2180.0812 91.359546 Nov 6 -175.07554 2214.5512 47.424351 Dec 6 84.09955 2244.8274 -93.926962 Jan 7 -66.02086 2275.1036 -108.882773 Feb 7 -153.03559 2299.5822 142.053411 Mar 7 141.35951 2324.0607 24.579752 Apr 7 45.28545 2341.1886 187.225923 May 7 117.12126 2358.3165 68.362224 Jun 7 -135.46808 2375.5863 -235.418241 Jul 7 -85.43745 2392.8561 82.581332 Aug 7 48.64834 2409.1008 -119.349185 Sep 7 219.76414 2425.3456 79.390285 Oct 7 -41.24078 2438.4070 -104.666238 Nov 7 -175.07554 2451.4685 109.607088 Dec 7 84.09955 2466.5759 -72.775498 Jan 8 -66.02086 2481.6834 -78.662582 Feb 8 -153.03559 2502.7354 255.400156 Mar 8 141.35951 2523.7874 -104.346947 Apr 8 45.28545 2543.4956 250.518931 May 8 117.12126 2563.2038 -273.125060 Jun 8 -135.46808 2579.6852 -359.017119 Jul 8 -85.43745 2596.1666 224.870858 Aug 8 48.64834 2615.9137 134.137986 Sep 8 219.76414 2635.6608 197.775103 Oct 8 -41.24078 2663.4875 -217.246688 Nov 8 -175.07554 2691.3142 -44.338630 Dec 8 84.09955 2705.5714 -62.370944 Jan 9 -66.02086 2719.8286 136.892244 Feb 9 -153.03559 2713.2732 -174.837634 Mar 9 141.35951 2706.7178 358.522646 Apr 9 45.28545 2700.5539 -40.239334 May 9 117.12126 2694.3899 706.888816 Jun 9 -135.46808 2689.7070 -599.338922 Jul 9 -85.43745 2685.0241 -15.286623 Aug 9 48.64834 2679.4563 -192.304638 Sep 9 219.76414 2673.8885 -207.752665 Oct 9 -41.24078 2679.6382 227.602564 Nov 9 -175.07554 2685.3879 -273.712359 Dec 9 84.09955 2702.8133 147.987161 Jan 10 -66.02086 2720.2387 14.382184 Feb 10 -153.03559 2739.7256 -215.489998 Mar 10 141.35951 2759.2125 265.327978 Apr 10 45.28545 2768.9542 72.960360 May 10 117.12126 2778.6959 216.382873 Jun 10 -135.46808 2787.3204 19.347710 Jul 10 -85.43745 2795.9449 -277.907416 Aug 10 48.64834 2802.5946 -38.942936 Sep 10 219.76414 2809.2443 66.691532 Oct 10 -41.24078 2814.6404 89.500330 Nov 10 -175.07554 2820.0366 -37.661024 Dec 10 84.09955 2824.7517 -46.351211 > m$win s t l 1201 19 13 > m$deg s t l 0 1 1 > m$jump s t l 121 2 2 > m$inner [1] 2 > m$outer [1] 0 > postscript(file="/var/www/html/rcomp/tmp/18hlt1259786135.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/26nr11259786135.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/3conr1259786135.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/4hdi81259786135.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/5jucn1259786135.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/68p881259786135.tab") > system("convert tmp/18hlt1259786135.ps tmp/18hlt1259786135.png") > system("convert tmp/26nr11259786135.ps tmp/26nr11259786135.png") > system("convert tmp/3conr1259786135.ps tmp/3conr1259786135.png") > system("convert tmp/4hdi81259786135.ps tmp/4hdi81259786135.png") > > > proc.time() user system elapsed 1.194 0.692 1.540