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(47.54,45.31,46.9,47.16,48.24,52.7,51.72,51.5,52.45,53,48.36,46.63,45.92,45.53,42.17,43.66,45.32,47.43,47.76,49.49,50.69,49.8,52.13,53.94,60.75,59.19,57.58,59.16,64.74,67.04,75.53,78.91,78.4,70.07,66.8,61.02,52.38,42.37,39.83,38.79,37.33,39.4,39.45,43.24,42.33,45.5,43.44,43.88,45.61,45.12,47.56,47.04,51.07,54.72,55.37,55.39,53.13,53.71,54.59,54.61) > par8 = 'FALSE' > par7 = '1' > par6 = '' > par5 = '1' > par4 = '' > par3 = '0' > par2 = 'periodic' > par1 = '5' > 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 Time Series: Start = c(1, 1) End = c(12, 5) Frequency = 5 seasonal trend remainder 1.0 0.84188993 45.64269 1.05541997 1.2 -0.48984137 46.46210 -0.66225490 1.4 -0.54546307 47.33466 0.11080618 1.6 -0.01903612 48.24710 -1.06806452 1.8 0.21245172 49.23648 -1.20893624 2.0 0.84188993 50.33416 1.52394969 2.2 -0.48984137 51.35077 0.85906658 2.4 -0.54546307 51.89037 0.15509698 2.6 -0.01903612 51.44568 1.02335595 2.8 0.21245172 50.42299 2.36455676 3.0 0.84188993 49.19102 -1.67290621 3.2 -0.48984137 47.66719 -0.54735118 3.4 -0.54546307 46.02354 0.44192636 3.6 -0.01903612 44.92367 0.62536323 3.8 0.21245172 44.54874 -2.59119342 4.0 0.84188993 44.75611 -1.93800015 4.2 -0.48984137 45.50128 0.30855833 4.4 -0.54546307 46.75907 1.21638894 4.6 -0.01903612 48.04019 -0.26115860 4.8 0.21245172 49.04174 0.23581136 5.0 0.84188993 50.02454 -0.17643434 5.2 -0.48984137 51.39668 -1.10683430 5.4 -0.54546307 53.27132 -0.59586100 5.6 -0.01903612 55.15300 -1.19396506 5.8 0.21245172 56.77743 3.76011766 6.0 0.84188993 58.33400 0.01410962 6.2 -0.48984137 59.98134 -1.91149697 6.4 -0.54546307 61.90183 -2.19636491 6.6 -0.01903612 64.95614 -0.19710414 6.8 0.21245172 68.94780 -2.12025376 7.0 0.84188993 72.40351 2.28459650 7.2 -0.48984137 74.02817 5.37166851 7.4 -0.54546307 73.52616 5.41930804 7.6 -0.01903612 70.57830 -0.48926617 7.8 0.21245172 65.33958 1.24797180 8.0 0.84188993 58.86516 1.31294579 8.2 -0.48984137 52.54796 0.32187666 8.4 -0.54546307 46.92081 -4.00534652 8.6 -0.01903612 42.46437 -2.61533323 8.8 0.21245172 39.88109 -1.30354103 9.0 0.84188993 39.16166 -2.67354898 9.2 -0.48984137 39.59992 0.28991681 9.4 -0.54546307 40.58052 -0.58505976 9.6 -0.01903612 41.81313 1.44590148 9.8 0.21245172 42.83401 -0.71646465 10.0 0.84188993 43.59543 1.06267634 10.2 -0.48984137 44.17821 -0.24837022 10.4 -0.54546307 44.67388 -0.24841307 10.6 -0.01903612 45.18336 0.44568017 10.8 0.21245172 45.97708 -1.06952936 11.0 0.84188993 47.30192 -0.58380749 11.2 -0.48984137 49.10564 -1.57580086 11.4 -0.54546307 51.06409 0.55137133 11.6 -0.01903612 52.73130 2.00773365 11.8 0.21245172 53.85592 1.30162933 12.0 0.84188993 54.34803 0.20007560 12.2 -0.48984137 54.37265 -0.75280683 12.4 -0.54546307 54.36137 -0.10590647 12.6 -0.01903612 54.34526 0.26377289 12.8 0.21245172 54.34133 0.05621753 > m$win s t l 601 9 5 > m$deg s t l 0 1 1 > m$jump s t l 61 1 1 > m$inner [1] 2 > m$outer [1] 0 > postscript(file="/var/www/html/rcomp/tmp/1cq7g1290870165.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/2cq7g1290870165.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/3cq7g1290870165.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/45h611290870165.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/51r4s1290870165.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/6mrly1290870165.tab") > > try(system("convert tmp/1cq7g1290870165.ps tmp/1cq7g1290870165.png",intern=TRUE)) character(0) > try(system("convert tmp/2cq7g1290870165.ps tmp/2cq7g1290870165.png",intern=TRUE)) character(0) > try(system("convert tmp/3cq7g1290870165.ps tmp/3cq7g1290870165.png",intern=TRUE)) character(0) > try(system("convert tmp/45h611290870165.ps tmp/45h611290870165.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 0.951 0.656 4.081