R version 3.0.2 (2013-09-25) -- "Frisbee Sailing" Copyright (C) 2013 The R Foundation for Statistical Computing 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(112,118,132,129,121,135,148,148,136,119,104,118,115,126,141,135,125,149,170,170,158,133,114,140,145,150,178,163,172,178,199,199,184,162,146,166,171,180,193,181,183,218,230,242,209,191,172,194,196,196,236,235,229,243,264,272,237,211,180,201,204,188,235,227,234,264,302,293,259,229,203,229,242,233,267,269,270,315,364,347,312,274,237,278,284,277,317,313,318,374,413,405,355,306,271,306,315,301,356,348,355,422,465,467,404,347,305,336,340,318,362,348,363,435,491,505,404,359,310,337,360,342,406,396,420,472,548,559,463,407,362,405,417,391,419,461,472,535,622,606,508,461,390,432) > par8 = 'FALSE' > par7 = '1' > par6 = '' > par5 = '1' > par4 = '' > par3 = '0' > par2 = 'periodic' > par1 = '6' > main = 'Seasonal Decomposition by Loess' > par8 <- 'FALSE' > par7 <- '1' > par6 <- '' > par5 <- '1' > par4 <- '' > par3 <- '0' > par2 <- 'periodic' > par1 <- '6' > #'GNU S' R Code compiled by R2WASP v. 1.2.327 () > #Author: root > #To cite this work: Wessa P., (2013), Decomposition by Loess (v1.0.2) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_decomposeloess.wasp/ > #Source of accompanying publication: Office for Research, Development, and Education > # > 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 Time Series: Start = c(1, 1) End = c(24, 6) Frequency = 6 seasonal trend remainder 1.000000 21.634496 104.3692 -14.0036790 1.166667 16.074666 111.2397 -9.3143376 1.333333 7.264947 118.1102 6.6248941 1.500000 -14.586197 123.9893 19.5968635 1.666667 -31.478950 129.8685 22.6104414 1.833333 1.091013 132.3318 1.5771914 2.000000 21.634496 134.7951 -8.4295785 2.166667 16.074666 132.3594 -0.4340336 2.333333 7.264947 129.9237 -1.1885983 2.500000 -14.586197 126.1948 7.3914412 2.666667 -31.478950 122.4659 13.0130891 2.833333 1.091013 122.1423 -5.2333431 3.000000 21.634496 121.8188 -28.4532951 3.166667 16.074666 125.9114 -15.9860695 3.333333 7.264947 130.0040 3.7310465 3.500000 -14.586197 137.0168 12.5694021 3.666667 -31.478950 144.0296 12.4493662 3.833333 1.091013 147.2129 0.6960843 4.000000 21.634496 150.3962 -2.0307175 4.166667 16.074666 149.2020 4.7232913 4.333333 7.264947 148.0079 2.7271905 4.500000 -14.586197 145.3263 2.2599398 4.666667 -31.478950 142.6447 2.8342975 4.833333 1.091013 144.4716 -5.5625830 5.000000 21.634496 146.2985 -22.9329833 5.166667 16.074666 153.7000 -19.7746946 5.333333 7.264947 161.1016 9.6334844 5.500000 -14.586197 168.8745 8.7117225 5.666667 -31.478950 176.6474 26.8315691 5.833333 1.091013 179.1531 -2.2440680 6.000000 21.634496 181.6587 -4.2932250 6.166667 16.074666 179.3124 3.6129733 6.333333 7.264947 176.9660 -0.2309381 6.500000 -14.586197 173.7876 2.7985991 6.666667 -31.478950 170.6092 6.8697447 6.833333 1.091013 171.0783 -6.1692935 7.000000 21.634496 171.5474 -22.1818516 7.166667 16.074666 177.6677 -13.7424081 7.333333 7.264947 183.7881 1.9469258 7.500000 -14.586197 192.8671 2.7190884 7.666667 -31.478950 201.9461 12.5328595 7.833333 1.091013 206.3964 10.5126193 8.000000 21.634496 210.8466 -2.4811408 8.166667 16.074666 209.3659 16.5594776 8.333333 7.264947 207.8851 -6.1500137 8.500000 -14.586197 203.0393 2.5469194 8.666667 -31.478950 198.1935 5.2854608 8.833333 1.091013 199.7947 -6.8856836 9.000000 21.634496 201.3959 -27.0303478 9.166667 16.074666 210.0458 -30.1205097 9.333333 7.264947 218.6958 10.0392188 9.500000 -14.586197 228.8562 20.7300272 9.666667 -31.478950 239.0165 21.4624440 9.833333 1.091013 241.3395 0.5694880 10.000000 21.634496 243.6625 -1.2969878 10.166667 16.074666 237.2572 18.6681458 10.333333 7.264947 230.8519 -1.1168303 10.500000 -14.586197 221.2872 4.2989938 10.666667 -31.478950 211.7225 -0.2435737 10.833333 1.091013 208.4924 -8.5834463 11.000000 21.634496 205.2623 -22.8968388 11.166667 16.074666 213.0916 -41.1662833 11.333333 7.264947 220.9209 6.8141625 11.500000 -14.586197 234.9597 6.6264810 11.666667 -31.478950 248.9985 16.4804079 11.833333 1.091013 255.7037 7.2052596 12.000000 21.634496 262.4089 17.9565915 12.166667 16.074666 258.6110 18.3143327 12.333333 7.264947 254.8131 -3.0780357 12.500000 -14.586197 246.8328 -3.2466275 12.666667 -31.478950 238.8526 -4.3736109 12.833333 1.091013 238.4704 -10.5613975 13.000000 21.634496 238.0882 -17.7227039 13.166667 16.074666 248.9874 -32.0620280 13.333333 7.264947 259.8865 -0.1514617 13.500000 -14.586197 277.0861 6.5001198 13.666667 -31.478950 294.2856 7.1933098 13.833333 1.091013 303.1438 10.7651426 14.000000 21.634496 312.0020 30.3634555 14.166667 16.074666 308.0782 22.8471172 14.333333 7.264947 304.1544 0.5806692 14.500000 -14.586197 294.2986 -5.7123991 14.666667 -31.478950 284.4428 -15.9638589 14.833333 1.091013 283.4032 -6.4941638 15.000000 21.634496 282.3635 -19.9979886 15.166667 16.074666 294.5672 -33.6418723 15.333333 7.264947 306.7709 2.9641344 15.500000 -14.586197 325.4703 2.1158659 15.666667 -31.478950 344.1697 5.3092059 15.833333 1.091013 352.6359 20.2730905 16.000000 21.634496 361.1020 30.2634552 16.166667 16.074666 354.2244 34.7009736 16.333333 7.264947 347.3467 0.3883824 16.500000 -14.586197 333.4287 -12.8424651 16.666667 -31.478950 319.5107 -17.0317043 16.833333 1.091013 316.7618 -11.8528321 17.000000 21.634496 314.0130 -20.6474798 17.166667 16.074666 327.5786 -42.6532986 17.333333 7.264947 341.1443 7.5907729 17.500000 -14.586197 363.6797 -1.0935245 17.666667 -31.478950 386.2152 0.2637865 17.833333 1.091013 397.4129 23.4960616 18.000000 21.634496 408.6107 34.7548167 18.166667 16.074666 400.8565 50.0688713 18.333333 7.264947 393.1022 3.6328163 18.500000 -14.586197 374.3419 -12.7556707 18.666667 -31.478950 355.5815 -19.1025492 18.833333 1.091013 346.0316 -11.1226429 19.000000 21.634496 336.4818 -18.1162564 19.166667 16.074666 345.4942 -43.5688934 19.333333 7.264947 354.5067 0.2283601 19.500000 -14.586197 376.9549 -14.3687317 19.666667 -31.478950 399.4032 -4.9242151 19.833333 1.091013 411.7295 22.1794395 20.000000 21.634496 424.0559 45.3095741 20.166667 16.074666 415.8546 73.0707255 20.333333 7.264947 407.6533 -10.9182328 20.500000 -14.586197 387.8454 -14.2591832 20.666667 -31.478950 368.0375 -26.5585251 20.833333 1.091013 362.6354 -26.7264360 21.000000 21.634496 357.2334 -18.8678667 21.166667 16.074666 373.3996 -47.4742703 21.333333 7.264947 389.5658 9.1692166 21.500000 -14.586197 417.7686 -7.1824500 21.666667 -31.478950 445.9715 5.5074919 21.833333 1.091013 460.7861 10.1228955 22.000000 21.634496 475.6007 50.7647793 22.166667 16.074666 468.5592 74.3661771 22.333333 7.264947 461.5176 -5.7825347 22.500000 -14.586197 442.2564 -20.6702156 22.666667 -31.478950 422.9952 -29.5162881 22.833333 1.091013 415.3248 -11.4158397 23.000000 21.634496 407.6544 -12.2889112 23.166667 16.074666 423.7835 -48.8581565 23.333333 7.264947 439.9126 -28.1775114 23.500000 -14.586197 469.4085 6.1777029 23.666667 -31.478950 498.9044 4.5745256 23.833333 1.091013 515.1549 18.7540824 24.000000 21.634496 531.4054 68.9601193 24.166667 16.074666 515.0193 74.9060738 24.333333 7.264947 498.6331 2.1019188 24.500000 -14.586197 479.0972 -3.5110489 24.666667 -31.478950 459.5614 -38.0824082 24.833333 1.091013 436.6314 -5.7223640 > m$win s t l 1441 11 7 > m$deg s t l 0 1 1 > m$jump s t l 145 2 1 > m$inner [1] 2 > m$outer [1] 0 > postscript(file="/var/wessaorg/rcomp/tmp/1ie3o1385138141.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/2ls0a1385138141.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/3tzwu1385138141.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/4vrh61385138141.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/5x6291385138141.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/6tngd1385138141.tab") > > try(system("convert tmp/1ie3o1385138141.ps tmp/1ie3o1385138141.png",intern=TRUE)) character(0) > try(system("convert tmp/2ls0a1385138141.ps tmp/2ls0a1385138141.png",intern=TRUE)) character(0) > try(system("convert tmp/3tzwu1385138141.ps tmp/3tzwu1385138141.png",intern=TRUE)) character(0) > try(system("convert tmp/4vrh61385138141.ps tmp/4vrh61385138141.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.863 0.468 3.314