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(26.81,28.24,27.58,27.98,26.81,28.24,27.58,27.98,27.84,27.49,26.97,27.71,27.46,27.04,28.00,27.32,26.36,26.15,25.94,24.00,24.32,23.10,22.92,23.56,22.17,22.36,19.86,20.07,19.21,19.99,20.47,21.17,21.25,21.18,21.21,21.11,21.94,22.56,23.23,19.50,19.32,19.00,18.98,19.88,19.48,19.52,19.52,19.75,19.64,20.23,20.40,20.91,21.95,21.83,22.27,21.99,21.66,20.32,20.62,20.28,20.79,22.86,22.59,23.29,21.87,21.52,22.00,27.84,27.49,26.97,27.71,27.46,27.04,28.00,27.32,26.36,26.15,25.94,24.00,24.32,23.10,22.92,23.56,22.17,22.36,19.86,20.07,19.21,19.99,20.47,21.17,21.25,21.18,21.21,21.11,21.94,22.56,23.23,19.50,19.32,19.00,18.98,19.88,19.48,19.52,19.52,19.75,19.64,20.23,20.40,20.91,21.95,21.83,22.27,21.99,21.66,20.32,20.62,20.28,20.79,22.86,22.59,23.29,21.87,21.52,22.00) > par8 = 'FALSE' > par7 = '1' > par6 = '' > par5 = '1' > par4 = '' > par3 = '0' > par2 = 'periodic' > par1 = '4' > main = 'Seasonal Decomposition by Loess' > par8 <- 'FALSE' > par7 <- '1' > par6 <- '' > par5 <- '1' > par4 <- '' > par3 <- '0' > par2 <- 'periodic' > par1 <- '4' > #'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 1 Q1 -0.06824041 27.41368 -0.5354367632 1 Q2 0.06269398 27.51733 0.6599763811 1 Q3 -0.03626698 27.60617 0.0100985302 1 Q4 0.04181327 27.63175 0.3064410122 2 Q1 -0.06824041 27.63074 -0.7525017907 2 Q2 0.06269398 27.65255 0.5247533631 2 Q3 -0.03626698 27.79802 -0.1817480658 2 Q4 0.04181327 27.82078 0.1174043589 3 Q1 -0.06824041 27.67315 0.2350857909 3 Q2 0.06269398 27.51788 -0.0905732962 3 Q3 -0.03626698 27.42639 -0.4201261395 3 Q4 0.04181327 27.36937 0.2988134806 4 Q1 -0.06824041 27.42147 0.1067666968 4 Q2 0.06269398 27.48929 -0.5119838628 4 Q3 -0.03626698 27.35868 0.6775830477 4 Q4 0.04181327 27.10538 0.1728099435 5 Q1 -0.06824041 26.67441 -0.2461711594 5 Q2 0.06269398 26.05237 0.0349324125 5 Q3 -0.03626698 25.37366 0.6026048250 5 Q4 0.04181327 24.70674 -0.7485551386 6 Q1 -0.06824041 23.94723 0.4410057861 6 Q2 0.06269398 23.50314 -0.4658348562 6 Q3 -0.03626698 23.19255 -0.2362782595 6 Q4 0.04181327 22.87569 0.6424960119 7 Q1 -0.06824041 22.41906 -0.1808211048 7 Q2 0.06269398 21.56169 0.7356155753 7 Q3 -0.03626698 20.71817 -0.8219015305 7 Q4 0.04181327 20.01903 0.0091569826 8 Q1 -0.06824041 19.82163 -0.5433915081 8 Q2 0.06269398 20.03958 -0.1122727531 8 Q3 -0.03626698 20.47565 0.0306140109 8 Q4 0.04181327 20.89622 0.2319658972 9 Q1 -0.06824041 21.12955 0.1886860253 9 Q2 0.06269398 21.19806 -0.0807546368 9 Q3 -0.03626698 21.25099 -0.0047185361 9 Q4 0.04181327 21.50276 -0.4345769306 10 Q1 -0.06824041 21.94225 0.0659946937 10 Q2 0.06269398 22.12200 0.3753037622 10 Q3 -0.03626698 21.57890 1.6873700363 10 Q4 0.04181327 20.66855 -1.2103632635 11 Q1 -0.06824041 19.64136 -0.2531147377 11 Q2 0.06269398 19.21542 -0.2781105096 11 Q3 -0.03626698 19.29719 -0.2809272242 11 Q4 0.04181327 19.42487 0.4133118422 12 Q1 -0.06824041 19.54684 0.0013991587 12 Q2 0.06269398 19.56920 -0.1118967563 12 Q3 -0.03626698 19.58425 -0.0279801919 12 Q4 0.04181327 19.69009 0.0181012683 13 Q1 -0.06824041 19.88356 -0.1753204429 13 Q2 0.06269398 20.14276 0.0245508306 13 Q3 -0.03626698 20.56349 -0.1272209559 13 Q4 0.04181327 21.07214 -0.2039536451 14 Q1 -0.06824041 21.52958 0.4886576637 14 Q2 0.06269398 21.89796 -0.1306551935 14 Q3 -0.03626698 21.98963 0.3166405514 14 Q4 0.04181327 21.79633 0.1518617025 15 Q1 -0.06824041 21.35808 0.3701566666 15 Q2 0.06269398 20.90399 -0.6466805837 15 Q3 -0.03626698 20.57425 0.0820141733 15 Q4 0.04181327 20.76231 -0.5241254969 16 Q1 -0.06824041 21.35311 -0.4948654164 16 Q2 0.06269398 22.04537 0.7519380242 16 Q3 -0.03626698 22.58383 0.0424346933 16 Q4 0.04181327 22.52859 0.7195997890 17 Q1 -0.06824041 22.22943 -0.2911943714 17 Q2 0.06269398 22.54266 -1.0853568947 17 Q3 -0.03626698 23.90779 -1.8715232968 17 Q4 0.04181327 25.53583 2.2623583776 18 Q1 -0.06824041 26.91919 0.6390540662 18 Q2 0.06269398 27.42955 -0.5222394319 18 Q3 -0.03626698 27.36440 0.3818623742 18 Q4 0.04181327 27.42366 -0.0054735259 19 Q1 -0.06824041 27.48892 -0.3806792621 19 Q2 0.06269398 27.36184 0.5754698066 19 Q3 -0.03626698 27.10041 0.2558588135 19 Q4 0.04181327 26.67660 -0.3584114057 20 Q1 -0.06824041 26.05200 0.1662370092 20 Q2 0.06269398 25.37681 0.5004916353 20 Q3 -0.03626698 24.70177 -0.6655062922 20 Q4 0.04181327 23.94942 0.3287655161 21 Q1 -0.06824041 23.50277 -0.3345302636 21 Q2 0.06269398 23.19570 -0.3383913978 21 Q3 -0.03626698 22.87072 0.7255448347 21 Q4 0.04181327 22.42125 -0.2930613985 22 Q1 -0.06824041 21.56132 0.8669201637 22 Q2 0.06269398 20.72132 -0.9240146174 22 Q3 -0.03626698 20.01406 0.0922057818 22 Q4 0.04181327 19.82382 -0.6556318254 23 Q1 -0.06824041 20.03921 0.0190318312 23 Q2 0.06269398 20.47881 -0.0714990247 23 Q3 -0.03626698 20.89125 0.3150146728 23 Q4 0.04181327 21.13174 0.0764456843 24 Q1 -0.06824041 21.19769 0.0505499434 24 Q2 0.06269398 21.25414 -0.1068315204 24 Q3 -0.03626698 21.49780 -0.3515281787 24 Q4 0.04181327 21.94443 -0.0462456710 25 Q1 -0.06824041 22.12163 0.5066083383 25 Q2 0.06269398 21.58205 1.5852571034 25 Q3 -0.03626698 20.66358 -1.1273145351 25 Q4 0.04181327 19.64354 -0.3653551261 26 Q1 -0.06824041 19.21505 -0.1468059375 26 Q2 0.06269398 19.30035 -0.3830401056 26 Q3 -0.03626698 19.41991 0.4963605470 26 Q4 0.04181327 19.54903 -0.1108412533 27 Q1 -0.06824041 19.56883 0.0194078116 27 Q2 0.06269398 19.58740 -0.1300930220 27 Q3 -0.03626698 19.68512 0.1011499494 27 Q4 0.04181327 19.88575 -0.2875608787 28 Q1 -0.06824041 20.14239 0.1558553944 28 Q2 0.06269398 20.56664 -0.2293337346 28 Q3 -0.03626698 21.06717 -0.1209049875 28 Q4 0.04181327 21.53177 0.3764172043 29 Q1 -0.06824041 21.89759 0.0006493662 29 Q2 0.06269398 21.99278 0.2145278240 29 Q3 -0.03626698 21.79136 0.2349103364 29 Q4 0.04181327 21.36027 0.2579161836 30 Q1 -0.06824041 20.90362 -0.5153760281 30 Q2 0.06269398 20.57740 -0.0200985027 30 Q3 -0.03626698 20.75734 -0.4410768865 30 Q4 0.04181327 21.35529 -0.6071059230 31 Q1 -0.06824041 22.04500 0.8832425765 31 Q2 0.06269398 22.58698 -0.0596779284 31 Q3 -0.03626698 22.52362 0.8026483826 31 Q4 0.04181327 22.22684 -0.3986540450 32 Q1 -0.06824041 21.93736 -0.3491235240 32 Q2 0.06269398 21.63426 0.3030456138 > m$win s t l 1261 7 5 > m$deg s t l 0 1 1 > m$jump s t l 127 1 1 > m$inner [1] 2 > m$outer [1] 0 > postscript(file="/var/wessaorg/rcomp/tmp/1yffw1356016623.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/2gekd1356016623.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/3x0f61356016623.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/4oqyy1356016623.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/5gou01356016623.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/6fot21356016623.tab") > > try(system("convert tmp/1yffw1356016623.ps tmp/1yffw1356016623.png",intern=TRUE)) character(0) > try(system("convert tmp/2gekd1356016623.ps tmp/2gekd1356016623.png",intern=TRUE)) character(0) > try(system("convert tmp/3x0f61356016623.ps tmp/3x0f61356016623.png",intern=TRUE)) character(0) > try(system("convert tmp/4oqyy1356016623.ps tmp/4oqyy1356016623.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 3.055 0.543 3.581