R version 2.6.1 (2007-11-26) Copyright (C) 2007 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(13328,12873,14000,13477,14237,13674,13529,14058,12975,14326,14008,16193,14483,14011,15057,14884,15414,14440,14900,15074,14442,15307,14938,17193,15528,14765,15838,15723,16150,15486,15986,15983,15692,16490,15686,18897,16316,15636,17163,16534,16518,16375,16290,16352,15943,16362,16393,19051,16747,16320,17910,16961,17480,17049,16879,17473,16998,17307,17418,20169,17871,17226,19062,17804,19100,18522,18060,18869,18127,18871,18890,21263,19547,18450,20254,19240,20216,19420,19415,20018,18652,19978,19509,21971) > par1 = '12' > #'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) > nx <- length(x) > x <- ts(x,frequency=par1) > m <- StructTS(x,type='BSM') > m$coef level slope seas epsilon 15111.73322 52.62117 56591.08950 0.00000 > m$fitted level slope sea Jan 1 13328.00 0.000000 0.00000 Feb 1 13200.68 3.825789 -327.68195 Mar 1 13460.24 22.003195 539.76082 Apr 1 13535.98 26.285106 -58.98042 May 1 13789.37 42.187168 447.63269 Jun 1 13834.09 42.330054 -160.08941 Jul 1 13756.22 36.776205 -227.22142 Aug 1 13824.13 38.052962 233.87369 Sep 1 13582.50 26.984106 -607.49878 Oct 1 13729.72 31.822590 596.27954 Nov 1 13869.97 36.349977 138.02576 Dec 1 14657.84 68.960045 1535.16350 Jan 2 14941.15 73.653081 -458.15481 Feb 2 14973.53 72.566100 -962.53375 Mar 2 14910.42 66.942435 146.57735 Apr 2 14966.96 66.396541 -82.95709 May 2 14983.56 63.559413 430.44363 Jun 2 14842.05 51.857643 -402.04709 Jul 2 14877.71 50.965892 22.28670 Aug 2 14855.42 47.104965 218.57844 Sep 2 14996.32 51.860535 -554.31577 Oct 2 15087.07 53.771601 219.93238 Nov 2 15228.06 57.940246 -290.05968 Dec 2 15465.38 66.299389 1727.62493 Jan 3 15699.54 74.018588 -171.54423 Feb 3 15769.06 73.806527 -1004.06334 Mar 3 15770.37 70.205950 67.63287 Apr 3 15767.92 66.407904 -44.91784 May 3 15725.66 60.536107 424.33715 Jun 3 15780.29 60.212499 -294.28620 Jul 3 15877.40 62.226208 108.60183 Aug 3 15928.75 61.639751 54.25312 Sep 3 16100.43 67.479736 -408.43172 Oct 3 16282.11 73.446724 207.89326 Nov 3 16325.34 71.887373 -639.33748 Dec 3 16661.11 85.409757 2235.88690 Jan 4 16723.02 84.205388 -407.02304 Feb 4 16713.72 79.375971 -1077.71723 Mar 4 16831.90 81.405388 331.10352 Apr 4 16796.14 75.196749 -262.13613 May 4 16595.82 60.451407 -77.81678 Jun 4 16599.73 57.410115 -224.73079 Jul 4 16513.59 49.684777 -223.58785 Aug 4 16484.45 45.456173 -132.45407 Sep 4 16491.11 43.384905 -548.10923 Oct 4 16429.60 37.815400 -67.59835 Nov 4 16668.13 48.425956 -275.13326 Dec 4 16787.42 52.162497 2263.58403 Jan 5 16927.73 56.811105 -180.73402 Feb 5 17113.09 63.604250 -793.09288 Mar 5 17270.64 68.586144 639.35818 Apr 5 17247.89 63.724633 -286.89245 May 5 17325.12 64.445436 154.88085 Jun 5 17312.09 60.302271 -263.08586 Jul 5 17242.37 53.347047 -363.36716 Aug 5 17351.52 56.330033 121.47900 Sep 5 17478.75 60.114324 -480.75277 Oct 5 17568.47 61.691899 -261.47411 Nov 5 17693.33 65.052478 -275.32698 Dec 5 17860.25 70.467949 2308.75056 Jan 6 18029.64 75.726145 -158.64055 Feb 6 18110.52 76.000459 -884.52451 Mar 6 18234.56 78.557540 827.44273 Apr 6 18242.18 74.777053 -438.17876 May 6 18466.95 82.777792 633.05427 Jun 6 18650.20 88.140360 -128.20153 Jul 6 18689.73 85.545467 -629.72878 Aug 6 18776.81 85.627321 92.19200 Sep 6 18804.71 82.548084 -677.71359 Oct 6 18981.11 87.551806 -110.10658 Nov 6 19161.42 92.495673 -271.42357 Dec 6 19208.51 90.076217 2054.49224 Jan 7 19420.19 96.554900 126.80665 Feb 7 19505.39 95.949572 -1055.38740 Mar 7 19548.93 93.156265 705.07349 Apr 7 19680.04 95.179910 -440.04009 May 7 19740.60 93.333498 475.40362 Jun 7 19722.66 87.398485 -302.65634 Jul 7 19854.74 89.781836 -439.73695 Aug 7 19957.24 90.460129 60.76428 Sep 7 19856.49 80.262607 -1204.48609 Oct 7 19952.94 81.125926 25.06110 Nov 7 19964.55 77.419511 -455.54675 Dec 7 20006.56 75.531890 1964.44180 > m$resid Jan Feb Mar Apr May Jun 1 0.00000000 -1.30937963 1.31765525 0.31197723 1.58162611 0.01923769 2 1.70324730 -0.33083647 -1.01555962 -0.07381375 -0.35362284 -1.49507756 3 1.26208555 -0.03377945 -0.53768902 -0.53104466 -0.79017734 -0.04322003 4 -0.17400525 -0.69206611 0.28620976 -0.86037098 -2.01850104 -0.41463775 5 0.64949998 0.94713157 0.69150670 -0.67131153 0.09914722 -0.56903782 6 0.72766651 0.03794424 0.35326463 -0.52145735 1.10218502 0.73835604 7 0.89409845 -0.08353314 -0.38533598 0.27902660 -0.25448421 -0.81784717 Jul Aug Sep Oct Nov Dec 1 -0.93705701 0.24382642 -2.18590324 0.93576693 0.84003525 5.79802749 2 -0.12063996 -0.55126673 0.70696024 0.29253887 0.65426179 1.34474029 3 0.27198342 -0.08061010 0.81632027 0.84579988 -0.22347260 1.95194819 4 -1.05576588 -0.58095166 -0.28612215 -0.77292538 1.47794698 0.52177296 5 -0.95581497 0.41058995 0.52175410 0.21780564 0.46449523 0.74916679 6 -0.35733757 0.01127754 -0.42445992 0.69001365 0.68197836 -0.33384407 7 0.32843973 0.09348737 -1.40571677 0.11902064 -0.51102528 -0.26027992 > mylevel <- as.numeric(m$fitted[,'level']) > myslope <- as.numeric(m$fitted[,'slope']) > myseas <- as.numeric(m$fitted[,'sea']) > myresid <- as.numeric(m$resid) > myfit <- mylevel+myseas > postscript(file="/var/www/html/rcomp/tmp/1jfhy1204976011.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > plot(as.numeric(m$resid),main='Standardized Residuals',ylab='Residuals',xlab='time') > grid() > dev.off() null device 1 > mylagmax <- nx/2 > postscript(file="/var/www/html/rcomp/tmp/21p4x1204976011.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(mylevel,na.action=na.pass,lag.max = mylagmax,main='Level') > acf(myseas,na.action=na.pass,lag.max = mylagmax,main='Seasonal') > acf(myresid,na.action=na.pass,lag.max = mylagmax,main='Standardized Residals') > par(op) > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/3wo361204976012.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(mylevel,main='Level') > spectrum(myseas,main='Seasonal') > spectrum(myresid,main='Standardized Residals') > par(op) > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/4se3t1204976012.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(mylevel,main='Level') > cpgram(myseas,main='Seasonal') > cpgram(myresid,main='Standardized Residals') > par(op) > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/56bnl1204976012.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > op <- par(mfrow = c(2,2)) > hist(m$resid,main='Residual Histogram') > plot(density(m$resid),main='Residual Kernel Density') > qqnorm(m$resid,main='Residual Normal QQ Plot') > qqline(m$resid) > plot(m$resid^2, myfit^2,main='Sq.Resid vs. Sq.Fit',xlab='Squared residuals',ylab='Squared Fit') > par(op) > dev.off() null device 1 > load(file='/var/www/html/rcomp/createtable') > a<-table.start() > a<-table.row.start(a) > a<-table.element(a,'Structural Time Series Model',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,'Level',header=TRUE) > a<-table.element(a,'Slope',header=TRUE) > a<-table.element(a,'Seasonal',header=TRUE) > a<-table.element(a,'Stand. Residuals',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,mylevel[i]) + a<-table.element(a,myslope[i]) + a<-table.element(a,myseas[i]) + a<-table.element(a,myresid[i]) + a<-table.row.end(a) + } > a<-table.end(a) > table.save(a,file="/var/www/html/rcomp/tmp/6h5t31204976012.tab") > > system("convert tmp/1jfhy1204976011.ps tmp/1jfhy1204976011.png") > system("convert tmp/21p4x1204976011.ps tmp/21p4x1204976011.png") > system("convert tmp/3wo361204976012.ps tmp/3wo361204976012.png") > system("convert tmp/4se3t1204976012.ps tmp/4se3t1204976012.png") > system("convert tmp/56bnl1204976012.ps tmp/56bnl1204976012.png") > > > proc.time() user system elapsed 2.039 0.811 2.299