R version 2.12.0 (2010-10-15) Copyright (C) 2010 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(1145.11 + ,1176.86 + ,1206.41 + ,1192.72 + ,1214.82 + ,1199.07 + ,1157.47 + ,1100.1 + ,1095.63 + ,1105.63 + ,1137.79 + ,1124.72 + ,1152.6 + ,1211.85 + ,1239.62 + ,1244.13 + ,1198.42 + ,1227.99 + ,1304.92 + ,1340.26 + ,1307.32 + ,1356.51 + ,1383.29 + ,1437.87 + ,1494.56 + ,1521.42 + ,1498.76 + ,1488.75 + ,1524.62 + ,1439.27 + ,1423.11 + ,1466.85 + ,1425.83 + ,1363.45 + ,1389.18 + ,1395.89 + ,1368.43 + ,1349.03 + ,1299.88 + ,1365.41 + ,1451.04 + ,1433.75 + ,1464.65 + ,1475.57 + ,1471.16 + ,1429.12 + ,1452.46 + ,1538.09 + ,1631.59 + ,1665.5 + ,1690.6 + ,1711.74 + ,1734.1 + ,1748.09 + ,1703.45 + ,1745.74 + ,1751.01 + ,1795.65 + ,1852.13 + ,1877.1 + ,1989.31 + ,2097.76 + ,2154.87 + ,2152.18 + ,2250.27 + ,2346.9 + ,2525.56 + ,2409.36 + ,2394.36 + ,2401.33 + ,2354.32 + ,2450.41 + ,2504.67 + ,2661.39 + ,2880.4 + ,3064.42 + ,3141.12 + ,3327.7 + ,3564.95 + ,3403.13 + ,3149.9 + ,3006.84 + ,3230.66 + ,3361.13 + ,3484.74 + ,3411.13 + ,3288.18 + ,3280.37 + ,3173.95 + ,3165.26 + ,3092.71 + ,3053.05 + ,3181.96 + ,2999.93 + ,3249.57 + ,3210.52 + ,3030.29 + ,2803.47 + ,2767.63 + ,2882.6 + ,2863.36 + ,2897.06 + ,3012.61 + ,3142.95 + ,3032.93 + ,3045.78 + ,3110.52 + ,3013.24 + ,2987.1 + ,2995.55 + ,2833.18 + ,2848.96 + ,2794.83 + ,2845.26 + ,2915.02 + ,2892.63 + ,2604.42 + ,2641.65 + ,2659.81 + ,2638.53 + ,2720.25 + ,2745.88 + ,2735.7 + ,2811.7 + ,2799.43 + ,2555.28 + ,2304.98 + ,2214.95 + ,2065.81 + ,1940.49 + ,2042 + ,1995.37 + ,1946.81 + ,1765.9 + ,1635.25 + ,1833.42 + ,1910.43 + ,1959.67 + ,1969.6 + ,2061.41 + ,2093.48 + ,2120.88 + ,2174.56 + ,2196.72 + ,2350.44 + ,2440.25 + ,2408.64 + ,2472.81 + ,2407.6 + ,2454.62 + ,2448.05 + ,2497.84 + ,2645.64 + ,2756.76 + ,2849.27 + ,2921.44 + ,2981.85 + ,3080.58 + ,3106.22 + ,3119.31 + ,3061.26 + ,3097.31 + ,3161.69 + ,3257.16 + ,3277.01 + ,3295.32 + ,3363.99 + ,3494.17 + ,3667.03 + ,3813.06 + ,3917.96 + ,3895.51 + ,3801.06 + ,3570.12 + ,3701.61 + ,3862.27 + ,3970.1 + ,4138.52 + ,4199.75 + ,4290.89 + ,4443.91 + ,4502.64 + ,4356.98 + ,4591.27 + ,4696.96 + ,4621.4 + ,4562.84 + ,4202.52 + ,4296.49 + ,4435.23 + ,4105.18 + ,4116.68 + ,3844.49 + ,3720.98 + ,3674.4 + ,3857.62 + ,3801.06 + ,3504.37 + ,3032.6 + ,3047.03 + ,2962.34 + ,2197.82 + ,2014.45 + ,1862.83 + ,1905.41 + ,1810.99 + ,1670.07 + ,1864.44 + ,2052.02 + ,2029.6 + ,2070.83 + ,2293.41 + ,2443.27 + ,2513.17 + ,2466.92 + ,2502.66) > 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 4.656821 1165.528 -25.0749881 Feb 1 5.669325 1163.789 7.4011820 Mar 1 -23.048162 1162.051 67.4073431 Apr 1 42.472925 1161.038 -10.7908296 May 1 46.126211 1160.025 8.6687986 Jun 1 16.400191 1159.800 22.8700559 Jul 1 11.538619 1159.575 -13.6431338 Aug 1 9.800863 1159.496 -69.1970706 Sep 1 -11.223040 1159.418 -52.5648586 Oct 1 -52.439278 1160.778 -2.7089621 Nov 1 -31.636010 1162.139 7.2874292 Dec 1 -18.318459 1169.669 -26.6303870 Jan 2 4.656821 1177.199 -29.2559313 Feb 2 5.669325 1191.446 14.7343698 Mar 2 -23.048162 1205.694 56.9746619 Apr 2 42.472925 1225.728 -24.0713648 May 2 46.126211 1245.763 -93.4695906 Jun 2 16.400191 1269.947 -58.3574376 Jul 2 11.538619 1294.131 -0.7497316 Aug 2 9.800863 1320.794 9.6649417 Sep 2 -11.223040 1347.457 -28.9142362 Oct 2 -52.439278 1372.365 36.5846081 Nov 2 -31.636010 1397.272 17.6539472 Dec 2 -18.318459 1415.716 40.4729045 Jan 3 4.656821 1434.159 55.7441336 Feb 3 5.669325 1443.418 72.3323196 Mar 3 -23.048162 1452.678 69.1304967 Apr 3 42.472925 1454.224 -7.9473912 May 3 46.126211 1455.771 22.7225219 Jun 3 16.400191 1449.856 -26.9861519 Jul 3 11.538619 1443.941 -32.3692727 Aug 3 9.800863 1432.732 24.3173601 Sep 3 -11.223040 1421.523 15.5301415 Oct 3 -52.439278 1411.459 4.4299156 Nov 3 -31.636010 1401.396 19.4201843 Dec 3 -18.318459 1397.173 17.0353258 Jan 4 4.656821 1392.950 -29.1772609 Feb 4 5.669325 1394.312 -50.9513773 Mar 4 -23.048162 1395.674 -72.7455027 Apr 4 42.472925 1402.111 -79.1735796 May 4 46.126211 1408.548 -3.6338556 Jun 4 16.400191 1423.592 -6.2423119 Jul 4 11.538619 1438.637 14.4747849 Aug 4 9.800863 1463.370 2.3988175 Sep 4 -11.223040 1488.104 -5.7210013 Oct 4 -52.439278 1515.970 -34.4103185 Nov 4 -31.636010 1543.835 -59.7391410 Dec 4 -18.318459 1569.330 -12.9218448 Jan 5 4.656821 1594.825 32.1077232 Feb 5 5.669325 1619.489 40.3412999 Mar 5 -23.048162 1644.153 69.4948676 Apr 5 42.472925 1670.733 -1.4659879 May 5 46.126211 1697.313 -9.3390425 Jun 5 16.400191 1725.940 5.7496104 Jul 5 11.538619 1754.568 -62.6561836 Aug 5 9.800863 1788.171 -52.2315941 Sep 5 -11.223040 1821.774 -59.5408560 Oct 5 -52.439278 1863.323 -15.2334830 Nov 5 -31.636010 1904.872 -21.1056154 Dec 5 -18.318459 1957.245 -61.8269556 Jan 6 4.656821 2009.619 -24.9660240 Feb 6 5.669325 2066.969 25.1212426 Mar 6 -23.048162 2124.320 53.5985003 Apr 6 42.472925 2177.079 -67.3721920 May 6 46.126211 2229.839 -25.6950832 Jun 6 16.400191 2275.872 54.6282263 Jul 6 11.538619 2321.904 192.1170889 Aug 6 9.800863 2371.243 28.3162016 Sep 6 -11.223040 2420.582 -14.9985370 Oct 6 -52.439278 2482.863 -29.0941451 Nov 6 -31.636010 2545.145 -159.1892585 Dec 6 -18.318459 2623.490 -154.7610765 Jan 7 4.656821 2701.834 -201.8206226 Feb 7 5.669325 2784.857 -129.1362959 Mar 7 -23.048162 2867.880 35.5680218 Apr 7 42.472925 2945.300 76.6466019 May 7 46.126211 3022.721 72.2729829 Jun 7 16.400191 3092.383 218.9169698 Jul 7 11.538619 3162.045 391.3665098 Aug 7 9.800863 3212.885 180.4445714 Sep 7 -11.223040 3263.724 -102.6012185 Oct 7 -52.439278 3280.886 -221.6065532 Nov 7 -31.636010 3298.047 -35.7513933 Dec 7 -18.318459 3287.819 91.6295133 Jan 8 4.656821 3277.590 202.4926918 Feb 8 5.669325 3260.856 144.6046417 Mar 8 -23.048162 3244.122 67.1065828 Apr 8 42.472925 3231.858 6.0388937 May 8 46.126211 3219.595 -91.7709944 Jun 8 16.400191 3198.932 -50.0721381 Jul 8 11.538619 3178.269 -97.0977287 Aug 8 9.800863 3146.402 -103.1524743 Sep 8 -11.223040 3114.534 78.6489287 Oct 8 -52.439278 3082.912 -30.5422841 Nov 8 -31.636010 3051.289 229.9169977 Dec 8 -18.318459 3028.784 200.0542093 Jan 9 4.656821 3006.279 19.3536926 Feb 9 5.669325 2993.789 -195.9886710 Mar 9 -23.048162 2981.299 -190.6210435 Apr 9 42.472925 2975.270 -135.1430674 May 9 46.126211 2969.241 -152.0072902 Jun 9 16.400191 2971.012 -90.3522857 Jul 9 11.538619 2972.783 28.2882718 Aug 9 9.800863 2981.507 151.6416658 Sep 9 -11.223040 2990.232 53.9212085 Oct 9 -52.439278 2990.904 107.3152374 Nov 9 -31.636010 2991.576 150.5797611 Dec 9 -18.318459 2979.224 52.3349370 Jan 10 4.656821 2966.871 15.5723848 Feb 10 5.669325 2942.160 47.7206469 Mar 10 -23.048162 2917.449 -61.2210998 Apr 10 42.472925 2885.637 -79.1501378 May 10 46.126211 2853.825 -105.1213749 Jun 10 16.400191 2824.628 4.2320507 Jul 10 11.538619 2795.430 108.0510293 Aug 10 9.800863 2777.781 105.0477639 Sep 10 -11.223040 2760.132 -144.4893528 Oct 10 -52.439278 2749.643 -55.5535146 Nov 10 -31.636010 2739.153 -47.7071817 Dec 10 -18.318459 2717.958 -61.1099486 Jan 11 4.656821 2696.764 18.8295562 Feb 11 5.669325 2655.972 84.2390333 Mar 11 -23.048162 2615.180 143.5685014 Apr 11 42.472925 2560.870 208.3566378 May 11 46.126211 2506.561 246.7425751 Jun 11 16.400191 2439.518 99.3619628 Jul 11 11.538619 2372.474 -79.0330964 Aug 11 9.800863 2291.441 -86.2915247 Sep 11 -11.223040 2210.407 -133.3738042 Oct 11 -52.439278 2132.027 -139.0978652 Nov 11 -31.636010 2053.647 19.9885685 Dec 11 -18.318459 2002.939 10.7493978 Jan 12 4.656821 1952.231 -10.0775011 Feb 12 5.669325 1936.159 -175.9285818 Mar 12 -23.048162 1920.088 -261.7896714 Apr 12 42.472925 1928.450 -137.5031312 May 12 46.126211 1936.813 -72.5087900 Jun 12 16.400191 1966.215 -22.9451841 Jul 12 11.538619 1995.617 -37.5560251 Aug 12 9.800863 2045.067 6.5420322 Sep 12 -11.223040 2094.517 10.1862383 Oct 12 -52.439278 2147.426 25.8931461 Nov 12 -31.636010 2200.335 5.8605486 Dec 12 -18.318459 2244.031 -28.9920859 Jan 13 4.656821 2287.726 58.0575515 Feb 13 5.669325 2328.212 106.3689159 Mar 13 -23.048162 2368.698 62.9902715 Apr 13 42.472925 2415.100 15.2367401 May 13 46.126211 2461.503 -100.0289904 Jun 13 16.400191 2514.806 -76.5858042 Jul 13 11.538619 2568.108 -131.5970649 Aug 13 9.800863 2626.367 -138.3274061 Sep 13 -11.223040 2684.625 -27.7615985 Oct 13 -52.439278 2745.353 63.8467600 Nov 13 -31.636010 2806.080 74.8256131 Dec 13 -18.318459 2864.911 74.8472375 Jan 14 4.656821 2923.742 53.4511336 Feb 14 5.669325 2976.237 98.6739625 Mar 14 -23.048162 3028.731 100.5367824 Apr 14 42.472925 3074.274 2.5630316 May 14 46.126211 3119.817 -104.6829183 Jun 14 16.400191 3167.336 -86.4266663 Jul 14 11.538619 3214.856 -64.7048612 Aug 14 9.800863 3274.786 -27.4268067 Sep 14 -11.223040 3334.716 -46.4826036 Oct 14 -52.439278 3400.528 -52.7689658 Nov 14 -31.636010 3466.341 -70.7148334 Dec 14 -18.318459 3523.492 -11.0033226 Jan 15 4.656821 3580.643 81.7304600 Feb 15 5.669325 3631.996 175.3942790 Mar 15 -23.048162 3683.350 257.6580890 Apr 15 42.472925 3739.718 113.3187684 May 15 46.126211 3796.087 -41.1527513 Jun 15 16.400191 3855.359 -301.6395456 Jul 15 11.538619 3914.632 -224.5607869 Aug 15 9.800863 3973.911 -121.4420680 Sep 15 -11.223040 4033.190 -51.8672005 Oct 15 -52.439278 4102.161 88.7980836 Nov 15 -31.636010 4171.132 60.2538623 Dec 15 -18.318459 4243.147 66.0613029 Jan 16 4.656821 4315.162 124.0910154 Feb 16 5.669325 4361.685 135.2852507 Mar 16 -23.048162 4408.209 -28.1805229 Apr 16 42.472925 4420.573 128.2240315 May 16 46.126211 4432.937 217.8963869 Jun 16 16.400191 4410.873 194.1269170 Jul 16 11.538619 4388.808 162.4930001 Aug 16 9.800863 4334.249 -141.5299519 Sep 16 -11.223040 4279.690 28.0232448 Oct 16 -52.439278 4205.923 281.7462702 Nov 16 -31.636010 4132.156 4.6597902 Dec 16 -18.318459 4039.900 95.0982480 Jan 17 4.656821 3947.644 -107.8110224 Feb 17 5.669325 3833.305 -117.9946970 Mar 17 -23.048162 3718.967 -21.5183804 Apr 17 42.472925 3569.776 245.3710777 May 17 46.126211 3420.585 334.3483368 Jun 17 16.400191 3247.708 240.2618751 Jul 17 11.538619 3074.830 -53.7690335 Aug 17 9.800863 2895.109 142.1206264 Sep 17 -11.223040 2715.387 258.1764351 Oct 17 -52.439278 2549.423 -299.1638327 Nov 17 -31.636010 2383.460 -337.3736057 Dec 17 -18.318459 2260.831 -379.6828049 Jan 18 4.656821 2138.203 -237.4497322 Feb 18 5.669325 2083.340 -278.0188676 Mar 18 -23.048162 2028.476 -335.3580120 Apr 18 42.472925 2070.318 -248.3505141 May 18 46.126211 2112.159 -106.2652152 Jun 18 16.400191 2158.133 -144.9328880 Jul 18 11.538619 2204.106 -144.8150078 Aug 18 9.800863 2256.866 26.7433818 Sep 18 -11.223040 2309.625 144.8679200 Oct 18 -52.439278 2369.631 195.9779647 Nov 18 -31.636010 2429.638 68.9185042 Dec 18 -18.318459 2494.121 26.8579385 > m$win s t l 2161 19 13 > m$deg s t l 0 1 1 > m$jump s t l 217 2 2 > m$inner [1] 2 > m$outer [1] 0 > postscript(file="/var/www/rcomp/tmp/1k9zc1291731787.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/rcomp/tmp/2k9zc1291731787.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/rcomp/tmp/3v0yf1291731787.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/rcomp/tmp/4v0yf1291731787.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/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/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/rcomp/tmp/5wv3u1291731787.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/rcomp/tmp/6cbvt1291731787.tab") > > try(system("convert tmp/1k9zc1291731787.ps tmp/1k9zc1291731787.png",intern=TRUE)) character(0) > try(system("convert tmp/2k9zc1291731787.ps tmp/2k9zc1291731787.png",intern=TRUE)) character(0) > try(system("convert tmp/3v0yf1291731787.ps tmp/3v0yf1291731787.png",intern=TRUE)) character(0) > try(system("convert tmp/4v0yf1291731787.ps tmp/4v0yf1291731787.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.390 0.580 2.952