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(4581945 + ,3874038 + ,4086290 + ,4364364 + ,3793586 + ,4533914 + ,4823043 + ,3981535 + ,4746356 + ,5284534 + ,4264830 + ,3924674 + ,3734753 + ,3762290 + ,3609739 + ,3877594 + ,3636415 + ,3578195 + ,3604342 + ,3459513 + ,3366571 + ,3371277 + ,3724848 + ,3350830 + ,3305159 + ,3390736 + ,3349758 + ,3253655 + ,3734250 + ,3455433 + ,2966726 + ,2993716 + ,3009320 + ,3169713 + ,3170061 + ,3368934 + ,3292638 + ,3337344 + ,3208306 + ,3359130 + ,3223078 + ,3437159 + ,3400156 + ,3657576 + ,3765613 + ,3481921 + ,3604800 + ,3981340 + ,3734078 + ,4018173 + ,3887417 + ,3919880 + ,4014466 + ,4197758 + ,3896531 + ,3964742 + ,4201847 + ,4050512 + ,3997402 + ,4314479 + ,4925744 + ,5130631 + ,4444855 + ,3967319 + ,3931250 + ,4235952 + ,4169219 + ,3779064 + ,3558810 + ,3699466 + ,3650693 + ,3525633 + ,3470276 + ,3859094 + ,3661155 + ,3356365 + ,3344440 + ,3338684 + ,3404294 + ,3289319 + ,3469252 + ,3571850 + ,3639914 + ,3091730 + ,3078149 + ,3188115 + ,3246082 + ,3486992 + ,3378187 + ,3282306 + ,3288345 + ,3325749 + ,3352262 + ,3531954 + ,3722622 + ,3809365 + ,3750617 + ,3615286 + ,3696556 + ,4123959 + ,4136163 + ,3933392 + ,4035576 + ,4551202 + ,4032195 + ,3970893 + ,4489016 + ,5426127 + ,4578224 + ,4126390 + ,4892100 + ,4128697 + ,4408721 + ,4199465 + ,4074767 + ,4161758 + ,3891319 + ,4470302 + ,4283111 + ,3845962 + ,3911471 + ,3798478 + ,3644313 + ,3784029 + ,3647134 + ,3994662 + ,3607836 + ,3566008 + ,3511412 + ,3258665 + ,3486573 + ,3369443 + ,3465544 + ,3905224 + ,3733881 + ,3220642 + ,3225812 + ,3354461 + ,3352261 + ,3450652) > 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 20883.955 4305860 255201.153 Feb 1 42876.153 4311674 -480511.721 Mar 1 4655.715 4317487 -235852.959 Apr 1 -37834.437 4314560 87638.422 May 1 -59599.258 4311633 -458447.528 Jun 1 36467.988 4299840 197606.487 Jul 1 -32978.323 4288046 567975.061 Aug 1 -65718.977 4274028 -226774.329 Sep 1 -57060.727 4260010 543406.377 Oct 1 34412.658 4227234 1022887.360 Nov 1 54672.916 4194458 15699.470 Dec 1 59222.341 4119506 -254054.070 Jan 2 20883.955 4044554 -330684.800 Feb 2 42876.153 3948725 -229311.554 Mar 2 4655.715 3852897 -247813.672 Apr 2 -37834.437 3767090 148338.432 May 2 -59599.258 3681283 14731.205 Jun 2 36467.988 3629332 -87605.218 Jul 2 -32978.323 3577381 59938.916 Aug 2 -65718.977 3541926 -16694.000 Sep 2 -57060.727 3506471 -82838.822 Oct 2 34412.658 3479518 -142654.136 Nov 2 54672.916 3452566 217608.677 Dec 2 59222.341 3430652 -139044.653 Jan 3 20883.955 3408738 -124463.173 Feb 3 42876.153 3381132 -33271.834 Mar 3 4655.715 3353525 -8422.860 Apr 3 -37834.437 3325383 -33893.639 May 3 -59599.258 3297241 496608.252 Jun 3 36467.988 3279051 139914.180 Jul 3 -32978.323 3260861 -261156.335 Aug 3 -65718.977 3249550 -190115.014 Sep 3 -57060.727 3238239 -171858.598 Oct 3 34412.658 3230430 -95130.080 Nov 3 54672.916 3222622 -107233.436 Dec 3 59222.341 3233593 76119.105 Jan 4 20883.955 3244564 27190.456 Feb 4 42876.153 3283938 10529.586 Mar 4 4655.715 3323313 -119662.649 Apr 4 -37834.437 3366787 30177.577 May 4 -59599.258 3410261 -127583.527 Jun 4 36467.988 3454792 -54101.051 Jul 4 -32978.323 3499323 -66189.016 Aug 4 -65718.977 3550075 173219.710 Sep 4 -57060.727 3600827 221846.531 Oct 4 34412.658 3656743 -209234.333 Nov 4 54672.916 3712658 -162531.069 Dec 4 59222.341 3763606 158511.603 Jan 5 20883.955 3814554 -101359.915 Feb 5 42876.153 3857641 117656.275 Mar 5 4655.715 3900727 -17965.899 Apr 5 -37834.437 3938752 18962.779 May 5 -59599.258 3976776 97289.127 Jun 5 36467.988 4025975 135315.139 Jul 5 -32978.323 4075174 -145664.290 Aug 5 -65718.977 4133275 -102814.508 Sep 5 -57060.727 4191377 67530.370 Oct 5 34412.658 4228233 -212133.963 Nov 5 54672.916 4265089 -322360.169 Dec 5 59222.341 4276127 -20870.664 Jan 6 20883.955 4287165 617694.651 Feb 6 42876.153 4274682 813072.655 Mar 6 4655.715 4262199 178000.295 Apr 6 -37834.437 4215284 -210130.720 May 6 -59599.258 4168369 -177520.065 Jun 6 36467.988 4085984 113499.734 Jul 6 -32978.323 4003599 198598.092 Aug 6 -65718.977 3916396 -71612.650 Sep 6 -57060.727 3829192 -213321.296 Oct 6 34412.658 3764270 -99216.946 Nov 6 54672.916 3699349 -103328.469 Dec 6 59222.341 3645070 -178659.646 Jan 7 20883.955 3590792 -141400.014 Feb 7 42876.153 3554105 262112.832 Mar 7 4655.715 3517418 139081.313 Apr 7 -37834.437 3500967 -106767.572 May 7 -59599.258 3484516 -80476.787 Jun 7 36467.988 3460146 -157929.801 Jul 7 -32978.323 3435776 1496.744 Aug 7 -65718.977 3404909 -49871.036 Sep 7 -57060.727 3374042 152270.281 Oct 7 34412.658 3358117 179320.092 Nov 7 54672.916 3342192 243049.031 Dec 7 59222.341 3336482 -303974.604 Jan 8 20883.955 3330772 -273507.429 Feb 8 42876.153 3325468 -180229.300 Mar 8 4655.715 3320164 -78737.534 Apr 8 -37834.437 3330300 194526.547 May 8 -59599.258 3340436 97350.299 Jun 8 36467.988 3375970 -130131.569 Jul 8 -32978.323 3411503 -90179.880 Aug 8 -65718.977 3455574 -64106.113 Sep 8 -57060.727 3499645 -90322.250 Oct 8 34412.658 3550247 -52705.859 Nov 8 54672.916 3600849 67099.660 Dec 8 59222.341 3665118 85024.934 Jan 9 20883.955 3729386 347.019 Feb 9 42876.153 3798639 -226228.772 Mar 9 4655.715 3867891 -175990.927 Apr 9 -37834.437 3935819 225974.832 May 9 -59599.258 4003746 192016.260 Jun 9 36467.988 4081752 -184827.583 Jul 9 -32978.323 4159757 -91202.869 Aug 9 -65718.977 4230384 386536.683 Sep 9 -57060.727 4301011 -211755.670 Oct 9 34412.658 4343475 -406994.414 Nov 9 54672.916 4385938 48404.970 Dec 9 59222.341 4400513 966391.933 Jan 10 20883.955 4415087 142252.706 Feb 10 42876.153 4408067 -324553.157 Mar 10 4655.715 4401047 486397.614 Apr 10 -37834.437 4375061 -208529.410 May 10 -59599.258 4349075 119245.235 Jun 10 36467.988 4296268 -133270.756 Jul 10 -32978.323 4243461 -135715.189 Aug 10 -65718.977 4183859 43617.867 Sep 10 -57060.727 4124258 -175877.981 Oct 10 34412.658 4070403 365486.103 Nov 10 54672.916 4016549 211889.315 Dec 10 59222.341 3972942 -186202.678 Jan 11 20883.955 3929336 -38748.861 Feb 11 42876.153 3882038 -126435.918 Mar 11 4655.715 3834740 -195082.339 Apr 11 -37834.437 3778113 43750.579 May 11 -59599.258 3721486 -14752.832 Jun 11 36467.988 3676319 281874.724 Jul 11 -32978.323 3631152 9661.837 Aug 11 -65718.977 3607556 24171.147 Sep 11 -57060.727 3583959 -15486.447 Oct 11 34412.658 3558541 -334289.102 Nov 11 54672.916 3533124 -101223.629 Dec 11 59222.341 3510920 -200699.005 Jan 12 20883.955 3488716 -44055.571 Feb 12 42876.153 3472507 389840.696 Mar 12 4655.715 3456299 272926.599 Apr 12 -37834.437 3442791 -184315.040 May 12 -59599.258 3429284 -143873.009 Jun 12 36467.988 3416142 -98149.315 Jul 12 -32978.323 3403000 -17761.063 Aug 12 -65718.977 3389973 126397.500 > m$win s t l 1401 19 13 > m$deg s t l 0 1 1 > m$jump s t l 141 2 2 > m$inner [1] 2 > m$outer [1] 0 > postscript(file="/var/wessaorg/rcomp/tmp/1ua4r1322734089.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/2jt7h1322734089.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/37z0z1322734089.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/45stw1322734089.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/5harx1322734089.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/61ugw1322734089.tab") > > try(system("convert tmp/1ua4r1322734089.ps tmp/1ua4r1322734089.png",intern=TRUE)) character(0) > try(system("convert tmp/2jt7h1322734089.ps tmp/2jt7h1322734089.png",intern=TRUE)) character(0) > try(system("convert tmp/37z0z1322734089.ps tmp/37z0z1322734089.png",intern=TRUE)) character(0) > try(system("convert tmp/45stw1322734089.ps tmp/45stw1322734089.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.740 0.213 1.973