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(26,26,27,28,27,29,27,30,27,30,32,30,32,33,34,32,34,37,37,36,34,38,41,41,44,42,45,45,49,54,52,53,51,55,60,60,63,60,64,65,75,70,72,69,75,74,74,75,79,79,85,78,84,85,85,82,91,90,98,98) > 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 0.3139498 25.56851 0.117538007 1 Q2 -0.1515325 26.21159 -0.060062489 1 Q3 0.9286323 26.82623 -0.754865716 1 Q4 -1.0910579 27.41218 1.678877754 2 Q1 0.3139498 27.81177 -1.125718435 2 Q2 -0.1515325 27.91772 1.233815509 2 Q3 0.9286323 28.27105 -2.199684206 2 Q4 -1.0910579 28.38664 2.704420193 3 Q1 0.3139498 29.08120 -2.395144827 3 Q2 -0.1515325 29.68687 0.464659348 3 Q3 0.9286323 30.46331 0.608055256 3 Q4 -1.0910579 31.35071 -0.259651473 4 Q1 0.3139498 31.98633 -0.300283828 4 Q2 -0.1515325 32.54304 0.608490191 4 Q3 0.9286323 33.01986 0.051507229 4 Q4 -1.0910579 33.65087 -0.559813463 5 Q1 0.3139498 34.59916 -0.913108854 5 Q2 -0.1515325 35.57378 1.577755369 5 Q3 0.9286323 36.13242 -0.061048558 5 Q4 -1.0910579 36.06878 1.022276235 6 Q1 0.3139498 36.58146 -2.895414427 6 Q2 -0.1515325 37.78693 0.364606941 6 Q3 0.9286323 39.81975 0.251614099 6 Q4 -1.0910579 41.59405 0.497003747 7 Q1 0.3139498 42.56058 1.125474608 7 Q2 -0.1515325 43.42529 -1.273759932 7 Q3 0.9286323 44.52013 -0.448764249 7 Q4 -1.0910579 46.65087 -0.559813678 8 Q1 0.3139498 49.19894 -0.512892699 8 Q2 -0.1515325 51.14802 3.003515108 8 Q3 0.9286323 52.35807 -1.286700400 8 Q4 -1.0910579 52.55601 1.535047161 9 Q1 0.3139498 53.58146 -2.895414164 9 Q2 -0.1515325 55.49980 -0.348270579 9 Q3 0.9286323 58.10688 0.964491570 9 Q4 -1.0910579 60.29389 0.797165450 10 Q1 0.3139498 61.30419 1.381860441 10 Q2 -0.1515325 62.23822 -2.086691425 10 Q3 0.9286323 64.22051 -1.149143674 10 Q4 -1.0910579 67.33248 -1.241417907 11 Q1 0.3139498 69.79607 4.889978336 11 Q2 -0.1515325 71.13763 -0.986097201 11 Q3 0.9286323 71.30752 -0.236157180 11 Q4 -1.0910579 71.93280 -1.841741816 12 Q1 0.3139498 72.84770 1.838354133 12 Q2 -0.1515325 73.79942 0.352108797 12 Q3 0.9286323 74.84584 -1.774471140 12 Q4 -1.0910579 76.09432 -0.003266547 13 Q1 0.3139498 78.11712 0.568927646 13 Q2 -0.1515325 79.98130 -0.829764560 13 Q3 0.9286323 80.95574 3.115627952 13 Q4 -1.0910579 82.15845 -3.067392186 14 Q1 0.3139498 82.96079 0.725259331 14 Q2 -0.1515325 83.68633 1.465204813 14 Q3 0.9286323 84.72024 -0.648875998 14 Q4 -1.0910579 86.20223 -3.111168733 15 Q1 0.3139498 88.57881 2.107240930 15 Q2 -0.1515325 92.23922 -2.087688477 15 Q3 0.9286323 95.80232 1.269050372 15 Q4 -1.0910579 99.40130 -0.310240567 > m$win s t l 601 7 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/freestat/rcomp/tmp/1mag51293369054.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/2mag51293369054.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/3f1x81293369054.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/48sxt1293369054.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/5mku11293369054.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/672bq1293369054.tab") > > try(system("convert tmp/1mag51293369054.ps tmp/1mag51293369054.png",intern=TRUE)) character(0) > try(system("convert tmp/2mag51293369054.ps tmp/2mag51293369054.png",intern=TRUE)) character(0) > try(system("convert tmp/3f1x81293369054.ps tmp/3f1x81293369054.png",intern=TRUE)) character(0) > try(system("convert tmp/48sxt1293369054.ps tmp/48sxt1293369054.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.417 0.860 1.574