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(41,39,50,40,43,38,44,35,39,35,29,49,50,59,63,32,39,47,53,60,57,52,70,90,74,62,55,84,94,70,108,139,120,97,126,149,158,124,140,109,114,77,120,133,110,92,97,78,99,107,112,90,98,125,155,190,236,189,174,178,136,161,171,149,184,155,276,224,213,279,268,287,238,213,257,293,212,246,353,339,308,247,257,322,298,273,312,249,286,279,309,401,309,328,353,354,327,324,285,243,241,287,355,460,364,487,452,391,500,451,375,372,302,316,398,394,431,431) > 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 6.795182 53.14542 -18.9406054 Feb 1 -6.581742 51.18324 -5.6014961 Mar 1 -8.458645 49.22105 9.2375931 Apr 1 -27.009457 47.56188 19.4475762 May 1 -34.460255 45.90271 31.5575457 Jun 1 -34.257676 44.79473 27.4629504 Jul 1 16.344927 43.68674 -16.0316703 Aug 1 34.246572 42.79296 -42.0395280 Sep 1 12.948213 41.89917 -15.8473824 Oct 1 15.571660 41.38137 -21.9530312 Nov 1 10.072214 40.86357 -21.9357865 Dec 1 14.789013 42.63180 -8.4208123 Jan 2 6.795182 44.40003 -1.1952087 Feb 2 -6.581742 46.76404 18.8176976 Mar 2 -8.458645 49.12806 22.3305838 Apr 2 -27.009457 50.95435 8.0551044 May 2 -34.460255 52.78064 20.6796113 Jun 2 -34.257676 54.13202 27.1256567 Jul 2 16.344927 55.48340 -18.8283233 Aug 2 34.246572 56.36611 -30.6126858 Sep 2 12.948213 57.24883 -13.1970449 Oct 2 15.571660 59.69693 -23.2685887 Nov 2 10.072214 62.14502 -2.2172390 Dec 2 14.789013 66.76258 8.4484047 Jan 3 6.795182 71.38014 -4.1753222 Feb 3 -6.581742 76.96848 -8.3867374 Mar 3 -8.458645 82.55682 -19.0981727 Apr 3 -27.009457 87.40553 23.6039300 May 3 -34.460255 92.25424 36.2060190 Jun 3 -34.257676 97.16745 7.0902257 Jul 3 16.344927 102.08067 -10.4255930 Aug 3 34.246572 107.01026 -2.2568309 Sep 3 12.948213 111.93985 -4.8880655 Oct 3 15.571660 115.66810 -34.2397645 Nov 3 10.072214 119.39636 -3.4685700 Dec 3 14.789013 121.42771 12.7832759 Jan 4 6.795182 123.45907 27.7457512 Feb 4 -6.581742 123.89786 6.6838798 Mar 4 -8.458645 124.33666 24.1219884 Apr 4 -27.009457 122.13410 13.8753552 May 4 -34.460255 119.93155 28.5287084 Jun 4 -34.257676 115.49988 -4.2422044 Jul 4 16.344927 111.06822 -7.4131425 Aug 4 34.246572 107.10818 -8.3547484 Sep 4 12.948213 103.14814 -6.0963510 Oct 4 15.571660 101.88402 -25.4556829 Nov 4 10.072214 100.61991 -13.6921213 Dec 4 14.789013 102.94997 -39.7389826 Jan 5 6.795182 105.28003 -13.0752145 Feb 5 -6.581742 111.61392 1.9678219 Mar 5 -8.458645 117.94781 2.5108382 Apr 5 -27.009457 126.26376 -9.2543065 May 5 -34.460255 134.57972 -2.1194649 Jun 5 -34.257676 141.57800 17.6796777 Jul 5 16.344927 148.57628 -9.9212050 Aug 5 34.246572 153.39384 2.3595863 Sep 5 12.948213 158.21141 64.8403810 Oct 5 15.571660 162.57463 10.8537093 Nov 5 10.072214 166.93785 -3.0100689 Dec 5 14.789013 171.49844 -8.2874574 Jan 6 6.795182 176.05903 -46.8542164 Feb 6 -6.581742 180.25100 -12.6692616 Mar 6 -8.458645 184.44297 -4.9843269 Apr 6 -27.009457 190.34372 -14.3342673 May 6 -34.460255 196.24448 22.2157787 Jun 6 -34.257676 204.23438 -14.9767025 Jul 6 16.344927 212.22428 47.4307909 Aug 6 34.246572 219.78799 -30.0345645 Sep 6 12.948213 227.35170 -27.2999166 Oct 6 15.571660 233.97095 29.4573857 Nov 6 10.072214 240.59020 17.3375816 Dec 6 14.789013 247.48110 24.7298889 Jan 7 6.795182 254.37199 -23.1671744 Feb 7 -6.581742 260.70619 -41.1244437 Mar 7 -8.458645 267.04038 -1.5817331 Apr 7 -27.009457 270.55989 49.4495701 May 7 -34.460255 274.07940 -27.6191404 Jun 7 -34.257676 276.42375 3.8339222 Jul 7 16.344927 278.76811 57.8869593 Aug 7 34.246572 281.47189 23.2815368 Sep 7 12.948213 284.17567 10.8761176 Oct 7 15.571660 285.81417 -54.3858263 Nov 7 10.072214 287.45266 -40.5248768 Dec 7 14.789013 288.99949 18.2114999 Jan 8 6.795182 290.54631 0.6585060 Feb 8 -6.581742 293.37440 -13.7926600 Mar 8 -8.458645 296.20249 24.2561539 Apr 8 -27.009457 300.87801 -24.8685545 May 8 -34.460255 305.55353 14.9067233 Jun 8 -34.257676 309.72862 3.5290613 Jul 8 16.344927 313.90370 -21.2486260 Aug 8 34.246572 315.94328 50.8101464 Sep 8 12.948213 317.98286 -21.9310778 Oct 8 15.571660 317.47320 -5.0448575 Nov 8 10.072214 316.96353 25.9642562 Dec 8 14.789013 316.69582 22.5151627 Jan 9 6.795182 316.42812 3.7766987 Feb 9 -6.581742 319.72125 10.8604894 Mar 9 -8.458645 323.01438 -29.5557400 Apr 9 -27.009457 330.41729 -60.4078358 May 9 -34.460255 337.82020 -62.3599454 Jun 9 -34.257676 348.07192 -26.8142440 Jul 9 16.344927 358.32364 -19.6685680 Aug 9 34.246572 370.29951 55.4539174 Sep 9 12.948213 382.27538 -31.2235938 Oct 9 15.571660 391.45528 79.9730550 Nov 9 10.072214 400.63519 41.2925974 Dec 9 14.789013 403.53626 -27.3252707 Jan 10 6.795182 406.43733 86.7674905 Feb 10 -6.581742 403.59011 53.9916330 Mar 10 -8.458645 400.74289 -17.2842445 Apr 10 -27.009457 398.50122 0.5082332 May 10 -34.460255 396.25956 -59.7993027 Jun 10 -34.257676 393.28297 -43.0252888 Jul 10 16.344927 390.30637 -8.6513003 Aug 10 34.246572 386.99954 -27.2461112 Sep 10 12.948213 383.69271 34.3590813 Oct 10 15.571660 380.49498 34.9333593 > m$win s t l 1181 19 13 > m$deg s t l 0 1 1 > m$jump s t l 119 2 2 > m$inner [1] 2 > m$outer [1] 0 > postscript(file="/var/wessaorg/rcomp/tmp/1zifa1356019388.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/2eelq1356019388.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/3lkys1356019388.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/4se5p1356019388.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/51veo1356019388.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/680dm1356019388.tab") > > try(system("convert tmp/1zifa1356019388.ps tmp/1zifa1356019388.png",intern=TRUE)) character(0) > try(system("convert tmp/2eelq1356019388.ps tmp/2eelq1356019388.png",intern=TRUE)) character(0) > try(system("convert tmp/3lkys1356019388.ps tmp/3lkys1356019388.png",intern=TRUE)) character(0) > try(system("convert tmp/4se5p1356019388.ps tmp/4se5p1356019388.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.888 0.403 3.452