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(320,324,343,295,301,367,196,182,342,361,333,330,345,323,365,323,316,358,235,169,430,409,407,341,326,374,364,349,300,385,304,196,443,414,325,388,356,386,444,387,327,448,225,182,460,411,342,361,377,331,428,340,352,461,221,198,422,329,320,375,364,351,380,319,322,386,221,187,343,342,365,313,356,337,389,326,343,357,220,218,391,425,332,298,360,336,325,393,301,426,265,210,429,440,357,431,442,422,544,420,396,482,261,211,448,468,464,425) > 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 18.687617 299.4506 1.8617717 Feb 1 10.796882 300.9373 12.2658099 Mar 1 54.017251 302.4240 -13.4412565 Apr 1 5.340922 303.8923 -14.2332545 May 1 -17.113184 305.3607 12.7525256 Jun 1 61.077929 306.8085 -0.8864054 Jul 1 -108.953188 308.2563 -3.3031069 Aug 1 -153.844477 309.7506 26.0938435 Sep 1 62.375351 311.2450 -31.6203235 Oct 1 49.164556 312.6863 -0.8508825 Nov 1 8.731561 314.1277 10.1407578 Dec 1 9.718771 315.2725 5.0087345 Jan 2 18.687617 316.4173 9.8950754 Feb 2 10.796882 318.6973 -6.4942131 Mar 2 54.017251 320.9774 -9.9946062 Apr 2 5.340922 324.7811 -7.1220358 May 2 -17.113184 328.5849 4.5283126 Jun 2 61.077929 331.7181 -34.7960406 Jul 2 -108.953188 334.8514 9.1018356 Aug 2 -153.844477 336.9248 -14.0803647 Sep 2 62.375351 338.9983 28.6263177 Oct 2 49.164556 340.1097 19.7257325 Nov 2 8.731561 341.2211 57.0473466 Dec 2 9.718771 342.4108 -11.1295733 Jan 3 18.687617 343.6005 -36.2881292 Feb 3 10.796882 344.7632 18.4399614 Mar 3 54.017251 345.9258 -35.9430527 Apr 3 5.340922 346.4341 -2.7750676 May 3 -17.113184 346.9425 -29.8293043 Jun 3 61.077929 348.1751 -24.2530426 Jul 3 -108.953188 349.4077 63.5454485 Aug 3 -153.844477 352.4395 -2.5950230 Sep 3 62.375351 355.4713 25.1533881 Oct 3 49.164556 358.4864 6.3490334 Nov 3 8.731561 361.5016 -45.2331221 Dec 3 9.718771 362.4044 15.8768162 Jan 4 18.687617 363.3073 -25.9948814 Feb 4 10.796882 362.8797 12.3233906 Mar 4 54.017251 362.4522 27.5305578 Apr 4 5.340922 362.4962 19.1628373 May 4 -17.113184 362.5403 -18.4271053 Jun 4 61.077929 361.8655 25.0565706 Jul 4 -108.953188 361.1907 -27.2375241 Aug 4 -153.844477 359.1740 -23.3294771 Sep 4 62.375351 357.1572 40.4674526 Oct 4 49.164556 355.8227 6.0127689 Nov 4 8.731561 354.4882 -21.2197154 Dec 4 9.718771 354.5521 -3.2708983 Jan 5 18.687617 354.6161 3.6962829 Feb 5 10.796882 354.0909 -33.8877800 Mar 5 54.017251 353.5657 20.4170525 Apr 5 5.340922 351.4308 -16.7717623 May 5 -17.113184 349.2960 19.8172010 Jun 5 61.077929 347.8443 52.0777788 Jul 5 -108.953188 346.3926 -16.4394140 Aug 5 -153.844477 344.8213 7.0232220 Sep 5 62.375351 343.2499 16.3747407 Oct 5 49.164556 340.6495 -60.8140227 Nov 5 8.731561 338.0490 -26.7805867 Dec 5 9.718771 335.4572 29.8240075 Jan 6 18.687617 332.8654 12.4469659 Feb 6 10.796882 331.2113 8.9918486 Mar 6 54.017251 329.5571 -3.5743733 Apr 6 5.340922 328.2377 -14.5786548 May 6 -17.113184 326.9183 12.1948417 Jun 6 61.077929 325.5143 -0.5922163 Jul 6 -108.953188 324.1102 5.8429552 Aug 6 -153.844477 323.4096 17.4348997 Sep 6 62.375351 322.7089 -42.0842731 Oct 6 49.164556 322.9864 -30.1509543 Nov 6 8.731561 323.2639 33.0045639 Dec 6 9.718771 323.8990 -20.6177703 Jan 7 18.687617 324.5341 12.7782596 Feb 7 10.796882 326.6033 -0.4001801 Mar 7 54.017251 328.6725 6.3102754 Apr 7 5.340922 330.9747 -10.3156236 May 7 -17.113184 333.2769 26.8362554 Jun 7 61.077929 333.5977 -37.6756628 Jul 7 -108.953188 333.9185 -4.9653515 Aug 7 -153.844477 333.0724 38.7720930 Sep 7 62.375351 332.2262 -3.6015798 Oct 7 49.164556 332.0407 43.7947029 Nov 7 8.731561 331.8553 -8.5868151 Dec 7 9.718771 333.0433 -44.7620261 Jan 8 18.687617 334.2313 7.0811270 Feb 8 10.796882 336.3671 -11.1639423 Mar 8 54.017251 338.5029 -67.5201162 Apr 8 5.340922 342.2083 45.4507660 May 8 -17.113184 345.9138 -27.8005738 Jun 8 61.077929 352.6859 12.2362069 Jul 8 -108.953188 359.4580 14.4952171 Aug 8 -153.844477 368.4510 -4.6065413 Sep 8 62.375351 377.4441 -10.8194171 Oct 8 49.164556 385.7623 5.0731398 Nov 8 8.731561 394.0805 -45.8121039 Dec 8 9.718771 399.0095 22.2717236 Jan 9 18.687617 403.9385 19.3739152 Feb 9 10.796882 405.9511 5.2520394 Mar 9 54.017251 407.9637 82.0190590 Apr 9 5.340922 408.6875 5.9715925 May 9 -17.113184 409.4113 3.7019041 Jun 9 61.077929 410.3811 10.5409566 Jul 9 -108.953188 411.3509 -41.3977615 Aug 9 -153.844477 411.6820 -46.8375534 Sep 9 62.375351 412.0131 -26.3884627 Oct 9 49.164556 412.0505 6.7849497 Nov 9 8.731561 412.0879 43.1805613 Dec 9 9.718771 412.1947 3.0864874 > m$win s t l 1081 19 13 > m$deg s t l 0 1 1 > m$jump s t l 109 2 2 > m$inner [1] 2 > m$outer [1] 0 > postscript(file="/var/www/html/freestat/rcomp/tmp/13g9i1292959786.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/23g9i1292959786.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/3vpqk1292959786.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/4vpqk1292959786.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/5k85e1292959786.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/6dh4h1292959786.tab") > > try(system("convert tmp/13g9i1292959786.ps tmp/13g9i1292959786.png",intern=TRUE)) character(0) > try(system("convert tmp/23g9i1292959786.ps tmp/23g9i1292959786.png",intern=TRUE)) character(0) > try(system("convert tmp/3vpqk1292959786.ps tmp/3vpqk1292959786.png",intern=TRUE)) character(0) > try(system("convert tmp/4vpqk1292959786.ps tmp/4vpqk1292959786.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.653 0.880 1.795