x <- c(39923931,35810356.5,35492936.3,38937434.1,40059102.8,37708710.2,41570965.7,36333563,34181220.1,42593543.9,43119727.6,38497690.9,45473273.4,38399780.4,38882302.6,44051120.6,41677559.9,40699203.5,44150027.6,38225518.7,35447405.7,43075518.3,42302792,39743541.7,44670641.2,37123384,37668266.4,46117528.8,42273156.4,39404153.2,45799994.5,38602505.2,39454830.1,47427901.4,46497980.9,45057149.4,50615569.2,43033396.2,46013056.5,54222266.3,46417306.4,51046271.8,51201279.6,43475288.7,44968981.1,53939345.4,54549319.7,54072107.3,58434230.1,51158751,50039368,57872617.4,51642978.8,54534465.9,56094697.8,48189983.1,47492381,52987449.1,55719803.5,53922860.5,54931231.9) par2 = '12' par1 = 'multiplicative' #'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!) par2 <- as.numeric(par2) x <- ts(x,freq=par2) m <- decompose(x,type=par1) m$figure postscript(file="/var/www/rcomp/tmp/1t0fx1322336006.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) plot(m) dev.off() mylagmax <- length(x)/2 postscript(file="/var/www/rcomp/tmp/24ubn1322336006.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() postscript(file="/var/www/rcomp/tmp/3ph1a1322336006.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() postscript(file="/var/www/rcomp/tmp/4pgy41322336006.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() #Note: the /var/www/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab load(file="/var/www/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,m$trend[i]+m$seasonal[i]) else a<-table.element(a,m$trend[i]*m$seasonal[i]) a<-table.element(a,m$trend[i]) a<-table.element(a,m$seasonal[i]) a<-table.element(a,m$random[i]) a<-table.row.end(a) } a<-table.end(a) table.save(a,file="/var/www/rcomp/tmp/5nnw11322336006.tab") try(system("convert tmp/1t0fx1322336006.ps tmp/1t0fx1322336006.png",intern=TRUE)) try(system("convert tmp/24ubn1322336006.ps tmp/24ubn1322336006.png",intern=TRUE)) try(system("convert tmp/3ph1a1322336006.ps tmp/3ph1a1322336006.png",intern=TRUE)) try(system("convert tmp/4pgy41322336006.ps tmp/4pgy41322336006.png",intern=TRUE))