R version 2.9.0 (2009-04-17) Copyright (C) 2009 The R Foundation for Statistical Computing ISBN 3-900051-07-0 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(0.0314796223103059 + ,-3.00870920563557 + ,-2.07677512619799 + ,-1.25010391965540 + ,0.817975239137125 + ,0.0252076485413113 + ,0.554937772830776 + ,0.230027371950115 + ,2.35672227418686 + ,1.41350455171120 + ,2.73311719024401 + ,1.31551925971717 + ,-2.70076272244080 + ,-0.721411049152714 + ,-0.149388576811997 + ,-0.118199629770334 + ,-0.676562489695275 + ,1.79699928690761 + ,1.79845572032988 + ,0.245100010770855 + ,1.80710848932636 + ,-1.75934771184948 + ,-0.0186697168761931 + ,0.189651523600062 + ,-1.84149562719087 + ,-1.07019530156943 + ,-0.507291477584104 + ,0.866365633831705 + ,-1.76077926699189 + ,-0.580719393339347 + ,-0.435702079860853 + ,-0.994868534845203 + ,1.63136048315789 + ,-1.1949403709466 + ,-1.00525975426991 + ,1.32302234837564 + ,-0.628357549594746 + ,0.632048410440518 + ,-2.16903155809288 + ,2.53779364144266 + ,-0.632933703679292 + ,-1.41749196342200 + ,-0.455343045381255 + ,0.812255211942954 + ,0.627897309219833 + ,0.650904313655623 + ,-1.29800419154382 + ,0.74391671726854 + ,-1.50461634127457 + ,-1.42734677658523 + ,0.263353807408564 + ,-0.430830854870631 + ,0.379576092518008 + ,1.70309353400146 + ,-3.12314448117342 + ,-1.32526207118689 + ,-0.60032490743804 + ,1.23607137604666 + ,0.738007075905376 + ,0.899100896289585) > 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 -1.19588792 -0.61436538 1.841732927 Feb 1 -0.98896366 -0.47765790 -1.542087644 Mar 1 -0.80037317 -0.34095042 -0.935451537 Apr 1 0.44574196 -0.22185868 -1.473987198 May 1 -0.25252714 -0.10276695 1.173269324 Jun 1 0.42785722 -0.00180784 -0.400841735 Jul 1 -0.20929721 0.09915127 0.665083718 Aug 1 -0.09586532 0.20197251 0.123920180 Sep 1 1.26305998 0.30479375 0.788868543 Oct 1 0.14971653 0.38773006 0.876057965 Nov 1 0.29228831 0.47066636 1.970162518 Dec 1 0.96424959 0.48494017 -0.133670495 Jan 2 -1.19588792 0.49921397 -2.004088772 Feb 2 -0.98896366 0.47347544 -0.205922824 Mar 2 -0.80037317 0.44773690 0.203247693 Apr 2 0.44574196 0.35371680 -0.917658388 May 2 -0.25252714 0.25969669 -0.683732046 Jun 2 0.42785722 0.17551333 1.193628734 Jul 2 -0.20929721 0.09132997 1.916422967 Aug 2 -0.09586532 0.06139369 0.279571639 Sep 2 1.26305998 0.03145741 0.512591098 Oct 2 0.14971653 -0.03137079 -1.877693448 Nov 2 0.29228831 -0.09419900 -0.216759029 Dec 2 0.96424959 -0.20393650 -0.570661567 Jan 3 -1.19588792 -0.31367400 -0.331933708 Feb 3 -0.98896366 -0.39026810 0.309036465 Mar 3 -0.80037317 -0.46686221 0.759943907 Apr 3 0.44574196 -0.47739940 0.898023074 May 3 -0.25252714 -0.48793659 -1.020315540 Jun 3 0.42785722 -0.46502647 -0.543550149 Jul 3 -0.20929721 -0.44211635 0.215711480 Aug 3 -0.09586532 -0.39278250 -0.506220716 Sep 3 1.26305998 -0.34344866 0.711749160 Oct 3 0.14971653 -0.27697051 -1.067686391 Nov 3 0.29228831 -0.21049236 -1.087055702 Dec 3 0.96424959 -0.16184678 0.520619544 Jan 4 -1.19588792 -0.11320121 0.680731578 Feb 4 -0.98896366 -0.07759061 1.698602680 Mar 4 -0.80037317 -0.04198001 -1.326678375 Apr 4 0.44574196 -0.03240456 2.124456242 May 4 -0.25252714 -0.02282911 -0.357577454 Jun 4 0.42785722 -0.07015228 -1.775196904 Jul 4 -0.20929721 -0.11747545 -0.128570379 Aug 4 -0.09586532 -0.17393026 1.082050792 Sep 4 1.26305998 -0.23038508 -0.404777598 Oct 4 0.14971653 -0.22355278 0.724740566 Nov 4 0.29228831 -0.21672049 -1.373572010 Dec 4 0.96424959 -0.21333771 -0.006995159 Jan 5 -1.19588792 -0.20995493 -0.098773487 Feb 5 -0.98896366 -0.26789290 -0.170490212 Mar 5 -0.80037317 -0.32583087 1.389557853 Apr 5 0.44574196 -0.33224003 -0.544332787 May 5 -0.25252714 -0.33864918 0.970752413 Jun 5 0.42785722 -0.32467600 1.599912311 Jul 5 -0.20929721 -0.31070282 -2.603144451 Aug 5 -0.09586532 -0.30667830 -0.922718453 Sep 5 1.26305998 -0.30265379 -1.560731102 Oct 5 0.14971653 -0.30115386 1.387508708 Nov 5 0.29228831 -0.29965394 0.745372704 Dec 5 0.96424959 -0.29283862 0.227689933 > 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/www/html/rcomp/tmp/1z44h1259788618.ps",horizontal=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/www/html/rcomp/tmp/2pu491259788618.ps",horizontal=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/www/html/rcomp/tmp/31or51259788618.ps",horizontal=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/www/html/rcomp/tmp/453r81259788618.ps",horizontal=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/www/html/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/html/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/www/html/rcomp/tmp/5np6z1259788619.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/www/html/rcomp/tmp/6gy721259788619.tab") > system("convert tmp/1z44h1259788618.ps tmp/1z44h1259788618.png") > system("convert tmp/2pu491259788618.ps tmp/2pu491259788618.png") > system("convert tmp/31or51259788618.ps tmp/31or51259788618.png") > system("convert tmp/453r81259788618.ps tmp/453r81259788618.png") > > > proc.time() user system elapsed 1.024 0.632 2.298