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(7291,6820,8031,7862,7357,7213,7079,7012,7319,8148,7599,6908,7878,7407,7911,7323,7179,6758,6934,6696,7688,8296,7697,7907,7592,7710,9011,8225,7733,8062,7859,8221,8330,8868,9053,8811,8120,7953,8878,8601,8361,9116,9310,9891,10147,10317,10682,10276,10614,9413,11068,9772,10350,10541,10049,10714,10759,11684,11462,10485,11056,10184,11082,10554,11315,10847,11104,11026,11073,12073,12328,11172) > 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 -7.257678 7529.961 -231.703553 Feb 1 -570.637833 7513.974 -123.336153 Mar 1 458.981784 7497.987 74.031476 Apr 1 -195.968594 7484.838 573.131047 May 1 -250.585697 7471.688 135.897343 Jun 1 -252.319662 7463.532 1.787388 Jul 1 -328.054056 7455.376 -48.322139 Aug 1 -166.289313 7448.117 -269.827350 Sep 1 83.975208 7440.857 -205.832339 Oct 1 709.386448 7426.633 11.980460 Nov 1 562.298089 7412.409 -375.707144 Dec 1 -43.528436 7401.311 -449.782882 Jan 2 -7.257678 7390.214 495.044095 Feb 2 -570.637833 7387.073 590.565211 Mar 2 458.981784 7383.932 68.086555 Apr 2 -195.968594 7389.858 129.110186 May 2 -250.585697 7395.785 33.800544 Jun 2 -252.319662 7409.444 -399.123841 Jul 2 -328.054056 7423.102 -161.047798 Aug 2 -166.289313 7461.250 -598.960442 Sep 2 83.975208 7499.398 104.627135 Oct 2 709.386448 7578.514 8.099087 Nov 2 562.298089 7657.631 -522.929363 Dec 2 -43.528436 7754.972 195.556118 Jan 3 -7.257678 7852.313 -253.055686 Feb 3 -570.637833 7942.953 337.684632 Mar 3 458.981784 8033.593 518.425178 Apr 3 -195.968594 8108.002 312.966283 May 3 -250.585697 8182.412 -198.825886 Jun 3 -252.319662 8236.475 77.844678 Jul 3 -328.054056 8290.538 -103.484329 Aug 3 -166.289313 8318.791 68.498101 Sep 3 83.975208 8347.044 -101.019248 Oct 3 709.386448 8379.820 -221.206567 Nov 3 562.298089 8412.596 78.105713 Dec 3 -43.528436 8490.734 363.794298 Jan 4 -7.257678 8568.872 -441.614401 Feb 4 -570.637833 8691.150 -167.511912 Mar 4 458.981784 8813.427 -394.409196 Apr 4 -195.968594 8957.795 -160.826124 May 4 -250.585697 9102.162 -490.576327 Jun 4 -252.319662 9261.093 107.226621 Jul 4 -328.054056 9420.024 218.029998 Aug 4 -166.289313 9582.509 474.779872 Sep 4 83.975208 9744.995 318.029968 Oct 4 709.386448 9881.553 -273.939767 Nov 4 562.298089 10018.112 101.590096 Dec 4 -43.528436 10117.558 201.970481 Jan 5 -7.257678 10217.004 404.253583 Feb 5 -570.637833 10291.690 -308.051972 Mar 5 458.981784 10366.376 242.642702 Apr 5 -195.968594 10433.280 -465.311462 May 5 -250.585697 10500.185 100.401100 Jun 5 -252.319662 10553.608 239.711618 Jul 5 -328.054056 10607.031 -229.977436 Aug 5 -166.289313 10649.547 230.741961 Sep 5 83.975208 10692.063 -17.038421 Oct 5 709.386448 10736.930 237.683624 Nov 5 562.298089 10781.797 117.905266 Dec 5 -43.528436 10830.084 -301.555485 Jan 6 -7.257678 10878.371 184.886479 Feb 6 -570.637833 10923.601 -168.962782 Mar 6 458.981784 10968.830 -345.811814 Apr 6 -195.968594 11021.227 -271.257953 May 6 -250.585697 11073.623 491.962634 Jun 6 -252.319662 11127.545 -28.225245 Jul 6 -328.054056 11181.467 250.587305 Aug 6 -166.289313 11236.839 -44.549562 Sep 6 83.975208 11292.211 -303.186207 Oct 6 709.386448 11347.836 15.777413 Nov 6 562.298089 11403.461 362.240632 Dec 6 -43.528436 11459.182 -243.653644 > m$win s t l 721 19 13 > m$deg s t l 0 1 1 > m$jump s t l 73 2 2 > m$inner [1] 2 > m$outer [1] 0 > postscript(file="/var/www/html/rcomp/tmp/1ruv91259693983.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/2xru81259693983.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/35ekc1259693983.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/4urfg1259693983.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/5ozd61259693983.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/6vgl11259693983.tab") > > system("convert tmp/1ruv91259693983.ps tmp/1ruv91259693983.png") > system("convert tmp/2xru81259693983.ps tmp/2xru81259693983.png") > system("convert tmp/35ekc1259693983.ps tmp/35ekc1259693983.png") > system("convert tmp/4urfg1259693983.ps tmp/4urfg1259693983.png") > > > proc.time() user system elapsed 0.993 0.602 1.179