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. 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(1686,1591,2304,1712,1471,1377,1966,2453,1984,2596,4087,5179,1530,1523,1633,1976,1170,1480,1781,2472,1981,2273,3857,4551,1510,1329,1518,1790,1537,1449,1954,1897,1706,2514,3593,4524,1609,1638,2030,1375,1320,1245,1600,2298,2191,2511,3440,4923,1609,1435,2061,1789,1567,1404,1597,3159,1759,2504,4273,5274,1771,1682,1846,1589,1896,1379,1645,2512,1771,3727,4388,5434,1606,1523,1577,1605,1765,1403,2584,3318,1562,2349,3987,5891,1389,1442,1548,1935,1518,1250,1847,1930,2638,3114,4405,7242,1853,1779,2108,2336,1728,1661,2230,1645,2421,3740,4988,6757,1757,1394,1982,1650,1654,1406,1971,1968,2608,3845,4514,6694,1720,1321,1859,1628,1615,1457,1899,1605,2424,3116,4286,6047,1902,2049,1874,1279,1432,1540,2214,1857,2408,3252,3627,6153,1577,1667,1993,1997,1783,1625,2076,1773,2377,3088,4096,6119,1494,1564,1898,2121,1831,1515,2048,2795,1749,3339,4227,6410,1197,1968,1720,1725,1674,1693,2031,1495,2968,3385,3729,5999,1070,1402,1897,1862,1670,1688,2031) > 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 [1] 0.6638282 0.6582114 0.7562881 0.7292401 0.6596045 0.6025505 0.8062317 [8] 0.9085332 0.8958007 1.2480711 1.6814779 2.3901626 > postscript(file="/var/www/html/freestat/rcomp/tmp/1rfc41243677862.ps",horizontal=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/www/html/freestat/rcomp/tmp/2i8op1243677862.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$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/www/html/freestat/rcomp/tmp/3yksk1243677862.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$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/www/html/freestat/rcomp/tmp/4eccf1243677862.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$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/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,'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/html/freestat/rcomp/tmp/5lt2x1243677862.tab") > > system("convert tmp/1rfc41243677862.ps tmp/1rfc41243677862.png") > system("convert tmp/2i8op1243677862.ps tmp/2i8op1243677862.png") > system("convert tmp/3yksk1243677862.ps tmp/3yksk1243677862.png") > system("convert tmp/4eccf1243677862.ps tmp/4eccf1243677862.png") > > > proc.time() user system elapsed 2.184 0.954 2.396