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(2564,2820,3508,3088,3299,2939,3320,3418,3604,3495,4163,4882,2211,3260,2992,2425,2707,3244,3965,3315,3333,3583,4021,4904,2252,2952,3573,3048,3059,2731,3563,3092,3478,3478,4308,5029,2075,3264,3308,3688,3136,2824,3644,4694,2914,3686,4358,5587,2265,3685,3754,3708,3210,3517,3905,3670,4221,4404,5086,5725) > 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 -1214.76105 3529.852 248.9086049 Feb 1 -298.10880 3511.885 -393.7763020 Mar 1 -73.45666 3493.918 87.5388932 Apr 1 -316.99774 3475.470 -70.4721627 May 1 -434.13874 3457.022 276.1166990 Jun 1 -472.44810 3438.304 -26.8558153 Jul 1 148.84281 3419.586 -248.4285900 Aug 1 97.11325 3400.639 -79.7527269 Sep 1 -40.81658 3381.693 263.1234233 Oct 1 164.54914 3360.237 -29.7862591 Nov 1 808.71476 3338.781 15.5041636 Dec 1 1631.50775 3330.462 -79.9701812 Jan 2 -1214.76105 3322.144 103.6172657 Feb 2 -298.10880 3326.766 231.3423468 Mar 2 -73.45666 3331.389 -265.9324699 Apr 2 -316.99774 3331.189 -589.1916823 May 2 -434.13874 3330.990 -189.8509771 Jun 2 -472.44810 3332.712 383.7357798 Jul 2 148.84281 3334.435 481.7222764 Aug 2 97.11325 3347.339 -129.4526245 Sep 2 -40.81658 3360.244 13.5727617 Oct 2 164.54914 3376.111 42.3397894 Nov 2 808.71476 3391.978 -179.6930779 Dec 2 1631.50775 3386.440 -113.9481787 Jan 3 -1214.76105 3380.903 85.8585120 Feb 3 -298.10880 3370.383 -120.2738629 Mar 3 -73.45666 3359.863 286.5938644 Apr 3 -316.99774 3361.023 3.9747840 May 3 -434.13874 3362.183 130.9556211 Jun 3 -472.44810 3365.335 -161.8865174 Jul 3 148.84281 3368.486 45.6710837 Aug 3 97.11325 3373.379 -378.4927248 Sep 3 -40.81658 3378.273 140.5437537 Oct 3 164.54914 3394.469 -81.0176591 Nov 3 808.71476 3410.664 88.6210331 Dec 3 1631.50775 3438.799 -41.3068952 Jan 4 -1214.76105 3466.934 -177.1730319 Feb 4 -298.10880 3497.618 64.4911117 Mar 4 -73.45666 3528.301 -146.8446426 Apr 4 -316.99774 3548.870 456.1274410 May 4 -434.13874 3569.439 0.6994421 Jun 4 -472.44810 3588.583 -292.1351623 Jul 4 148.84281 3607.727 -112.5700271 Aug 4 97.11325 3630.418 966.4683011 Sep 4 -40.81658 3653.110 -698.2930837 Oct 4 164.54914 3674.577 -153.1256444 Nov 4 808.71476 3696.043 -146.7581000 Dec 4 1631.50775 3715.877 239.6156706 Jan 5 -1214.76105 3735.710 -255.9487670 Feb 5 -298.10880 3759.434 223.6744341 Mar 5 -73.45666 3783.159 44.2977374 Apr 5 -316.99774 3827.441 197.5569171 May 5 -434.13874 3871.723 -227.5839857 Jun 5 -472.44810 3914.631 74.8166993 Jul 5 148.84281 3957.540 -201.3828761 Aug 5 97.11325 3998.947 -426.0598016 Sep 5 -40.81658 4040.353 221.4635598 Oct 5 164.54914 4082.627 156.8234691 Nov 5 808.71476 4124.902 152.3834835 Dec 5 1631.50775 4168.557 -75.0650680 > m$win s t l 601 19 13 > m$deg s t l 0 1 1 > m$jump s t l 61 2 2 > m$inner [1] 2 > m$outer [1] 0 > postscript(file="/var/wessaorg/rcomp/tmp/1wn3q1322498782.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/2ezig1322498782.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/3g5zu1322498782.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/41iaa1322498782.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/5pauz1322498782.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/69hku1322498782.tab") > > try(system("convert tmp/1wn3q1322498782.ps tmp/1wn3q1322498782.png",intern=TRUE)) character(0) > try(system("convert tmp/2ezig1322498782.ps tmp/2ezig1322498782.png",intern=TRUE)) character(0) > try(system("convert tmp/3g5zu1322498782.ps tmp/3g5zu1322498782.png",intern=TRUE)) character(0) > try(system("convert tmp/41iaa1322498782.ps tmp/41iaa1322498782.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.308 0.208 1.528