R version 3.3.1 (2016-06-21) -- "Bug in Your Hair" Copyright (C) 2016 The R Foundation for Statistical Computing Platform: x86_64-pc-linux-gnu (64-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(181896.00 + ,181580.00 + ,181234.00 + ,180598.00 + ,187123.00 + ,186807.00 + ,181896.00 + ,178638.00 + ,178954.00 + ,178954.00 + ,179269.00 + ,179936.00 + ,181580.00 + ,179616.00 + ,181580.00 + ,179936.00 + ,185158.00 + ,187469.00 + ,177656.00 + ,175025.00 + ,177305.00 + ,176989.00 + ,175025.00 + ,175345.00 + ,179269.00 + ,178638.00 + ,179269.00 + ,179269.00 + ,183545.00 + ,184176.00 + ,172398.00 + ,172398.00 + ,176989.00 + ,174709.00 + ,170785.00 + ,172398.00 + ,176327.00 + ,174363.00 + ,174047.00 + ,169803.00 + ,176007.00 + ,177305.00 + ,164545.00 + ,164229.00 + ,170785.00 + ,167176.00 + ,160967.00 + ,163598.00 + ,166509.00 + ,167176.00 + ,165212.00 + ,161287.00 + ,169456.00 + ,169456.00 + ,155078.00 + ,154101.00 + ,158025.00 + ,150838.00 + ,143616.00 + ,145932.00 + ,150838.00 + ,146910.00 + ,144283.00 + ,138710.00 + ,146247.00 + ,146563.00 + ,132190.00 + ,131839.00 + ,134470.00 + ,126301.00 + ,117465.00 + ,121043.00 + ,125950.00 + ,120728.00 + ,120412.00 + ,115154.00 + ,123670.00 + ,125319.00 + ,109266.00 + ,105688.00 + ,107968.00 + ,99132.00 + ,89981.00 + ,92928.00 + ,98470.00 + ,91946.00 + ,92928.00 + ,89004.00 + ,97172.00 + ,98150.00 + ,78524.00 + ,77221.00 + ,80799.00 + ,71333.00 + ,62817.00 + ,65764.00 + ,72950.00 + ,64462.00 + ,63799.00 + ,57244.00 + ,64462.00 + ,66742.00 + ,46448.00 + ,46448.00 + ,49391.00 + ,41542.00 + ,32706.00 + ,37297.00 + ,45466.00 + ,36631.00 + ,40244.00 + ,35333.00 + ,43186.00 + ,45813.00 + ,24853.00 + ,23240.00 + ,26502.00 + ,18649.00 + ,12444.00 + ,15040.00) > par2 = '12' > par1 = 'additive' > par2 <- '12' > par1 <- 'additive' > #'GNU S' R Code compiled by R2WASP v. 1.2.327 () > #Author: root > #To cite this work: Wessa P., (2013), Classical Decomposition (v1.0.4) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_decompose.wasp/ > #Source of accompanying publication: Office for Research, Development, and Education > # > par2 <- as.numeric(par2) > x <- ts(x,freq=par2) > m <- decompose(x,type=par1) > m$figure [1] 2386.8156 -265.4761 1304.6443 -1251.1844 7281.4174 10160.4961 [7] -3309.1798 -3385.8326 1171.1813 -2804.8974 -7504.1103 -3783.8742 > postscript(file="/var/wessaorg/rcomp/tmp/1qvun1469277564.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > plot(m) > dev.off() null device 1 > mylagmax <- length(x)/2 > postscript(file="/var/wessaorg/rcomp/tmp/2aiyi1469277564.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$trend),na.action=na.pass,lag.max = mylagmax,main='Trend') > acf(as.numeric(m$seasonal),na.action=na.pass,lag.max = mylagmax,main='Seasonal') > acf(as.numeric(m$random),na.action=na.pass,lag.max = mylagmax,main='Random') > par(op) > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/3sodi1469277564.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$trend[!is.na(m$trend)]),main='Trend') > spectrum(as.numeric(m$seasonal[!is.na(m$seasonal)]),main='Seasonal') > spectrum(as.numeric(m$random[!is.na(m$random)]),main='Random') > par(op) > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/4b5n41469277564.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$trend[!is.na(m$trend)]),main='Trend') > cpgram(as.numeric(m$seasonal[!is.na(m$seasonal)]),main='Seasonal') > cpgram(as.numeric(m$random[!is.na(m$random)]),main='Random') > 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,'Classical Decomposition by Moving Averages',6,TRUE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'t',header=TRUE) > a<-table.element(a,'Observations',header=TRUE) > a<-table.element(a,'Fit',header=TRUE) > a<-table.element(a,'Trend',header=TRUE) > a<-table.element(a,'Seasonal',header=TRUE) > a<-table.element(a,'Random',header=TRUE) > a<-table.row.end(a) > for (i in 1:length(m$trend)) { + a<-table.row.start(a) + a<-table.element(a,i,header=TRUE) + a<-table.element(a,x[i]) + if (par1 == 'additive') a<-table.element(a,signif(m$trend[i]+m$seasonal[i],6)) else a<-table.element(a,signif(m$trend[i]*m$seasonal[i],6)) + a<-table.element(a,signif(m$trend[i],6)) + a<-table.element(a,signif(m$seasonal[i],6)) + a<-table.element(a,signif(m$random[i],6)) + a<-table.row.end(a) + } > a<-table.end(a) > table.save(a,file="/var/wessaorg/rcomp/tmp/5wfel1469277564.tab") > > try(system("convert tmp/1qvun1469277564.ps tmp/1qvun1469277564.png",intern=TRUE)) character(0) > try(system("convert tmp/2aiyi1469277564.ps tmp/2aiyi1469277564.png",intern=TRUE)) character(0) > try(system("convert tmp/3sodi1469277564.ps tmp/3sodi1469277564.png",intern=TRUE)) character(0) > try(system("convert tmp/4b5n41469277564.ps tmp/4b5n41469277564.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.972 0.122 2.117