R version 2.15.2 (2012-10-26) -- "Trick or Treat" Copyright (C) 2012 The R Foundation for Statistical Computing ISBN 3-900051-07-0 Platform: i686-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(164,96,73,49,39,59,169,169,210,278,298,245,200,188,90,79,78,91,167,169,289,247,275,203,223,104,107,85,75,99,135,211,335,488,326,346,261,224,141,148,145,223,272,445,560,612,467,404,518,404,300,210,196,186,247,343,464,680,711,610,513,292,273,322,189,257,324,404,677,858,895,664,628,308,324,248,272) > par8 = 'FALSE' > par7 = '1' > par6 = '' > par5 = '1' > par4 = '' > par3 = '0' > par2 = 'periodic' > par1 = '12' > main = 'Seasonal Decomposition by Loess' > par8 <- 'FALSE' > par7 <- '1' > par6 <- '' > par5 <- '1' > par4 <- '' > par3 <- '0' > par2 <- 'periodic' > par1 <- '12' > #'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 66.236215 168.5128 -70.7490065 Feb 1 -64.997068 167.1907 -6.1936054 Mar 1 -112.944750 165.8686 20.0761933 Apr 1 -141.828596 164.6544 26.1741685 May 1 -167.855322 163.4403 43.4150236 Jun 1 -135.651392 163.0561 31.5953315 Jul 1 -74.953262 162.6718 81.2814396 Aug 1 -7.172677 163.0570 13.1156296 Sep 1 121.774528 163.4423 -75.2168011 Oct 1 224.109489 163.6883 -109.7978161 Nov 1 189.944397 163.9344 -55.8787793 Dec 1 103.338476 167.8989 -26.2373998 Jan 2 66.236215 171.8635 -38.0996798 Feb 2 -64.997068 176.8957 76.1014059 Mar 2 -112.944750 181.9279 21.0168890 Apr 2 -141.828596 183.3203 37.5083279 May 2 -167.855322 184.7127 61.1426467 Jun 2 -135.651392 180.4799 46.1715197 Jul 2 -74.953262 176.2471 65.7061929 Aug 2 -7.172677 171.1339 5.0387762 Sep 2 121.774528 166.0207 1.2047388 Oct 2 224.109489 163.9579 -141.0673445 Nov 2 189.944397 161.8950 -76.8393759 Dec 2 103.338476 163.6630 -64.0015057 Jan 3 66.236215 165.4311 -8.6672950 Feb 3 -64.997068 172.4046 -3.4075025 Mar 3 -112.944750 179.3781 40.5666875 Apr 3 -141.828596 189.4365 37.3920593 May 3 -167.855322 199.4950 43.3603112 Jun 3 -135.651392 206.9906 27.6607929 Jul 3 -74.953262 214.4862 -4.5329253 Aug 3 -7.172677 218.8854 -0.7127197 Sep 3 121.774528 223.2846 -10.0591348 Oct 3 224.109489 228.4979 35.3926044 Nov 3 189.944397 233.7112 -97.6556045 Dec 3 103.338476 243.4723 -0.8107744 Jan 4 66.236215 253.2334 -58.4696037 Feb 4 -64.997068 268.8256 20.1714976 Mar 4 -112.944750 284.4178 -30.4730036 Apr 4 -141.828596 299.9770 -10.1483901 May 4 -167.855322 315.5362 -2.6808966 Jun 4 -135.651392 329.1635 29.4878798 Jul 4 -74.953262 342.7908 4.1624564 Aug 4 -7.172677 354.8603 97.3123542 Sep 4 121.774528 366.9298 71.2956315 Oct 4 224.109489 374.0125 13.8780584 Nov 4 189.944397 381.0951 -104.0394628 Dec 4 103.338476 380.2234 -79.5619250 Jan 5 66.236215 379.3518 72.4119532 Feb 5 -64.997068 375.9147 93.0823628 Mar 5 -112.944750 372.4776 40.4671699 Apr 5 -141.828596 375.5971 -23.7684612 May 5 -167.855322 378.7165 -14.8612123 Jun 5 -135.651392 385.5920 -63.9405743 Jul 5 -74.953262 392.4674 -70.5141361 Aug 5 -7.172677 395.7976 -45.6249566 Sep 5 121.774528 399.1279 -56.9023977 Oct 5 224.109489 403.1965 52.6939840 Nov 5 189.944397 407.2652 113.7904176 Dec 5 103.338476 412.1331 94.5283988 Jan 6 66.236215 417.0011 29.7627204 Feb 6 -64.997068 422.6811 -65.6840579 Mar 6 -112.944750 428.3612 -42.4164386 Apr 6 -141.828596 438.2072 25.6214425 May 6 -167.855322 448.0531 -91.1977965 Jun 6 -135.651392 460.2015 -67.5500748 Jul 6 -74.953262 472.3498 -73.3965530 Aug 6 -7.172677 478.1439 -66.9711919 Sep 6 121.774528 483.9379 71.2875485 Oct 6 224.109489 484.0953 149.7951991 Nov 6 189.944397 484.2527 220.8029016 Dec 6 103.338476 485.2078 75.4537363 Jan 7 66.236215 486.1629 75.6009115 Feb 7 -64.997068 485.5330 -112.5359809 Mar 7 -112.944750 484.9032 -47.9584757 Apr 7 -141.828596 481.6067 -91.7781317 May 7 -167.855322 478.3102 -38.4549078 > m$win s t l 771 19 13 > m$deg s t l 0 1 1 > m$jump s t l 78 2 2 > m$inner [1] 2 > m$outer [1] 0 > postscript(file="/var/fisher/rcomp/tmp/1yuwj1355859873.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/fisher/rcomp/tmp/2mmtj1355859873.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/fisher/rcomp/tmp/3m6p91355859873.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/fisher/rcomp/tmp/4387d1355859873.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/fisher/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/fisher/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/fisher/rcomp/tmp/574251355859873.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/fisher/rcomp/tmp/6lxki1355859873.tab") > > try(system("convert tmp/1yuwj1355859873.ps tmp/1yuwj1355859873.png",intern=TRUE)) character(0) > try(system("convert tmp/2mmtj1355859873.ps tmp/2mmtj1355859873.png",intern=TRUE)) character(0) > try(system("convert tmp/3m6p91355859873.ps tmp/3m6p91355859873.png",intern=TRUE)) character(0) > try(system("convert tmp/4387d1355859873.ps tmp/4387d1355859873.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.454 0.747 3.188