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(206010 + ,198112 + ,194519 + ,185705 + ,180173 + ,176142 + ,203401 + ,221902 + ,197378 + ,185001 + ,176356 + ,180449 + ,180144 + ,173666 + ,165688 + ,161570 + ,156145 + ,153730 + ,182698 + ,200765 + ,176512 + ,166618 + ,158644 + ,159585 + ,163095 + ,159044 + ,155511 + ,153745 + ,150569 + ,150605 + ,179612 + ,194690 + ,189917 + ,184128 + ,175335 + ,179566 + ,181140 + ,177876 + ,175041 + ,169292 + ,166070 + ,166972 + ,206348 + ,215706 + ,202108 + ,195411 + ,193111 + ,195198 + ,198770 + ,194163 + ,190420 + ,189733 + ,186029 + ,191531 + ,232571 + ,243477 + ,227247 + ,217859 + ,208679 + ,213188 + ,216234 + ,213586 + ,209465 + ,204045 + ,200237 + ,203666 + ,241476 + ,260307 + ,243324 + ,244460 + ,233575 + ,237217 + ,235243 + ,230354 + ,227184 + ,221678 + ,217142 + ,219452 + ,256446 + ,265845 + ,248624 + ,241114 + ,229245 + ,231805 + ,219277 + ,219313 + ,212610 + ,214771 + ,211142 + ,211457 + ,240048 + ,240636 + ,230580 + ,208795 + ,197922 + ,194596 + ,194581 + ,185686 + ,178106 + ,172608 + ,167302 + ,168053 + ,202300 + ,202388 + ,182516 + ,173476 + ,166444 + ,171297 + ,169701 + ,164182 + ,161914 + ,159612 + ,151001 + ,158114 + ,186530 + ,187069 + ,174330 + ,169362 + ,166827 + ,178037 + ,186413 + ,189226 + ,191563 + ,188906 + ,186005 + ,195309 + ,223532 + ,226899 + ,214126 + ,206903 + ,204442 + ,220375 + ,214320 + ,212588 + ,205816 + ,202196 + ,195722 + ,198563 + ,229139 + ,229527 + ,211868 + ,203555 + ,195770) > 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 -278.16702 204831.5 1456.67020 Feb 1 -4093.16961 202528.2 -323.01982 Mar 1 -8143.75571 200224.9 2437.87367 Apr 1 -11724.45070 197957.9 -528.47426 May 1 -16334.14604 195691.0 816.17817 Jun 1 -14155.66457 193447.1 -3149.46192 Jul 1 18393.65369 191203.3 -6195.93879 Aug 1 27148.94775 188965.4 5787.60679 Sep 1 11254.99492 186727.6 -604.60074 Oct 1 2771.38998 184642.5 -2412.84503 Nov 1 -4752.55030 182557.3 -1448.75400 Dec 1 -87.08401 180663.0 -126.87506 Jan 2 -278.16702 178768.6 1653.55317 Feb 2 -4093.16961 177020.5 738.67038 Mar 2 -8143.75571 175272.4 -1440.62892 Apr 2 -11724.45070 173640.3 -345.84054 May 2 -16334.14604 172008.2 470.94820 Jun 2 -14155.66457 170499.3 -2613.64637 Jul 2 18393.65369 168990.4 -4686.07772 Aug 2 27148.94775 167783.2 5832.83362 Sep 2 11254.99492 166576.0 -1319.00814 Oct 2 2771.38998 165865.0 -2018.42542 Nov 2 -4752.55030 165154.1 -1757.50736 Dec 2 -87.08401 164786.8 -5114.76118 Jan 3 -278.16702 164419.6 -1046.46571 Feb 3 -4093.16961 164623.5 -1486.32128 Mar 3 -8143.75571 164827.3 -1172.59334 Apr 3 -11724.45070 165889.6 -420.18337 May 3 -16334.14604 166951.9 -48.77305 Jun 3 -14155.66457 168550.2 -3789.49353 Jul 3 18393.65369 170148.4 -8930.05080 Aug 3 27148.94775 171823.0 -4281.96970 Sep 3 11254.99492 173497.6 5164.35830 Oct 3 2771.38998 175113.6 6243.04604 Nov 3 -4752.55030 176729.5 3358.06911 Dec 3 -87.08401 178261.9 1391.13637 Jan 4 -278.16702 179794.4 1623.75292 Feb 4 -4093.16961 181126.9 842.25742 Mar 4 -8143.75571 182459.4 725.34543 Apr 4 -11724.45070 183640.4 -2623.98176 May 4 -16334.14604 184821.5 -2417.30860 Jun 4 -14155.66457 186188.6 -5060.95601 Jul 4 18393.65369 187555.8 398.55979 Aug 4 27148.94775 189084.0 -526.96164 Sep 4 11254.99492 190612.2 240.76381 Oct 4 2771.38998 192272.1 367.51099 Nov 4 -4752.55030 193932.0 3931.59350 Dec 4 -87.08401 195803.6 -518.51369 Jan 5 -278.16702 197675.2 1372.92841 Feb 5 -4093.16961 199688.1 -1431.91446 Mar 5 -8143.75571 201700.9 -3137.17382 Apr 5 -11724.45070 203594.2 -2136.77795 May 5 -16334.14604 205487.5 -3124.38172 Jun 5 -14155.66457 207163.0 -1476.36964 Jul 5 18393.65369 208838.5 5338.80564 Aug 5 27148.94775 210384.9 5943.14868 Sep 5 11254.99492 211931.3 4060.73861 Oct 5 2771.38998 213159.8 1927.77761 Nov 5 -4752.55030 214388.4 -956.84804 Dec 5 -87.08401 215294.3 -2019.20948 Jan 6 -278.16702 216200.2 311.97838 Feb 6 -4093.16961 217346.3 332.82463 Mar 6 -8143.75571 218492.5 -883.74561 Apr 6 -11724.45070 220292.8 -4523.37217 May 6 -16334.14604 222093.1 -5521.99838 Jun 6 -14155.66457 224126.5 -6304.86114 Jul 6 18393.65369 226159.9 -3077.56069 Aug 6 27148.94775 227995.9 5162.12070 Sep 6 11254.99492 229832.0 2237.04897 Oct 6 2771.38998 231357.1 10331.49061 Nov 6 -4752.55030 232882.3 5445.26758 Dec 6 -87.08401 233922.5 3381.56215 Jan 7 -278.16702 234962.8 558.40600 Feb 7 -4093.16961 235387.8 -940.63410 Mar 7 -8143.75571 235812.8 -485.09070 Apr 7 -11724.45070 235782.7 -2380.25900 May 7 -16334.14604 235752.6 -2276.42695 Jun 7 -14155.66457 235292.8 -1685.12166 Jul 7 18393.65369 234833.0 3219.34684 Aug 7 27148.94775 233984.2 4711.84234 Sep 7 11254.99492 233135.4 4233.58474 Oct 7 2771.38998 232160.6 6181.98826 Nov 7 -4752.55030 231185.8 2811.72712 Dec 7 -87.08401 230018.5 1873.56146 Jan 8 -278.16702 228851.2 -9296.05492 Feb 8 -4093.16961 227219.4 -3813.26363 Mar 8 -8143.75571 225587.6 -4833.88883 Apr 8 -11724.45070 223497.4 2998.08847 May 8 -16334.14604 221407.1 6069.06612 Jun 8 -14155.66457 218949.2 6663.42752 Jul 8 18393.65369 216491.4 5162.95214 Aug 8 27148.94775 213541.0 -53.94868 Sep 8 11254.99492 210590.6 8734.39740 Oct 8 2771.38998 207069.7 -1046.12448 Nov 8 -4752.55030 203548.9 -874.31103 Dec 8 -87.08401 199944.8 -5261.70107 Jan 9 -278.16702 196340.7 -1481.54182 Feb 9 -4093.16961 193003.2 -3224.01974 Mar 9 -8143.75571 189665.7 -3415.91416 Apr 9 -11724.45070 186770.3 -2437.88963 May 9 -16334.14604 183875.0 -238.86474 Jun 9 -14155.66457 181610.1 598.55975 Jul 9 18393.65369 179345.2 4561.14745 Aug 9 27148.94775 177593.3 -2354.26287 Sep 9 11254.99492 175841.4 -4580.42629 Oct 9 2771.38998 174485.1 -3780.48004 Nov 9 -4752.55030 173128.7 -1932.19846 Dec 9 -87.08401 172071.8 -687.76218 Jan 10 -278.16702 171014.9 -1035.77661 Feb 10 -4093.16961 170181.2 -1905.98739 Mar 10 -8143.75571 169347.4 710.38533 Apr 10 -11724.45070 168951.9 2384.55197 May 10 -16334.14604 168556.4 -1221.28104 Jun 10 -14155.66457 169009.5 3260.13355 Jul 10 18393.65369 169462.6 -1326.28865 Aug 10 27148.94775 171115.5 -11195.49593 Sep 10 11254.99492 172768.5 -9693.45633 Oct 10 2771.38998 175451.4 -8860.80989 Nov 10 -4752.55030 178134.4 -6554.82812 Dec 10 -87.08401 181543.5 -3419.43314 Jan 11 -278.16702 184952.7 1738.51113 Feb 11 -4093.16961 188509.3 4809.88448 Mar 11 -8143.75571 192065.9 7640.84133 Apr 11 -11724.45070 195248.8 5381.69577 May 11 -16334.14604 198431.6 3907.55057 Jun 11 -14155.66457 201016.1 8448.56397 Jul 11 18393.65369 203600.6 1537.74059 Aug 11 27148.94775 205440.9 -5690.87775 Sep 11 11254.99492 207281.3 -4410.24921 Oct 11 2771.38998 208457.4 -4325.75261 Nov 11 -4752.55030 209633.5 -438.92069 Dec 11 -87.08401 210381.0 10081.05666 Jan 12 -278.16702 211128.6 3469.58330 Feb 12 -4093.16961 210948.7 5732.43006 Mar 12 -8143.75571 210768.9 3190.86031 Apr 12 -11724.45070 209906.1 4014.36682 May 12 -16334.14604 209043.3 3012.87367 Jun 12 -14155.66457 208095.2 4623.42918 Jul 12 18393.65369 207147.2 3598.14791 Aug 12 27148.94775 206054.8 -3676.76180 Sep 12 11254.99492 204962.4 -4349.42461 Oct 12 2771.38998 203714.4 -2930.81659 Nov 12 -4752.55030 202466.4 -1943.87323 > m$win s t l 1431 19 13 > m$deg s t l 0 1 1 > m$jump s t l 144 2 2 > m$inner [1] 2 > m$outer [1] 0 > postscript(file="/var/www/html/freestat/rcomp/tmp/161mu1293658980.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/2yb3f1293658980.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/3yb3f1293658980.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/4rk201293658980.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/55cir1293658980.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/68cge1293658980.tab") > > try(system("convert tmp/161mu1293658980.ps tmp/161mu1293658980.png",intern=TRUE)) character(0) > try(system("convert tmp/2yb3f1293658980.ps tmp/2yb3f1293658980.png",intern=TRUE)) character(0) > try(system("convert tmp/3yb3f1293658980.ps tmp/3yb3f1293658980.png",intern=TRUE)) character(0) > try(system("convert tmp/4rk201293658980.ps tmp/4rk201293658980.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.884 0.888 2.044