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(11974 + ,10106 + ,12069 + ,11412 + ,11180 + ,10508 + ,11288 + ,10928 + ,10199 + ,11030 + ,11234 + ,13747 + ,13912 + ,12376 + ,12264 + ,11675 + ,11271 + ,10672 + ,10933 + ,10379 + ,10187 + ,10747 + ,10970 + ,12175 + ,14200 + ,11676 + ,11258 + ,10872 + ,11148 + ,10690 + ,10684 + ,11658 + ,10178 + ,10981 + ,10773 + ,11665 + ,11359 + ,10716 + ,12928 + ,12317 + ,11641 + ,10459 + ,10953 + ,10703 + ,10703 + ,11101 + ,11334 + ,13268 + ,13145 + ,12334 + ,13153 + ,11289 + ,11374 + ,10914 + ,11299 + ,11284 + ,10694 + ,11077 + ,11104 + ,12820 + ,14915 + ,11773 + ,11608 + ,11468 + ,11511 + ,11200 + ,11164 + ,10960 + ,10667 + ,11556 + ,11372 + ,12333 + ,13102 + ,11115 + ,12572 + ,11557 + ,12059 + ,11420 + ,11185 + ,11113 + ,10706 + ,11523 + ,11391 + ,12634 + ,13469 + ,11735 + ,13281 + ,11968 + ,11623 + ,11084 + ,11509 + ,11134 + ,10438 + ,11530 + ,11491 + ,13093 + ,13106 + ,11305 + ,13113 + ,12203 + ,11309 + ,11088 + ,11234 + ,11619 + ,10942 + ,11445 + ,11291 + ,13281 + ,13726 + ,11300 + ,11983 + ,11092 + ,11093 + ,10692 + ,10786 + ,11166 + ,10553 + ,11103 + ,10969 + ,12090 + ,12544 + ,12264 + ,13783 + ,11214 + ,11453 + ,10883 + ,10381 + ,10348 + ,10024 + ,10805 + ,10796 + ,11907 + ,12261 + ,11377 + ,12689 + ,11474 + ,10992 + ,10764 + ,12164 + ,10409 + ,10398 + ,10349 + ,10865 + ,11630 + ,12221 + ,10884 + ,12019 + ,11021 + ,10799 + ,10423 + ,10484 + ,10450 + ,9906 + ,11049 + ,11281 + ,12485 + ,12849 + ,11380 + ,12079 + ,11366 + ,11328 + ,10444 + ,10854 + ,10434 + ,10137 + ,10992 + ,10906 + ,12367 + ,14371 + ,11695 + ,11546 + ,10922 + ,10670 + ,10254 + ,10573 + ,10239 + ,10253 + ,11176 + ,10719 + ,11817) > 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 1706.2263901 10561.78 -294.006891 Feb 1 24.9956236 10695.72 -614.713400 Mar 1 972.2317355 10829.66 267.113212 Apr 1 0.5423587 10959.23 452.223945 May 1 -164.7466775 11088.81 255.934338 Jun 1 -697.9754441 11216.42 -10.440816 Jul 1 -434.4044852 11344.02 378.384304 Aug 1 -614.2904506 11466.93 75.360524 Sep 1 -1072.3099666 11589.84 -318.529706 Oct 1 -372.6791252 11655.61 -252.926081 Nov 1 -369.5148946 11721.37 -117.855845 Dec 1 1021.9249255 11724.50 1000.580074 Jan 2 1706.2263901 11727.62 478.154349 Feb 2 24.9956236 11701.84 649.159597 Mar 2 972.2317355 11676.07 -384.302033 Apr 2 0.5423587 11622.87 51.588553 May 2 -164.7466775 11569.67 -133.921202 Jun 2 -697.9754441 11512.20 -142.222212 Jul 2 -434.4044852 11454.73 -87.322949 Aug 2 -614.2904506 11410.54 -417.254305 Sep 2 -1072.3099666 11366.36 -107.052112 Oct 2 -372.6791252 11336.13 -216.451767 Nov 2 -369.5148946 11305.90 33.615188 Dec 2 1021.9249255 11297.28 -144.206562 Jan 3 1706.2263901 11288.66 1205.110044 Feb 3 24.9956236 11308.46 342.543651 Mar 3 972.2317355 11328.26 -1042.489621 Apr 3 0.5423587 11328.71 -457.257222 May 3 -164.7466775 11329.17 -16.425163 Jun 3 -697.9754441 11275.63 112.346895 Jul 3 -434.4044852 11222.09 -103.680772 Aug 3 -614.2904506 11185.58 1086.712736 Sep 3 -1072.3099666 11149.07 101.239793 Oct 3 -372.6791252 11175.76 177.922335 Nov 3 -369.5148946 11202.44 -59.928513 Dec 3 1021.9249255 11219.69 -576.614821 Jan 4 1706.2263901 11236.94 -1584.162774 Feb 4 24.9956236 11247.07 -556.070494 Mar 4 972.2317355 11257.21 698.554907 Apr 4 0.5423587 11309.25 1007.208166 May 4 -164.7466775 11361.29 444.461085 Jun 4 -697.9754441 11451.41 -294.433269 Jul 4 -434.4044852 11541.53 -154.127349 Aug 4 -614.2904506 11608.24 -290.945149 Sep 4 -1072.3099666 11674.94 100.370602 Oct 4 -372.6791252 11687.26 -213.580754 Nov 4 -369.5148946 11699.58 3.934500 Dec 4 1021.9249255 11714.73 531.347579 Jan 5 1706.2263901 11729.87 -291.100986 Feb 5 24.9956236 11745.23 563.775888 Mar 5 972.2317355 11760.58 420.185884 Apr 5 0.5423587 11755.49 -467.030359 May 5 -164.7466775 11750.39 -211.646943 Jun 5 -697.9754441 11751.62 -139.649103 Jul 5 -434.4044852 11752.86 -19.450989 Aug 5 -614.2904506 11750.33 147.963738 Sep 5 -1072.3099666 11747.80 18.512016 Oct 5 -372.6791252 11739.00 -289.317420 Nov 5 -369.5148946 11730.20 -256.680245 Dec 5 1021.9249255 11723.40 74.672720 Jan 6 1706.2263901 11716.61 1492.164041 Feb 6 24.9956236 11712.71 35.293005 Mar 6 972.2317355 11708.81 -1073.044910 Apr 6 0.5423587 11701.50 -234.039168 May 6 -164.7466775 11694.18 -18.433767 Jun 6 -697.9754441 11665.71 232.262879 Jul 6 -434.4044852 11637.24 -38.840200 Aug 6 -614.2904506 11611.89 -37.601383 Sep 6 -1072.3099666 11586.54 152.770984 Oct 6 -372.6791252 11596.12 332.561788 Nov 6 -369.5148946 11605.70 135.819203 Dec 6 1021.9249255 11618.53 -307.455469 Jan 7 1706.2263901 11631.37 -235.591784 Feb 7 24.9956236 11644.26 -554.259369 Mar 7 972.2317355 11657.16 -57.393831 Apr 7 0.5423587 11672.80 -116.339794 May 7 -164.7466775 11688.43 535.313903 Jun 7 -697.9754441 11715.41 402.562665 Jul 7 -434.4044852 11742.39 -122.988298 Aug 7 -614.2904506 11772.35 -45.062263 Sep 7 -1072.3099666 11802.31 -24.002677 Oct 7 -372.6791252 11815.30 80.378107 Nov 7 -369.5148946 11828.29 -67.774499 Dec 7 1021.9249255 11829.88 -217.801917 Jan 8 1706.2263901 11831.46 -68.690979 Feb 8 24.9956236 11832.57 -122.569523 Mar 8 972.2317355 11833.68 475.085055 Apr 8 0.5423587 11835.80 131.653923 May 8 -164.7466775 11837.92 -50.177550 Jun 8 -697.9754441 11833.78 -51.801952 Jul 8 -434.4044852 11829.63 113.773921 Aug 8 -614.2904506 11814.99 -66.694786 Sep 8 -1072.3099666 11800.34 -290.029942 Oct 8 -372.6791252 11788.44 114.237103 Nov 8 -369.5148946 11776.54 83.970758 Dec 8 1021.9249255 11776.62 294.453944 Jan 9 1706.2263901 11776.70 -376.924515 Feb 9 24.9956236 11786.91 -506.908710 Mar 9 972.2317355 11797.13 343.640217 Apr 9 0.5423587 11811.17 391.283777 May 9 -164.7466775 11825.22 -351.473004 Jun 9 -697.9754441 11839.07 -53.094441 Jul 9 -434.4044852 11852.92 -184.515604 Aug 9 -614.2904506 11840.12 393.169594 Sep 9 -1072.3099666 11827.32 186.988342 Oct 9 -372.6791252 11777.82 39.863532 Nov 9 -369.5148946 11728.31 -67.794667 Dec 9 1021.9249255 11674.71 584.360714 Jan 10 1706.2263901 11621.12 398.654450 Feb 10 24.9956236 11575.25 -300.241900 Mar 10 972.2317355 11529.37 -518.605128 Apr 10 0.5423587 11487.48 -396.020557 May 10 -164.7466775 11445.58 -187.836326 Jun 10 -697.9754441 11412.03 -22.051339 Jul 10 -434.4044852 11378.47 -158.066078 Aug 10 -614.2904506 11400.74 379.552070 Sep 10 -1072.3099666 11423.01 202.303770 Oct 10 -372.6791252 11471.54 4.137394 Nov 10 -369.5148946 11520.08 -181.562371 Dec 10 1021.9249255 11530.14 -462.062218 Jan 11 1706.2263901 11540.20 -702.423709 Feb 11 24.9956236 11512.41 726.591881 Mar 11 972.2317355 11484.63 1326.140593 Apr 11 0.5423587 11452.52 -239.062465 May 11 -164.7466775 11420.41 197.334135 Jun 11 -697.9754441 11374.13 206.844469 Jul 11 -434.4044852 11327.85 -512.444922 Aug 11 -614.2904506 11270.54 -308.252609 Sep 11 -1072.3099666 11213.24 -116.926746 Oct 11 -372.6791252 11185.11 -7.426313 Nov 11 -369.5148946 11156.97 8.540730 Dec 11 1021.9249255 11187.48 -302.407475 Jan 12 1706.2263901 11217.99 -663.217326 Feb 12 24.9956236 11261.41 90.593949 Mar 12 972.2317355 11304.83 411.938346 Apr 12 0.5423587 11323.13 150.326427 May 12 -164.7466775 11341.43 -184.685833 Jun 12 -697.9754441 11324.60 137.376613 Jul 12 -434.4044852 11307.77 1290.639333 Aug 12 -614.2904506 11264.33 -241.037228 Sep 12 -1072.3099666 11220.89 249.419762 Oct 12 -372.6791252 11164.10 -442.423332 Nov 12 -369.5148946 11107.31 127.200184 Dec 12 1021.9249255 11055.95 -447.871961 Jan 13 1706.2263901 11004.58 -489.805751 Feb 13 24.9956236 10976.19 -117.184493 Mar 13 972.2317355 10947.80 98.969886 Apr 13 0.5423587 10973.25 47.203932 May 13 -164.7466775 10998.71 -34.962363 Jun 13 -697.9754441 11049.20 71.772833 Jul 13 -434.4044852 11099.70 -181.291696 Aug 13 -614.2904506 11141.81 -77.524347 Sep 13 -1072.3099666 11183.93 -205.623448 Oct 13 -372.6791252 11212.52 209.163775 Nov 13 -369.5148946 11241.10 409.417609 Dec 13 1021.9249255 11263.12 199.958807 Jan 14 1706.2263901 11285.14 -142.361641 Feb 14 24.9956236 11291.08 63.919571 Mar 14 972.2317355 11297.03 -190.266095 Apr 14 0.5423587 11290.55 74.910643 May 14 -164.7466775 11284.06 208.687041 Jun 14 -697.9754441 11300.53 -158.550737 Jul 14 -434.4044852 11316.99 -28.588241 Aug 14 -614.2904506 11338.86 -290.565023 Sep 14 -1072.3099666 11360.72 -151.408254 Oct 14 -372.6791252 11349.95 14.728498 Nov 14 -369.5148946 11339.18 -63.668139 Dec 14 1021.9249255 11310.88 34.197988 Jan 15 1706.2263901 11282.57 1382.202471 Feb 15 24.9956236 11261.42 408.585422 Mar 15 972.2317355 11240.27 -666.498505 Apr 15 0.5423587 11216.99 -295.531846 May 15 -164.7466775 11193.71 -358.965529 Jun 15 -697.9754441 11159.90 -207.923797 Jul 15 -434.4044852 11126.09 -118.681790 Aug 15 -614.2904506 11092.29 -238.997615 Sep 15 -1072.3099666 11058.49 266.820111 Oct 15 -372.6791252 11029.67 519.012491 Nov 15 -369.5148946 11000.84 87.671482 Dec 15 1021.9249255 10975.89 -180.819755 > m$win s t l 1801 19 13 > m$deg s t l 0 1 1 > m$jump s t l 181 2 2 > m$inner [1] 2 > m$outer [1] 0 > postscript(file="/var/www/html/rcomp/tmp/1ulcq1292937690.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/2ulcq1292937690.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/3mvcb1292937690.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/4f4bw1292937690.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/5be951292937690.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/6ew7b1292937690.tab") > > try(system("convert tmp/1ulcq1292937690.ps tmp/1ulcq1292937690.png",intern=TRUE)) character(0) > try(system("convert tmp/2ulcq1292937690.ps tmp/2ulcq1292937690.png",intern=TRUE)) character(0) > try(system("convert tmp/3mvcb1292937690.ps tmp/3mvcb1292937690.png",intern=TRUE)) character(0) > try(system("convert tmp/4f4bw1292937690.ps tmp/4f4bw1292937690.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.731 0.668 4.984