R version 2.8.0 (2008-10-20) Copyright (C) 2008 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. Natural language support but running in an English locale 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(989236,1008380,1207763,1368839,1469798,1498721,1761769,1653214,1599104,1421179,1163995,1037735,1015407,1039210,1258049,1469445,1552346,1549144,1785895,1662335,1629440,1467430,1202209,1076982,1039367,1063449,1335135,1491602,1591972,1641248,1898849,1798580,1762444,1622044,1368955,1262973,1195650,1269530,1479279,1607819,1712466,1721766,1949843,1821326,1757802,1590367,1260647,1149235,1016367,1027885,1262159,1520854,1544144,1564709,1821776,1741365,1623386,1498658,1241822,1136029) > 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 -379171.70 1338624 29784.12363 Feb 1 -350271.44 1340638 18013.68734 Mar 1 -125070.37 1342652 -9818.55158 Apr 1 56142.81 1344913 -32216.73258 May 1 136554.64 1347174 -13930.55626 Jun 1 156508.48 1349564 -7351.21568 Jul 1 403998.71 1351954 5816.73352 Aug 1 295352.71 1354714 3147.42821 Sep 1 234040.33 1357474 7589.49021 Oct 1 78443.98 1362469 -19733.92541 Nov 1 -195062.78 1367464 -8405.93213 Dec 1 -311465.33 1372173 -22973.05505 Jan 2 -379171.70 1376883 17695.63552 Feb 2 -350271.44 1380038 9443.16043 Mar 2 -125070.37 1383193 -74.11730 Apr 2 56142.81 1385853 27449.51519 May 2 136554.64 1388512 27279.50500 Jun 2 156508.48 1390736 1899.24055 Jul 2 403998.71 1392961 -11064.41528 Aug 2 295352.71 1395331 -28348.26034 Sep 2 234040.33 1397700 -2300.73809 Oct 2 78443.98 1401751 -12764.53284 Nov 2 -195062.78 1405801 -8528.91869 Dec 2 -311465.33 1413025 -24578.04287 Jan 3 -379171.70 1420250 -1711.35356 Feb 3 -350271.44 1430858 -17137.74616 Mar 3 -125070.37 1441466 18739.05860 Apr 3 56142.81 1454395 -18935.40528 May 3 136554.64 1467323 -11905.51184 Jun 3 156508.48 1481699 3040.61802 Jul 3 403998.71 1496075 -1224.64352 Aug 3 295352.71 1510348 -7120.93481 Sep 3 234040.33 1524622 3782.14120 Oct 3 78443.98 1536242 7357.55527 Nov 3 -195062.78 1547863 16154.37825 Dec 3 -311465.33 1555117 19321.20546 Jan 4 -379171.70 1562371 12450.84617 Feb 4 -350271.44 1564205 55596.91089 Mar 4 -125070.37 1566038 38311.17297 Apr 4 56142.81 1561694 -10018.16063 May 4 136554.64 1557350 18560.86309 Jun 4 156508.48 1546085 19172.35449 Jul 4 403998.71 1534820 11024.45450 Aug 4 295352.71 1519030 6942.97008 Sep 4 234040.33 1503241 20520.85295 Oct 4 78443.98 1488173 23750.41899 Nov 4 -195062.78 1473104 -17394.60606 Dec 4 -311465.33 1460665 35.40734 Jan 5 -379171.70 1448225 -52686.76576 Feb 5 -350271.44 1438804 -60647.72596 Mar 5 -125070.37 1429383 -42153.48878 Apr 5 56142.81 1427207 37503.71486 May 5 136554.64 1425032 -17442.72418 Jun 5 156508.48 1424035 -15834.77259 Jul 5 403998.71 1423039 -5261.21239 Aug 5 295352.71 1422697 23315.01842 Sep 5 234040.33 1422356 -33010.38347 Oct 5 78443.98 1422551 -2336.98522 Nov 5 -195062.78 1422746 14138.82193 Dec 5 -311465.33 1423326 24168.44819 > 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/freestat/rcomp/tmp/1tzre1292604483.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/html/freestat/rcomp/tmp/2tzre1292604483.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/html/freestat/rcomp/tmp/348qz1292604483.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/html/freestat/rcomp/tmp/4eipj1292604483.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/html/freestat/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/html/freestat/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/freestat/rcomp/tmp/5trns1292604483.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/freestat/rcomp/tmp/6waly1292604483.tab") > > try(system("convert tmp/1tzre1292604483.ps tmp/1tzre1292604483.png",intern=TRUE)) character(0) > try(system("convert tmp/2tzre1292604483.ps tmp/2tzre1292604483.png",intern=TRUE)) character(0) > try(system("convert tmp/348qz1292604483.ps tmp/348qz1292604483.png",intern=TRUE)) character(0) > try(system("convert tmp/4eipj1292604483.ps tmp/4eipj1292604483.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.451 0.893 1.776