R version 2.12.0 (2010-10-15) Copyright (C) 2010 The R Foundation for Statistical Computing ISBN 3-900051-07-0 Platform: i486-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(186448,190530,194207,190855,200779,204428,207617,212071,214239,215883,223484,221529,225247,226699,231406,232324,237192,236727,240698,240688,245283,243556,247826,245798,250479,249216,251896,247616,249994,246552,248771,247551,249745,245742,249019,245841,248771,244723,246878,246014,248496,244351,248016,246509,249426,247840,251035,250161,254278,250801,253985,249174,251287,247947,249992,243805,255812,250417,253033,248705,253950,251484,251093,245996,252721,248019,250464,245571,252690,250183,253639,254436,265280,268705,270643,271480) > par8 = 'FALSE' > par7 = '1' > par6 = '' > par5 = '1' > par4 = '' > par3 = '0' > par2 = 'periodic' > par1 = '4' > 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 1 Q1 1690.0376 186155.1 -1397.17540 1 Q2 -950.9576 189240.8 2240.11749 1 Q3 1227.0386 192439.1 540.89971 1 Q4 -1966.1242 195591.2 -2770.07544 2 Q1 1690.0376 199213.9 -124.94613 2 Q2 -950.9576 203635.3 1743.63234 2 Q3 1227.0386 207977.1 -1587.14907 2 Q4 -1966.1242 211108.5 2928.61867 3 Q1 1690.0376 214384.2 -1835.24630 3 Q2 -950.9576 217512.4 -678.41255 3 Q3 1227.0386 220342.8 1914.19085 3 Q4 -1966.1242 222942.8 552.36465 4 Q1 1690.0376 225123.0 -1566.01797 4 Q2 -950.9576 227497.6 152.31602 4 Q3 1227.0386 230454.6 -275.66893 4 Q4 -1966.1242 233221.4 1068.75707 5 Q1 1690.0376 235613.7 -111.72274 5 Q2 -950.9576 237738.7 -60.72659 5 Q3 1227.0386 239842.7 -371.72178 5 Q4 -1966.1242 241766.2 887.91737 6 Q1 1690.0376 243474.9 118.03011 6 Q2 -950.9576 244949.5 -442.53421 6 Q3 1227.0386 246279.7 319.27538 6 Q4 -1966.1242 247642.7 121.45949 7 Q1 1690.0376 248848.5 -59.52678 7 Q2 -950.9576 249643.4 523.51913 7 Q3 1227.0386 249836.9 832.08719 7 Q4 -1966.1242 249383.6 198.56951 8 Q1 1690.0376 248586.9 -282.92159 8 Q2 -950.9576 248128.4 -625.43313 8 Q3 1227.0386 248166.5 -622.54463 8 Q4 -1966.1242 248152.3 1364.86460 9 Q1 1690.0376 248003.2 51.76454 9 Q2 -950.9576 247718.0 -1025.01267 9 Q3 1227.0386 247469.3 322.70652 9 Q4 -1966.1242 247292.1 514.97582 10 Q1 1690.0376 246834.5 246.49906 10 Q2 -950.9576 246473.0 -799.01212 10 Q3 1227.0386 246512.7 -861.69851 10 Q4 -1966.1242 246583.2 1396.90633 11 Q1 1690.0376 246604.1 201.83254 11 Q2 -950.9576 246654.3 -1352.29961 11 Q3 1227.0386 246936.5 -147.51339 11 Q4 -1966.1242 247567.4 907.70770 12 Q1 1690.0376 248308.5 -572.55403 12 Q2 -950.9576 249083.4 -292.45458 12 Q3 1227.0386 250212.7 -404.69337 12 Q4 -1966.1242 251279.3 847.78299 13 Q1 1690.0376 251994.3 593.63572 13 Q2 -950.9576 252200.5 -448.58334 13 Q3 1227.0386 251752.0 1005.99387 13 Q4 -1966.1242 250996.1 143.97718 14 Q1 1690.0376 250046.4 -449.45199 14 Q2 -950.9576 248954.6 -56.60004 14 Q3 1227.0386 248650.7 114.24292 14 Q4 -1966.1242 249552.6 -3781.44722 15 Q1 1690.0376 250507.1 3614.83938 15 Q2 -950.9576 251556.6 -188.67628 15 Q3 1227.0386 251679.9 126.10233 15 Q4 -1966.1242 251615.6 -944.50937 16 Q1 1690.0376 251612.5 647.44676 16 Q2 -950.9576 251107.4 1327.52572 16 Q3 1227.0386 250392.6 -526.63167 16 Q4 -1966.1242 249785.4 -1823.28370 17 Q1 1690.0376 249419.7 1611.28190 17 Q2 -950.9576 249322.6 -352.66644 17 Q3 1227.0386 249088.6 148.37475 17 Q4 -1966.1242 249364.0 -1826.87280 18 Q1 1690.0376 250111.4 888.59108 18 Q2 -950.9576 251594.5 -460.52753 18 Q3 1227.0386 254084.5 -1672.48898 18 Q4 -1966.1242 258021.0 -1618.83496 19 Q1 1690.0376 262766.8 823.11823 19 Q2 -950.9576 266654.7 3001.25860 19 Q3 1227.0386 270506.1 -1090.14084 19 Q4 -1966.1242 274141.9 -695.76782 > m$win s t l 761 7 5 > m$deg s t l 0 1 1 > m$jump s t l 77 1 1 > m$inner [1] 2 > m$outer [1] 0 > postscript(file="/var/www/rcomp/tmp/19qru1291822336.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/www/rcomp/tmp/2jirw1291822336.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/www/rcomp/tmp/3jirw1291822336.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/www/rcomp/tmp/4ur8z1291822336.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/www/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/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/rcomp/tmp/58j681291822336.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/rcomp/tmp/6ujme1291822336.tab") > > try(system("convert tmp/19qru1291822336.ps tmp/19qru1291822336.png",intern=TRUE)) character(0) > try(system("convert tmp/2jirw1291822336.ps tmp/2jirw1291822336.png",intern=TRUE)) character(0) > try(system("convert tmp/3jirw1291822336.ps tmp/3jirw1291822336.png",intern=TRUE)) character(0) > try(system("convert tmp/4ur8z1291822336.ps tmp/4ur8z1291822336.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.150 0.750 1.897