R version 2.8.0 (2008-10-20) Copyright (C) 2008 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. Natural language support but running in an English locale 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(2030 + ,1855 + ,1834 + ,2092 + ,2164 + ,2368 + ,2072 + ,2521 + ,1823 + ,1947 + ,2226 + ,1754 + ,1786 + ,2072 + ,1846 + ,2137 + ,2466 + ,2154 + ,2289 + ,2628 + ,2074 + ,2798 + ,2194 + ,2442 + ,2565 + ,2063 + ,2069 + ,2539 + ,1898 + ,2139 + ,2408 + ,2725 + ,2201 + ,2311 + ,2548 + ,2276 + ,2351 + ,2280 + ,2057 + ,2479 + ,2379 + ,2295 + ,2456 + ,2546 + ,2844 + ,2260 + ,2981 + ,2678 + ,3440 + ,2842 + ,2450 + ,2669 + ,2570 + ,2540 + ,2318 + ,2930 + ,2947 + ,2799 + ,2695 + ,2498 + ,2260 + ,2160 + ,2058 + ,2533 + ,2150 + ,2172 + ,2155 + ,3016 + ,2333 + ,2355 + ,2825 + ,2214 + ,2360 + ,2299 + ,1746 + ,2069 + ,2267 + ,1878 + ,2266 + ,2282 + ,2085 + ,2277 + ,2251 + ,1828 + ,1954 + ,1851 + ,1570 + ,1852 + ,2187 + ,1855 + ,2218 + ,2253 + ,2028 + ,2169 + ,1997 + ,2034 + ,1791 + ,1627 + ,1631 + ,2319 + ,1707 + ,1747 + ,2397 + ,2059 + ,2251 + ,2558 + ,2406 + ,2049 + ,2074 + ,1734 + ,1983 + ,2121 + ,1905 + ,2126 + ,2363 + ,2173 + ,2710 + ,2137 + ,2742 + ,2419 + ,2194 + ,2660 + ,2189 + ,2310 + ,2349 + ,2540 + ,2434 + ,2916 + ,2446 + ,2375 + ,3032 + ,2218 + ,1920 + ,2039 + ,1889 + ,2014 + ,2105 + ,2153 + ,2309 + ,2955 + ,2225 + ,2160 + ,2386 + ,1653 + ,1099 + ,5010 + ,2672 + ,2729 + ,2955 + ,2409 + ,3086 + ,3384 + ,2458 + ,2913 + ,2448 + ,2215 + ,2179 + ,2461 + ,2098 + ,2621 + ,2703 + ,2388 + ,3880 + ,3310 + ,3093 + ,3237 + ,3002 + ,2670 + ,2311 + ,2062 + ,2059 + ,2465 + ,2213 + ,2028 + ,2322 + ,2825 + ,2687 + ,2373 + ,2889 + ,2708 + ,2542 + ,2477 + ,2419 + ,2977 + ,3001 + ,3075 + ,2870 + ,3756 + ,3443 + ,2948 + ,3560 + ,3257 + ,2600 + ,2741 + ,2349 + ,2783 + ,2845 + ,2987 + ,2696 + ,3874 + ,2912 + ,2743 + ,3857 + ,2660 + ,2226 + ,2942 + ,2420 + ,2516 + ,2421 + ,2631 + ,2887 + ,3328 + ,2587 + ,2695 + ,3669 + ,2773 + ,2527 + ,2750 + ,2014 + ,2763 + ,2726 + ,1826 + ,2713 + ,3040 + ,2405 + ,2526 + ,2526 + ,2529 + ,2474 + ,2576 + ,2219 + ,2900 + ,2274 + ,2184 + ,2629 + ,2739 + ,2933 + ,3144 + ,3354 + ,3357 + ,3329) > 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 -187.4402629 2174.267 43.173745 Feb 1 -13.4608923 2156.881 -288.420178 Mar 1 -362.0486604 2139.496 56.553038 Apr 1 -0.6432559 2122.215 -29.571644 May 1 -85.1876880 2104.934 144.253510 Jun 1 -179.6558886 2090.412 457.243998 Jul 1 79.0259927 2075.890 -82.915596 Aug 1 399.1386821 2065.285 56.576260 Sep 1 55.9015921 2054.681 -287.582105 Oct 1 63.4330677 2049.578 -166.011144 Nov 1 302.1146233 2044.476 -120.590263 Dec 1 -71.1772917 2057.032 -231.854703 Jan 2 -187.4402629 2069.588 -96.148086 Feb 2 -13.4608923 2096.937 -11.476046 Mar 2 -362.0486604 2124.286 83.763132 Apr 2 -0.6432559 2159.407 -21.763473 May 2 -85.1876880 2194.528 356.659758 Jun 2 -179.6558886 2229.951 103.705086 Jul 2 79.0259927 2265.374 -55.399668 Aug 2 399.1386821 2289.097 -60.235964 Sep 2 55.9015921 2312.821 -294.722481 Oct 2 63.4330677 2319.831 414.736261 Nov 2 302.1146233 2326.840 -434.955076 Dec 2 -71.1772917 2326.954 186.223531 Jan 3 -187.4402629 2327.067 425.373194 Feb 3 -13.4608923 2327.218 -250.756619 Mar 3 -362.0486604 2327.368 103.680707 Apr 3 -0.6432559 2320.659 218.984034 May 3 -85.1876880 2313.950 -330.762803 Jun 3 -179.6558886 2307.264 11.391641 Jul 3 79.0259927 2300.578 28.396003 Aug 3 399.1386821 2301.398 24.463816 Sep 3 55.9015921 2302.217 -157.118592 Oct 3 63.4330677 2314.439 -66.872157 Nov 3 302.1146233 2326.661 -80.775802 Dec 3 -71.1772917 2342.035 5.142773 Jan 4 -187.4402629 2357.408 181.032404 Feb 4 -13.4608923 2371.663 -78.202440 Mar 4 -362.0486604 2385.919 33.129854 Apr 4 -0.6432559 2404.726 74.917032 May 4 -85.1876880 2423.534 40.654046 Jun 4 -179.6558886 2461.357 13.298763 Jul 4 79.0259927 2499.181 -122.206601 Aug 4 399.1386821 2546.999 -400.138140 Sep 4 55.9015921 2594.818 193.280101 Oct 4 63.4330677 2633.061 -436.493761 Nov 4 302.1146233 2671.303 7.582298 Dec 4 -71.1772917 2692.326 56.850940 Jan 5 -187.4402629 2713.350 914.090639 Feb 5 -13.4608923 2726.230 129.231232 Mar 5 -362.0486604 2739.110 72.938964 Apr 5 -0.6432559 2732.953 -63.309829 May 5 -85.1876880 2726.796 -71.608784 Jun 5 -179.6558886 2692.207 27.448708 Jul 5 79.0259927 2657.618 -418.643881 Aug 5 399.1386821 2612.811 -81.949808 Sep 5 55.9015921 2568.004 323.094045 Oct 5 63.4330677 2539.145 196.422395 Nov 5 302.1146233 2510.285 -117.399335 Dec 5 -71.1772917 2485.413 83.764426 Jan 6 -187.4402629 2460.541 -13.100756 Feb 6 -13.4608923 2435.808 -262.347509 Mar 6 -362.0486604 2411.076 8.972877 Apr 6 -0.6432559 2390.398 143.245447 May 6 -85.1876880 2369.720 -134.532147 Jun 6 -179.6558886 2364.430 -12.774062 Jul 6 79.0259927 2359.140 -283.166059 Aug 6 399.1386821 2354.624 262.236818 Sep 6 55.9015921 2350.109 -73.010525 Oct 6 63.4330677 2338.887 -47.319848 Nov 6 302.1146233 2327.665 195.220749 Dec 6 -71.1772917 2311.232 -26.054660 Jan 7 -187.4402629 2294.799 252.640987 Feb 7 -13.4608923 2269.040 43.420838 Mar 7 -362.0486604 2243.281 -135.232173 Apr 7 -0.6432559 2211.121 -141.477676 May 7 -85.1876880 2178.961 173.226657 Jun 7 -179.6558886 2146.484 -88.827875 Jul 7 79.0259927 2114.006 72.967511 Aug 7 399.1386821 2086.545 -203.683496 Sep 7 55.9015921 2059.083 -29.984724 Oct 7 63.4330677 2042.956 170.610465 Nov 7 302.1146233 2026.830 -77.944426 Dec 7 -71.1772917 2020.173 -120.995779 Jan 8 -187.4402629 2013.516 127.923923 Feb 8 -13.4608923 2011.176 -146.714835 Mar 8 -362.0486604 2008.835 -76.786455 Apr 8 -0.6432559 2003.909 -151.265270 May 8 -85.1876880 1998.982 273.205752 Jun 8 -179.6558886 1994.614 40.041831 Jul 8 79.0259927 1990.246 148.727829 Aug 8 399.1386821 1985.389 -131.527951 Sep 8 55.9015921 1980.532 -8.433952 Oct 8 63.4330677 1976.025 129.542187 Nov 8 302.1146233 1971.517 -276.631754 Dec 8 -71.1772917 1967.773 137.404351 Jan 9 -187.4402629 1964.029 14.411513 Feb 9 -13.4608923 1970.136 -329.675151 Mar 9 -362.0486604 1976.243 16.805324 Apr 9 -0.6432559 1995.610 324.033386 May 9 -85.1876880 2014.976 -222.788717 Jun 9 -179.6558886 2037.309 -110.652909 Jul 9 79.0259927 2059.641 258.332816 Aug 9 399.1386821 2075.879 -416.017833 Sep 9 55.9015921 2092.117 102.981297 Oct 9 63.4330677 2102.881 391.685980 Nov 9 302.1146233 2113.645 -9.759417 Dec 9 -71.1772917 2124.625 -4.447225 Jan 10 -187.4402629 2135.604 125.836022 Feb 10 -13.4608923 2142.782 -395.320766 Mar 10 -362.0486604 2149.959 195.089585 Apr 10 -0.6432559 2159.132 -37.488859 May 10 -85.1876880 2168.305 -178.117467 Jun 10 -179.6558886 2192.214 113.441890 Jul 10 79.0259927 2216.123 67.851164 Aug 10 399.1386821 2251.445 -477.584156 Sep 10 55.9015921 2286.768 367.330303 Oct 10 63.4330677 2319.968 -246.400814 Nov 10 302.1146233 2353.167 86.717988 Dec 10 -71.1772917 2383.194 106.983540 Jan 11 -187.4402629 2413.220 -31.779852 Feb 11 -13.4608923 2434.313 239.148098 Mar 11 -362.0486604 2455.405 95.643188 Apr 11 -0.6432559 2464.044 -153.400410 May 11 -85.1876880 2472.682 -38.494172 Jun 11 -179.6558886 2463.346 256.310132 Jul 11 79.0259927 2454.010 -99.035645 Aug 11 399.1386821 2427.675 89.186417 Sep 11 55.9015921 2401.340 -11.241740 Oct 11 63.4330677 2370.102 -58.535049 Nov 11 302.1146233 2338.864 391.021563 Dec 11 -71.1772917 2314.452 -25.274285 Jan 12 -187.4402629 2290.039 -182.599076 Feb 12 -13.4608923 2273.709 -221.247706 Mar 12 -362.0486604 2257.378 -6.329197 Apr 12 -0.6432559 2236.914 -222.270432 May 12 -85.1876880 2216.450 -26.261831 Jun 12 -179.6558886 2205.010 127.645974 Jul 12 79.0259927 2193.570 36.403698 Aug 12 399.1386821 2245.520 310.340950 Sep 12 55.9015921 2297.470 -128.372019 Oct 12 63.4330677 2373.894 -277.326730 Nov 12 302.1146233 2450.317 -366.431520 Dec 12 -71.1772917 2515.765 -791.587446 Jan 13 -187.4402629 2581.213 -1294.772316 Feb 13 -13.4608923 2637.601 2385.859927 Mar 13 -362.0486604 2693.989 340.059307 Apr 13 -0.6432559 2738.158 -8.514693 May 13 -85.1876880 2782.327 257.861144 Jun 13 -179.6558886 2779.092 -190.436340 Jul 13 79.0259927 2775.858 231.116095 Aug 13 399.1386821 2721.195 263.666659 Sep 13 55.9015921 2666.531 -264.432997 Oct 13 63.4330677 2622.758 226.808795 Nov 13 302.1146233 2578.985 -433.099493 Dec 13 -71.1772917 2580.726 -294.548435 Jan 14 -187.4402629 2582.467 -216.026321 Feb 14 -13.4608923 2616.593 -142.132551 Mar 14 -362.0486604 2650.720 -190.671643 Apr 14 -0.6432559 2702.096 -80.453168 May 14 -85.1876880 2753.473 34.715142 Jun 14 -179.6558886 2788.851 -221.195457 Jul 14 79.0259927 2824.230 976.743862 Aug 14 399.1386821 2822.029 88.831955 Sep 14 55.9015921 2819.829 217.269827 Oct 14 63.4330677 2782.827 390.740076 Nov 14 302.1146233 2745.825 -45.939755 Dec 14 -71.1772917 2680.495 60.682783 Jan 15 -187.4402629 2615.164 -116.723622 Feb 15 -13.4608923 2549.004 -473.543469 Mar 15 -362.0486604 2482.845 -61.796178 Apr 15 -0.6432559 2447.796 17.847578 May 15 -85.1876880 2412.747 -114.558829 Jun 15 -179.6558886 2415.983 -208.327209 Jul 15 79.0259927 2419.220 -176.245672 Aug 15 399.1386821 2449.095 -23.234176 Sep 15 55.9015921 2478.971 152.127099 Oct 15 63.4330677 2528.825 -219.258515 Nov 15 302.1146233 2578.680 8.205791 Dec 15 -71.1772917 2642.828 136.349521 Jan 16 -187.4402629 2706.976 22.464307 Feb 16 -13.4608923 2773.411 -282.949864 Mar 16 -362.0486604 2839.846 -58.796898 Apr 16 -0.6432559 2897.895 79.748561 May 16 -85.1876880 2955.944 130.243856 Jun 16 -179.6558886 2997.421 257.235092 Jul 16 79.0259927 3038.898 -247.923753 Aug 16 399.1386821 3050.809 306.052067 Sep 16 55.9015921 3062.721 324.377665 Oct 16 63.4330677 3050.230 -165.663150 Nov 16 302.1146233 3037.739 220.145955 Dec 16 -71.1772917 3018.028 310.149196 Jan 17 -187.4402629 2998.317 -210.876507 Feb 17 -13.4608923 2981.321 -226.860000 Mar 17 -362.0486604 2964.325 -253.276354 Apr 17 -0.6432559 2952.883 -169.239785 May 17 -85.1876880 2941.441 -11.253379 Jun 17 -179.6558886 2934.415 232.240638 Jul 17 79.0259927 2927.389 -310.415427 Aug 17 399.1386821 2922.159 552.702213 Sep 17 55.9015921 2916.929 -60.830367 Oct 17 63.4330677 2897.974 -218.406807 Nov 17 302.1146233 2879.019 675.866674 Dec 17 -71.1772917 2852.493 -121.315828 Jan 18 -187.4402629 2825.968 -412.527273 Feb 18 -13.4608923 2800.479 154.982109 Mar 18 -362.0486604 2774.990 7.058629 Apr 18 -0.6432559 2763.244 -246.600897 May 18 -85.1876880 2751.498 -245.310586 Jun 18 -179.6558886 2754.524 56.131692 Jul 18 79.0259927 2757.550 50.423888 Aug 18 399.1386821 2763.444 165.416872 Sep 18 55.9015921 2769.339 -238.240364 Oct 18 63.4330677 2764.936 -133.369148 Nov 18 302.1146233 2760.533 606.351989 Dec 18 -71.1772917 2742.176 102.001721 Jan 19 -187.4402629 2723.818 -9.377490 Feb 19 -13.4608923 2693.873 69.588234 Mar 19 -362.0486604 2663.928 -287.878903 Apr 19 -0.6432559 2626.142 137.501346 May 19 -85.1876880 2588.356 222.831432 Jun 19 -179.6558886 2556.781 -551.124941 Jul 19 79.0259927 2525.205 108.768604 Aug 19 399.1386821 2517.777 123.084088 Sep 19 55.9015921 2510.349 -161.250649 Oct 19 63.4330677 2514.223 -51.656050 Nov 19 302.1146233 2518.097 -294.211531 Dec 19 -71.1772917 2521.154 79.023531 Jan 20 -187.4402629 2524.211 137.229649 Feb 20 -13.4608923 2534.995 54.466020 Mar 20 -362.0486604 2545.779 35.269529 Apr 20 -0.6432559 2591.234 309.409326 May 20 -85.1876880 2636.689 -277.501041 Jun 20 -179.6558886 2708.580 -344.924557 Jul 20 79.0259927 2780.472 -230.498155 Aug 20 399.1386821 2852.210 -512.349164 Sep 20 55.9015921 2923.949 -46.850393 Oct 20 63.4330677 2999.319 81.247905 Nov 20 302.1146233 3074.689 -22.803878 Dec 20 -71.1772917 3156.746 271.431495 Jan 21 -187.4402629 3238.802 277.637923 > m$win s t l 2411 19 13 > m$deg s t l 0 1 1 > m$jump s t l 242 2 2 > m$inner [1] 2 > m$outer [1] 0 > postscript(file="/var/www/html/freestat/rcomp/tmp/137v81293526764.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/freestat/rcomp/tmp/237v81293526764.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/freestat/rcomp/tmp/3vgcb1293526764.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/freestat/rcomp/tmp/4vgcb1293526764.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/freestat/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/html/freestat/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/freestat/rcomp/tmp/59qsk1293526764.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/freestat/rcomp/tmp/6dq8p1293526764.tab") > > try(system("convert tmp/137v81293526764.ps tmp/137v81293526764.png",intern=TRUE)) character(0) > try(system("convert tmp/237v81293526764.ps tmp/237v81293526764.png",intern=TRUE)) character(0) > try(system("convert tmp/3vgcb1293526764.ps tmp/3vgcb1293526764.png",intern=TRUE)) character(0) > try(system("convert tmp/4vgcb1293526764.ps tmp/4vgcb1293526764.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.885 0.962 3.063