R version 2.9.0 (2009-04-17) Copyright (C) 2009 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(11974 + ,10106 + ,12069 + ,11412 + ,11180 + ,10508 + ,11288 + ,10928 + ,10199 + ,11030 + ,11234 + ,13747 + ,13912 + ,12376 + ,12264 + ,11675 + ,11271 + ,10672 + ,10933 + ,10379 + ,10187 + ,10747 + ,10970 + ,12175 + ,14200 + ,11676 + ,11258 + ,10872 + ,11148 + ,10690 + ,10684 + ,11658 + ,10178 + ,10981 + ,10773 + ,11665 + ,11359 + ,10716 + ,12928 + ,12317 + ,11641 + ,10459 + ,10953 + ,10703 + ,10703 + ,11101 + ,11334 + ,13268 + ,13145 + ,12334 + ,13153 + ,11289 + ,11374 + ,10914 + ,11299 + ,11284 + ,10694 + ,11077 + ,11104 + ,12820 + ,14915 + ,11773 + ,11608 + ,11468 + ,11511 + ,11200 + ,11164 + ,10960 + ,10667 + ,11556 + ,11372 + ,12333 + ,13102 + ,11115 + ,12572 + ,11557 + ,12059 + ,11420 + ,11185 + ,11113 + ,10706 + ,11523 + ,11391 + ,12634 + ,13469 + ,11735 + ,13281 + ,11968 + ,11623 + ,11084 + ,11509 + ,11134 + ,10438 + ,11530 + ,11491 + ,13093 + ,13106 + ,11305 + ,13113 + ,12203 + ,11309 + ,11088 + ,11234 + ,11619 + ,10942 + ,11445 + ,11291 + ,13281 + ,13726 + ,11300 + ,11983 + ,11092 + ,11093 + ,10692 + ,10786 + ,11166 + ,10553 + ,11103 + ,10969 + ,12090 + ,12544 + ,12264 + ,13783 + ,11214 + ,11453 + ,10883 + ,10381 + ,10348 + ,10024 + ,10805 + ,10796 + ,11907 + ,12261 + ,11377 + ,12689 + ,11474 + ,10992 + ,10764 + ,12164 + ,10409 + ,10398 + ,10349 + ,10865 + ,11630 + ,12221 + ,10884 + ,12019 + ,11021 + ,10799 + ,10423 + ,10484 + ,10450 + ,9906 + ,11049 + ,11281 + ,12485 + ,12849 + ,11380 + ,12079 + ,11366 + ,11328 + ,10444 + ,10854 + ,10434 + ,10137 + ,10992 + ,10906 + ,12367 + ,14371 + ,11695 + ,11546 + ,10922 + ,10670 + ,10254 + ,10573 + ,10239 + ,10253 + ,11176 + ,10719 + ,11817) > 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 308009.76790 81.47558 8846.23808 33743.00824 > m$fitted level slope sea Jan 1 11974.00 0.0000000 0.000000 Feb 1 10288.68 -94.3309154 -119.814782 Mar 1 11851.24 -68.4662289 66.316746 Apr 1 11558.86 -69.9669646 -125.826144 May 1 11280.21 -71.2907855 -80.606305 Jun 1 10666.25 -74.9050374 -107.293486 Jul 1 11239.38 -70.4302669 -12.211488 Aug 1 11037.18 -71.3686967 -96.815223 Sep 1 10368.43 -75.7493238 -113.384754 Oct 1 10974.82 -70.6052905 -8.801865 Nov 1 11261.61 -67.8369254 -61.121835 Dec 1 13444.95 -49.9453848 91.007818 Jan 2 13322.18 -46.8561869 596.687433 Feb 2 12686.08 -62.1294119 -268.671765 Mar 2 12249.93 -67.2452602 46.812136 Apr 2 11850.08 -69.6771219 -145.152237 May 2 11382.16 -72.3098862 -75.308326 Jun 2 10894.68 -75.1867253 -185.317654 Jul 2 10910.06 -74.5335781 14.792318 Aug 2 10504.33 -76.9954777 -95.541644 Sep 2 10337.47 -77.6825231 -142.395442 Oct 2 10664.07 -74.4870596 46.593349 Nov 2 11091.21 -70.3714152 -166.296305 Dec 2 11922.02 -64.4663645 171.999829 Jan 3 12983.06 -78.2471456 1114.475506 Feb 3 12109.58 -92.7487918 -371.114624 Mar 3 11356.71 -102.2433966 -42.384362 Apr 3 11043.37 -104.2785587 -152.857246 May 3 11155.90 -102.4227206 -26.942724 Jun 3 10957.15 -103.2633625 -258.694616 Jul 3 10702.37 -104.6275040 -5.069899 Aug 3 11538.34 -95.9573564 37.136383 Sep 3 10616.79 -103.7395232 -366.370017 Oct 3 10884.09 -100.1426387 64.364523 Nov 3 11018.27 -97.8554328 -265.815700 Dec 3 11499.03 -93.4993197 115.252958 Jan 4 10401.59 -92.5175218 1046.654055 Feb 4 10851.78 -84.0643210 -180.139132 Mar 4 12506.97 -57.9047660 274.336309 Apr 4 12518.85 -57.0849989 -207.885604 May 4 11802.08 -64.0334948 -103.936718 Jun 4 10862.77 -73.2314692 -327.972198 Jul 4 10963.87 -71.3605817 -25.960363 Aug 4 10601.45 -74.5442181 126.743593 Sep 4 10959.99 -69.7181791 -294.466440 Oct 4 11021.02 -68.2339961 68.665247 Nov 4 11513.37 -61.9866169 -227.870534 Dec 4 12731.34 -50.3672451 425.985413 Jan 5 12390.52 -51.8672150 779.897491 Feb 5 12696.76 -46.5783399 -392.541458 Mar 5 12861.42 -43.3084066 273.844642 Apr 5 11708.57 -58.0949050 -324.523393 May 5 11388.81 -61.2834325 7.675568 Jun 5 11257.18 -62.1284387 -337.140592 Jul 5 11254.01 -61.4114352 39.922445 Aug 5 11199.26 -61.3292404 84.169657 Sep 5 11019.05 -62.8191721 -314.846625 Oct 5 11049.55 -61.6390261 19.441017 Nov 5 11398.48 -56.5992966 -329.714588 Dec 5 12163.39 -47.8586042 586.128525 Jan 6 13756.59 -33.2270592 1016.329540 Feb 6 12537.81 -50.6549956 -665.417262 Mar 6 11436.97 -67.2024816 259.130977 Apr 6 11660.64 -63.0092940 -217.418654 May 6 11529.59 -63.9242781 -12.777914 Jun 6 11540.69 -62.9342127 -347.105488 Jul 6 11210.25 -66.4847514 -23.381355 Aug 6 10916.50 -69.5361930 62.921417 Sep 6 10958.34 -68.0242376 -300.856290 Oct 6 11456.48 -60.3229417 51.140439 Nov 6 11767.51 -55.4285447 -427.228530 Dec 6 11923.89 -52.8894141 391.024871 Jan 7 11884.57 -52.7358552 1216.260728 Feb 7 11669.39 -55.1558582 -540.714865 Mar 7 12200.41 -45.8193766 322.407221 Apr 7 11862.13 -50.2435666 -280.303127 May 7 12020.85 -47.2427003 20.347176 Jun 7 11778.58 -49.9896977 -341.965572 Jul 7 11278.38 -56.3396909 -55.027693 Aug 7 11080.69 -58.3497082 44.354851 Sep 7 11063.08 -57.7661741 -360.546068 Oct 7 11413.83 -51.9281727 74.378516 Nov 7 11755.92 -46.4549804 -398.463278 Dec 7 12143.90 -40.7797276 453.102608 Jan 8 12223.74 -39.2268607 1234.935942 Feb 8 12333.09 -36.9753535 -610.613587 Mar 8 12801.70 -28.8700561 436.847361 Apr 8 12399.18 -34.6896059 -399.527600 May 8 11733.78 -44.1459298 -57.169091 Jun 8 11410.43 -48.2585931 -302.694906 Jul 8 11487.43 -46.4160144 10.923504 Aug 8 11161.09 -50.5551316 -3.291151 Sep 8 10898.70 -53.7007752 -442.693289 Oct 8 11365.31 -46.0093213 120.471361 Nov 8 11828.42 -38.6585425 -380.659102 Dec 8 12490.39 -28.9321992 543.063412 Jan 9 12042.06 -34.7645021 1099.708379 Feb 9 11993.00 -34.9844600 -686.797376 Mar 9 12484.54 -26.5115803 584.205261 Apr 9 12511.69 -25.6612575 -313.232500 May 9 11574.67 -39.7123419 -188.324042 Jun 9 11411.24 -41.5909948 -312.736755 Jul 9 11204.22 -44.0960865 43.825837 Aug 9 11489.28 -39.0977779 101.782707 Sep 9 11461.09 -38.9318676 -520.012187 Oct 9 11409.44 -39.1242281 36.634770 Nov 9 11685.29 -34.4455810 -421.004060 Dec 9 12469.75 -22.5808415 741.745992 Jan 10 12613.91 -20.1472477 1097.899375 Feb 10 12188.37 -26.4652556 -854.134604 Mar 10 11553.34 -36.2784200 480.851081 Apr 10 11312.83 -39.5467831 -203.568167 May 10 11256.37 -39.8122596 -161.934230 Jun 10 11029.11 -42.7176438 -321.212041 Jul 10 10823.50 -45.2334939 -23.695101 Aug 10 10997.32 -41.8466155 150.114297 Sep 10 11052.04 -40.3527938 -507.231422 Oct 10 11105.59 -38.9081977 -10.550266 Nov 10 11426.92 -33.4448582 -488.434687 Dec 10 11384.11 -33.5847441 706.687578 Jan 11 11373.58 -33.2375812 1168.463922 Feb 11 12677.86 -12.1976846 -526.826011 Mar 11 13177.64 -3.9340598 562.264487 Apr 11 11800.51 -26.0292334 -470.515630 May 11 11604.36 -28.7292689 -136.956749 Jun 11 11257.49 -33.7281334 -347.535404 Jul 11 10588.34 -43.6757009 -153.514408 Aug 11 10260.00 -48.1316213 112.108610 Sep 11 10460.71 -44.2389877 -457.791036 Oct 11 10766.02 -38.7983729 9.380942 Nov 11 11167.36 -32.0210556 -408.612778 Dec 11 11215.28 -30.8021527 684.951616 Jan 12 11282.15 -29.3007333 970.560178 Feb 12 11822.05 -20.2864806 -493.127777 Mar 12 11918.04 -18.4092412 761.171796 Apr 12 11923.32 -18.0270096 -451.319207 May 12 11253.24 -28.4474522 -206.052506 Jun 12 11044.92 -31.2992696 -265.684118 Jul 12 12002.67 -15.6739783 77.598973 Aug 12 10695.95 -36.0527827 -177.654710 Sep 12 10832.48 -33.3319731 -449.088874 Oct 12 10483.25 -38.2900510 -107.525140 Nov 12 11098.19 -28.1189747 -288.448418 Dec 12 10997.96 -29.2351724 638.151511 Jan 13 11258.90 -24.7128468 937.499775 Feb 13 11369.13 -22.5657025 -496.525038 Mar 13 11278.26 -23.6682952 746.494523 Apr 13 11353.67 -22.0679294 -341.037335 May 13 11070.65 -26.2552807 -249.571293 Jun 13 10860.74 -29.1838898 -422.198171 Jul 13 10343.20 -36.9464206 182.130090 Aug 13 10562.72 -32.8749973 -134.421369 Sep 13 10361.66 -35.5407464 -441.433656 Oct 13 11050.80 -24.0978228 -63.079550 Nov 13 11462.70 -17.2536088 -218.565622 Dec 13 11808.03 -11.5824940 646.280563 Jan 14 11913.82 -9.7360889 925.234041 Feb 14 11884.07 -10.0555894 -502.383773 Mar 14 11459.54 -16.7442959 654.394343 Apr 14 11614.23 -13.9745702 -262.703450 May 14 11556.38 -14.6801978 -224.673820 Jun 14 10949.53 -24.1583094 -455.433248 Jul 14 10736.43 -27.1738543 133.554138 Aug 14 10577.00 -29.2815102 -131.816815 Sep 14 10653.92 -27.5918236 -525.902172 Oct 14 11019.49 -21.3563162 -60.719952 Nov 14 11148.73 -18.9780079 -255.464044 Dec 14 11614.20 -11.3439973 711.811887 Jan 15 13060.82 11.7380543 1186.747229 Feb 15 12366.50 0.4406747 -611.864841 Mar 15 11217.09 -18.1068430 425.842492 Apr 15 11160.60 -18.7267786 -235.359845 May 15 10873.78 -23.0434970 -181.118580 Jun 15 10706.11 -25.3636140 -439.882511 Jul 15 10467.19 -28.7811473 123.869659 Aug 15 10392.28 -29.5182396 -149.380259 Sep 15 10734.48 -23.5882985 -512.894296 Oct 15 11157.67 -16.4792935 -19.420314 Nov 15 11095.82 -17.1988956 -372.988784 Dec 15 11263.73 -14.2662959 537.612129 > m$resid Jan Feb Mar Apr May Jun 1 0.00000000 -1.86547077 2.96015873 -0.40411294 -0.37653132 -0.97895061 2 -0.15715206 -0.91620742 -0.66508820 -0.59846788 -0.71640162 -0.74668047 3 2.18746879 -1.32727691 -1.16921929 -0.37893573 0.38918304 -0.17286404 4 -1.87763277 0.93310349 3.07463864 0.12500891 -1.18209817 -1.56793659 5 -0.53296441 0.62485289 0.37324429 -1.98383186 -0.46822277 -0.12582377 6 2.97928732 -2.08499835 -1.85628887 0.51931426 -0.12160603 0.13405592 7 0.02449069 -0.28696878 1.03685871 -0.52156132 0.37319023 -0.34819816 8 0.21675187 0.26313957 0.89504582 -0.66583233 -1.12570510 -0.49819762 9 -0.75175024 -0.02535127 0.93286300 0.09557252 -1.62584207 -0.22066143 10 0.29837895 -0.71993674 -1.07900222 -0.36359949 -0.03016403 -0.33423900 11 0.04120973 2.37690455 0.90832742 -2.44422063 -0.30328462 -0.56716522 12 0.17445259 1.01200122 0.20639627 0.04216298 -1.16223714 -0.32062664 13 0.51796055 0.23999185 -0.12129533 0.17631999 -0.46506078 -0.32731716 14 0.20941931 -0.03560264 -0.73634486 0.30507404 -0.07817971 -1.05533315 15 2.60042932 -1.25628170 -2.04339876 -0.06830022 -0.47765330 -0.25772403 Jul Aug Sep Oct Nov Dec 1 1.16880446 -0.23761335 -1.07707590 1.22967657 0.64416000 4.05678264 2 0.16285281 -0.59544903 -0.16152738 0.72664666 0.90164781 1.61781714 3 -0.27186240 1.68740128 -1.48092248 0.66556682 0.42026239 1.03691487 4 0.31223974 -0.52124896 0.77556453 0.23415401 1.00354479 2.29155828 5 0.10545094 0.01190453 -0.21260377 0.16688831 0.73383807 1.46974726 6 -0.47794047 -0.40601457 0.19898854 1.01146153 0.66295646 0.37869691 7 -0.80369017 -0.25234186 0.07272775 0.72916451 0.70282773 0.77633383 8 0.22346375 -0.49941334 -0.37793316 0.92804664 0.90758661 1.25141779 9 -0.29501277 0.58698620 0.01944507 -0.02265943 0.56127424 1.46206115 10 -0.29037766 0.39048270 0.17214950 0.16732080 0.64176433 -0.01672217 11 -1.13252652 -0.50732461 0.44342728 0.62265407 0.78397709 0.14262489 12 1.76253598 -2.30041780 0.30746554 -0.56257548 1.16342727 -0.12864714 13 -0.87018579 0.45691173 -0.29956091 1.29034304 0.77648081 0.64664635 14 -0.33664619 -0.23558394 0.18912782 0.69995640 0.26820092 0.86382745 15 -0.38047883 -0.08216256 0.66187549 0.79535426 -0.08079044 0.33002180 > 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 > mylagmax <- nx/2 > postscript(file="/var/www/html/rcomp/tmp/1k8rk1292937806.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(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/2k8rk1292937806.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(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/3vz8n1292937806.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(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/4vz8n1292937806.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > plot(as.numeric(m$resid),main='Standardized Residuals',ylab='Residuals',xlab='time',type='b') > grid() > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/56rpq1292937806.ps",horizontal=F,onefile=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 > > #Note: the /var/www/html/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > 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/69roe1292937806.tab") > > try(system("convert tmp/1k8rk1292937806.ps tmp/1k8rk1292937806.png",intern=TRUE)) character(0) > try(system("convert tmp/2k8rk1292937806.ps tmp/2k8rk1292937806.png",intern=TRUE)) character(0) > try(system("convert tmp/3vz8n1292937806.ps tmp/3vz8n1292937806.png",intern=TRUE)) character(0) > try(system("convert tmp/4vz8n1292937806.ps tmp/4vz8n1292937806.png",intern=TRUE)) character(0) > try(system("convert tmp/56rpq1292937806.ps tmp/56rpq1292937806.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.986 0.887 6.279