R version 2.13.0 (2011-04-13) Copyright (C) 2011 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(274,291,280,258,252,251,224,225,234,233,229,208,224,226,223,205,201,202,183,188,200,206,211,201,299,244,251,241,244,252,234,246,265,277,287,275,320,338,342,322,323,343,315,334,359,362,378,345,422,430,443,431,425,432,387,396,411,421,424,410,464,486,490,459,454,446,406,412,428,429,425,396,429,439,424,379,370,353,322,322,338,348,350,312,358,378,352,312,310,292,276,269,286,292,288,255,304,299,293,275,272,264,234,231,263,264,264,245,297,317,318,315,312,310,306,313,350,354,371,357,419,425,424,399,393,378,371,364,384,377,383,352) > par8 = 'FALSE' > par7 = '1' > par6 = '' > par5 = '1' > par4 = '' > par3 = '0' > par2 = 'periodic' > par1 = '12' > main = 'Seasonal Decomposition by Loess' > 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 26.42366539 262.7504 -15.17403070 Feb 1 31.29791902 259.6280 0.07406571 Mar 1 27.44490006 256.5057 -3.95056529 Apr 1 4.67600235 253.1114 0.21263436 May 1 0.45256490 249.7171 1.83037375 Jun 1 -3.24364101 246.1072 8.13640147 Jul 1 -28.03076763 242.4974 9.53334990 Aug 1 -25.15010975 238.7584 11.39172467 Sep 1 -6.26945503 235.0194 5.25010259 Oct 1 -3.26430177 230.4559 5.80837017 Nov 1 -0.07733578 225.8925 3.18482502 Dec 1 -24.25944462 221.4400 10.81940606 Jan 2 26.42366539 216.9876 -19.41123176 Feb 2 31.29791902 213.6560 -18.95390781 Mar 2 27.44490006 210.3244 -14.76931128 Apr 2 4.67600235 208.6243 -8.30028555 May 2 0.45256490 206.9242 -6.37672009 Jun 2 -3.24364101 207.9462 -2.70255544 Jul 2 -28.03076763 208.9682 2.06252994 Aug 2 -25.15010975 211.8046 1.34553416 Sep 2 -6.26945503 214.6409 -8.37145847 Oct 2 -3.26430177 217.8752 -8.61088568 Nov 2 -0.07733578 221.1095 -10.03212563 Dec 2 -24.25944462 224.9575 0.30198112 Jan 3 26.42366539 228.8055 43.77086901 Feb 3 31.29791902 233.6692 -20.96712133 Mar 3 27.44490006 238.5329 -14.97783908 Apr 3 4.67600235 243.9701 -7.64614804 May 3 0.45256490 249.4074 -5.85991727 Jun 3 -3.24364101 255.0235 0.22013090 Jul 3 -28.03076763 260.6397 1.39109980 Aug 3 -25.15010975 266.9162 4.23391440 Sep 3 -6.26945503 273.1927 -1.92326784 Oct 3 -3.26430177 280.0787 0.18561488 Nov 3 -0.07733578 286.9647 0.11268488 Dec 3 -24.25944462 293.8794 5.38000996 Jan 4 26.42366539 300.7942 -7.21788381 Feb 4 31.29791902 308.0392 -1.33708118 Mar 4 27.44490006 315.2841 -0.72900597 Apr 4 4.67600235 322.6953 -5.37129878 May 4 0.45256490 330.1065 -7.55905186 Jun 4 -3.24364101 337.5467 8.69690644 Jul 4 -28.03076763 344.9870 -1.95621454 Aug 4 -25.15010975 352.8989 6.25117833 Sep 4 -6.26945503 360.8109 4.45857436 Oct 4 -3.26430177 369.0265 -3.76224067 Nov 4 -0.07733578 377.2422 0.83513158 Dec 4 -24.25944462 384.6862 -15.42676309 Jan 5 26.42366539 392.1302 3.44612338 Feb 5 31.29791902 398.0620 0.64005491 Mar 5 27.44490006 403.9938 11.56125902 Apr 5 4.67600235 408.7182 17.60580343 May 5 0.45256490 413.4425 11.10488757 Jun 5 -3.24364101 417.3712 17.87246692 Jul 5 -28.03076763 421.2998 -6.26903300 Aug 5 -25.15010975 424.6695 -3.51934342 Sep 5 -6.26945503 428.0391 -10.76965069 Oct 5 -3.26430177 430.9535 -6.68921269 Nov 5 -0.07733578 433.8679 -9.79058742 Dec 5 -24.25944462 436.2980 -2.03857514 Jan 6 26.42366539 438.7281 -1.15178172 Feb 6 31.29791902 440.4801 14.22198771 Mar 6 27.44490006 442.2321 20.32302973 Apr 6 4.67600235 442.6615 11.66250546 May 6 0.45256490 443.0909 10.45652093 Jun 6 -3.24364101 441.3377 7.90590907 Jul 6 -28.03076763 439.5845 -5.55378207 Aug 6 -25.15010975 435.4248 1.72530441 Sep 6 -6.26945503 431.2651 3.00439405 Oct 6 -3.26430177 425.2175 7.04677737 Nov 6 -0.07733578 419.1700 5.90734797 Dec 6 -24.25944462 411.9963 8.26313190 Jan 7 26.42366539 404.8226 -2.24630302 Feb 7 31.29791902 397.1536 10.54844953 Mar 7 27.44490006 389.4846 7.07047467 Apr 7 4.67600235 382.1466 -7.82257715 May 7 0.45256490 374.8085 -5.26108924 Jun 7 -3.24364101 368.3179 -12.07422942 Jul 7 -28.03076763 361.8272 -11.79644888 Aug 7 -25.15010975 356.3370 -9.18688969 Sep 7 -6.26945503 350.8468 -6.57732733 Oct 7 -3.26430177 345.9584 5.30591934 Nov 7 -0.07733578 341.0700 9.00735329 Dec 7 -24.25944462 336.4560 -0.19655314 Jan 8 26.42366539 331.8420 -0.26567842 Feb 8 31.29791902 327.1171 19.58497457 Mar 8 27.44490006 322.3922 2.16290015 Apr 8 4.67600235 317.4695 -10.14547277 May 8 0.45256490 312.5467 -2.99930596 Jun 8 -3.24364101 307.5255 -12.28187252 Jul 8 -28.03076763 302.5043 1.52648163 Aug 8 -25.15010975 297.7240 -3.57390481 Sep 8 -6.26945503 292.9437 -0.67428809 Oct 8 -3.26430177 289.0825 6.18181046 Nov 8 -0.07733578 285.2212 2.85609628 Dec 8 -24.25944462 282.0558 -2.79630655 Jan 9 26.42366539 278.8903 -1.31392823 Feb 9 31.29791902 276.0685 -8.36640022 Mar 9 27.44490006 273.2467 -7.69159962 Apr 9 4.67600235 271.1472 -0.82317906 May 9 0.45256490 269.0477 2.49978124 Jun 9 -3.24364101 268.1843 -0.94060938 Jul 9 -28.03076763 267.3208 -5.29007928 Aug 9 -25.15010975 268.1550 -12.00485846 Sep 9 -6.26945503 268.9891 0.28036552 Oct 9 -3.26430177 271.7076 -4.44330075 Nov 9 -0.07733578 274.4261 -10.34877975 Dec 9 -24.25944462 279.0522 -9.79279205 Jan 10 26.42366539 283.6784 -13.10202321 Feb 10 31.29791902 290.2591 -4.55699702 Mar 10 27.44490006 296.8398 -6.28469824 Apr 10 4.67600235 304.9803 5.34369271 May 10 0.45256490 313.1208 -1.57337659 Jun 10 -3.24364101 322.3550 -9.11138964 Jul 10 -28.03076763 331.5892 2.44151803 Aug 10 -25.15010975 340.7335 -2.58338143 Sep 10 -6.26945503 349.8777 6.39172227 Oct 10 -3.26430177 357.7432 -0.47892710 Nov 10 -0.07733578 365.6087 5.46861080 Dec 10 -24.25944462 371.6662 9.59329111 Jan 11 26.42366539 377.7236 14.85275255 Feb 11 31.29791902 381.6922 12.00984320 Mar 11 27.44490006 385.6609 10.89420644 Apr 11 4.67600235 386.1975 8.12646175 May 11 0.45256490 386.7342 5.81325679 Jun 11 -3.24364101 386.8892 -5.64552994 Jul 11 -28.03076763 387.0442 11.98660405 Aug 11 -25.15010975 386.9510 2.19906371 Sep 11 -6.26945503 386.8579 3.41152652 Oct 11 -3.26430177 386.5074 -6.24307289 Nov 11 -0.07733578 386.1568 -3.07948502 Dec 11 -24.25944462 385.6144 -9.35496271 > m$win s t l 1321 19 13 > m$deg s t l 0 1 1 > m$jump s t l 133 2 2 > m$inner [1] 2 > m$outer [1] 0 > postscript(file="/var/wessaorg/rcomp/tmp/1jd5c1322753287.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/wessaorg/rcomp/tmp/23tlc1322753287.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/wessaorg/rcomp/tmp/3c43z1322753287.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/wessaorg/rcomp/tmp/4yud41322753287.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/wessaorg/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/wessaorg/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/wessaorg/rcomp/tmp/597pv1322753287.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/wessaorg/rcomp/tmp/6tio21322753287.tab") > > try(system("convert tmp/1jd5c1322753287.ps tmp/1jd5c1322753287.png",intern=TRUE)) character(0) > try(system("convert tmp/23tlc1322753287.ps tmp/23tlc1322753287.png",intern=TRUE)) character(0) > try(system("convert tmp/3c43z1322753287.ps tmp/3c43z1322753287.png",intern=TRUE)) character(0) > try(system("convert tmp/4yud41322753287.ps tmp/4yud41322753287.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.674 0.218 1.904