R version 3.0.2 (2013-09-25) -- "Frisbee Sailing" Copyright (C) 2013 The R Foundation for Statistical Computing Platform: i686-pc-linux-gnu (32-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(112,118,132,129,121,135,148,148,136,119,104,118,115,126,141,135,125,149,170,170,158,133,114,140,145,150,178,163,172,178,199,199,184,162,146,166,171,180,193,181,183,218,230,242,209,191,172,194,196,196,236,235,229,243,264,272,237,211,180,201,204,188,235,227,234,264,302,293,259,229,203,229,242,233,267,269,270,315,364,347,312,274,237,278,284,277,317,313,318,374,413,405,355,306,271,306,315,301,356,348,355,422,465,467,404,347,305,336,340,318,362,348,363,435,491,505,404,359,310,337,360,342,406,396,420,472,548,559,463,407,362,405,417,391,419,461,472,535,622,606,508,461,390,432) > par1 = '12' > 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 0.00000 160.97553 29.84652 0.00000 > m$fitted level slope sea Jan 1 112.0000 0.00000000 0.0000000 Feb 1 116.6627 4.77318473 1.3373392 Mar 1 130.3654 11.08629383 1.6346055 Apr 1 132.2554 4.19626407 -3.2554036 May 1 123.4946 -5.30231647 -2.4946259 Jun 1 130.6818 3.82135943 4.3182047 Jul 1 145.9541 12.21060834 2.0458534 Aug 1 150.7955 6.80932765 -2.7954621 Sep 1 139.9905 -6.09921744 -3.9905199 Oct 1 120.9578 -15.57585340 -1.9578022 Nov 1 103.4520 -16.98990777 0.5480121 Dec 1 111.3207 1.22406082 6.6792744 Jan 2 116.0844 3.81134595 -1.0844087 Feb 2 126.6033 8.73193668 -0.6032929 Mar 2 136.8854 9.82660265 4.1145706 Apr 2 136.6235 2.70264196 -1.6235103 May 2 132.2658 -2.30644457 -7.2657818 Jun 2 144.7753 8.12593012 4.2246821 Jul 2 165.1234 16.73441072 4.8765648 Aug 2 172.0741 9.83368013 -2.0740605 Sep 2 162.3749 -3.94679627 -4.3749101 Oct 2 137.8905 -18.43542694 -4.8905428 Nov 2 118.5544 -19.07065026 -4.5544017 Dec 2 126.4104 -0.09916582 13.5895791 Jan 3 144.5567 12.75657257 0.4432856 Feb 3 153.0599 9.75587649 -3.0598766 Mar 3 168.0546 13.41224615 9.9454189 Apr 3 166.1793 2.76495715 -3.1793486 May 3 180.7019 10.99183139 -8.7019069 Jun 3 182.6633 4.69351441 -4.6632705 Jul 3 191.5728 7.62913388 7.4272182 Aug 3 196.3072 5.61137260 2.6928129 Sep 3 184.8344 -6.30429131 -0.8343703 Oct 3 167.3629 -14.09293309 -5.3629433 Nov 3 156.8838 -11.57367946 -10.8838092 Dec 3 155.2560 -4.64475392 10.7440430 Jan 4 165.8134 5.95357168 5.1866098 Feb 4 181.9197 13.02911930 -1.9196715 Mar 4 182.2668 4.23629382 10.7331801 Apr 4 187.0905 4.64303189 -6.0904725 May 4 190.4105 3.72421743 -7.4104733 Jun 4 218.8996 20.90628958 -0.8996351 Jul 4 227.0411 12.06476096 2.9588640 Aug 4 234.3416 8.76358186 7.6583878 Sep 4 213.3321 -11.87937054 -4.3320562 Oct 4 196.5211 -15.29886383 -5.5210871 Nov 4 184.6596 -12.91638711 -12.6595528 Dec 4 184.9232 -3.78282918 9.0768478 Jan 5 191.2187 3.20563280 4.7812582 Feb 5 193.5794 2.62011523 2.4206338 Mar 5 218.3071 17.89263910 17.6928671 Apr 5 241.2295 21.36484013 -6.2294951 May 5 249.1423 12.06154925 -20.1423294 Jun 5 245.7061 1.34448614 -2.7060592 Jul 5 257.0653 8.26126062 6.9347383 Aug 5 257.4232 2.80342293 14.5767563 Sep 5 242.9183 -9.15456153 -5.9183193 Oct 5 219.7176 -18.85977639 -8.7176208 Nov 5 196.5544 -21.83268263 -16.5544010 Dec 5 189.5524 -11.58651480 11.4476001 Jan 6 194.8948 0.11397073 9.1052238 Feb 6 193.9680 -0.60479977 -5.9680106 Mar 6 213.7698 13.46101745 21.2301760 Apr 6 229.3182 14.89918533 -2.3182452 May 6 249.2278 18.35542495 -15.2277660 Jun 6 270.8827 20.63197617 -6.8827104 Jul 6 293.3736 21.91345461 8.6263877 Aug 6 281.8732 -1.11232880 11.1267969 Sep 6 262.8385 -13.46502396 -3.8385442 Oct 6 237.9917 -21.31061644 -8.9917203 Nov 6 221.8125 -17.77352112 -18.8125436 Dec 6 217.8790 -8.23165711 11.1209844 Jan 7 227.4850 4.06916037 14.5150220 Feb 7 242.2508 11.44033228 -9.2507606 Mar 7 248.0626 7.56707641 18.9373602 Apr 7 270.0310 17.47456772 -1.0310427 May 7 289.2444 18.67181544 -19.2443589 Jun 7 320.6910 27.47087490 -5.6910076 Jul 7 346.4582 26.29814760 17.5417682 Aug 7 338.3996 2.65973803 8.6004468 Sep 7 316.2412 -14.41525185 -4.2412464 Oct 7 286.8088 -24.74809444 -12.8088380 Nov 7 259.8360 -26.27907420 -22.8359530 Dec 7 264.0103 -5.31729685 13.9897036 Jan 8 269.6684 2.23809420 14.3316281 Feb 8 281.2219 8.64661794 -4.2219026 Mar 8 299.7337 15.42629436 17.2662833 Apr 8 316.1650 16.11678351 -3.1649523 May 8 341.7878 22.65279754 -23.7878072 Jun 8 378.0812 32.03467509 -4.0812192 Jul 8 390.9817 18.88014360 22.0182906 Aug 8 391.7170 6.41231249 13.2830397 Sep 8 361.6475 -18.65081638 -6.6475174 Oct 8 321.6317 -33.32960043 -15.6317108 Nov 8 299.2090 -25.83460259 -28.2089806 Dec 8 290.6476 -13.96149962 15.3523599 Jan 9 297.7003 0.48326735 17.2997348 Feb 9 305.7670 5.69289595 -4.7669962 Mar 9 333.3221 20.69935390 22.6778573 Apr 9 356.3835 22.32042288 -8.3835011 May 9 384.0880 26.01760145 -29.0880094 Jun 9 420.3627 33.06331491 1.6372739 Jul 9 441.5824 24.93046844 23.4175872 Aug 9 445.9233 10.79939263 21.0766956 Sep 9 413.0913 -19.13766802 -9.0913350 Oct 9 369.4977 -35.91846166 -22.4976897 Nov 9 336.3594 -34.01033363 -31.3594252 Dec 9 321.2343 -21.04532959 14.7656720 Jan 10 319.8876 -7.52237986 20.1124252 Feb 10 325.7851 1.68521516 -7.7850992 Mar 10 337.5925 8.62555396 24.4074597 Apr 10 357.2402 16.18211251 -9.2402328 May 10 393.3108 29.82348197 -30.3108115 Jun 10 431.3385 35.45243424 3.6614914 Jul 10 463.2158 33.00011275 27.7842262 Aug 10 474.7164 18.26050755 30.2835797 Sep 10 421.5512 -30.69180249 -17.5511728 Oct 10 381.0457 -37.41781566 -22.0457107 Nov 10 346.0975 -35.72475171 -36.0975285 Dec 10 323.9909 -26.38631868 13.0090656 Jan 11 333.6135 -1.69536864 26.3865153 Feb 11 348.3405 9.55953749 -6.3404607 Mar 11 379.5356 24.37883061 26.4644261 Apr 11 411.7351 29.73516644 -15.7350823 May 11 453.4403 37.93659845 -33.4402919 Jun 11 475.7819 27.24838151 -3.7818539 Jul 11 510.9559 32.67921772 37.0441025 Aug 11 513.6633 12.15185109 45.3367076 Sep 11 484.8765 -15.87689405 -21.8765116 Oct 11 434.8407 -39.26400018 -27.8406855 Nov 11 399.1402 -36.82355198 -37.1402180 Dec 11 394.1817 -14.99557898 10.8182582 Jan 12 392.7148 -5.72902712 24.2851881 Feb 12 400.3772 3.43918809 -9.3771845 Mar 12 397.7033 -0.74393633 21.2966645 Apr 12 463.8640 45.03559062 -2.8639619 May 12 506.9738 43.71740722 -34.9737547 Jun 12 544.9161 39.76339485 -9.9160926 Jul 12 578.0951 35.25600396 43.9049189 Aug 12 560.0433 -1.21956354 45.9567427 Sep 12 524.0762 -24.98704826 -16.0761887 Oct 12 490.5008 -30.86151452 -29.5007552 Nov 12 441.0112 -43.60646144 -51.0112283 Dec 12 417.8508 -29.61435096 14.1492402 > m$resid Jan Feb Mar Apr May Jun 1 0.00000000 0.42422808 0.52904817 -0.55572228 -0.74310512 0.72013021 2 0.20450767 0.39384248 0.08591047 -0.57008290 -0.39434193 0.82076557 3 1.01622748 -0.23684215 0.28757659 -0.84393700 0.64940047 -0.49550887 4 0.83683715 0.55759280 -0.69229486 0.03214197 -0.07253046 1.35283026 5 0.55134685 -0.04613044 1.20301533 0.27407012 -0.73415967 -0.84427584 6 0.92265739 -0.05662765 1.10820945 0.11345853 0.27267330 0.17940003 7 0.96973956 0.58074578 -0.30520038 0.78139772 0.09443706 0.69351425 8 0.59554283 0.50491915 0.53425433 0.05444992 0.51548478 0.73951740 9 1.13849103 0.41047245 1.18259469 0.12782031 0.29156376 0.55539747 10 1.06578525 0.72549652 0.54695366 0.59579172 1.07570037 0.44372706 11 1.94591943 0.88683236 1.16789990 0.42229729 0.64669525 -0.84255214 12 0.73029745 0.72242699 -0.32967410 3.60916432 -0.10393616 -0.31169450 Jul Aug Sep Oct Nov Dec 1 0.66141391 -0.42569268 -1.01743383 -0.74692088 -0.11145153 1.43557126 2 0.67899938 -0.54395063 -1.08607979 -1.14202127 -0.05006671 1.49570948 3 0.23138010 -0.15907692 -0.93911993 -0.61390472 0.19856137 0.54645417 4 -0.69655478 -0.26022765 -1.62704141 -0.26951534 0.18779443 0.72034236 5 0.54486521 -0.43015897 -0.94252767 -0.76495796 -0.23435466 0.80801818 6 0.10095306 -1.81455032 -0.97363007 -0.61842045 0.27885050 0.75240001 7 -0.09239375 -1.86269976 -1.34581033 -0.81452210 -0.12070272 1.65275197 8 -1.03646644 -0.98242998 -1.97537641 -1.15715373 0.59092604 0.93608887 9 -0.64083992 -1.11347791 -2.35948279 -1.32289016 0.15044429 1.02212992 10 -0.19324346 -1.16143089 -3.85812344 -0.53024088 0.13348809 0.73619555 11 0.42796607 -1.61750240 -2.20904077 -1.84370689 0.19241358 1.72076562 12 -0.35520522 -2.87421693 -1.87319020 -0.46310651 -1.00484344 1.10301869 > 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/fisher/rcomp/tmp/1d1ak1386603950.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/fisher/rcomp/tmp/2upx91386603950.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/fisher/rcomp/tmp/3bze51386603950.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/fisher/rcomp/tmp/440uq1386603950.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/fisher/rcomp/tmp/5o48c1386603950.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/fisher/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/fisher/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/fisher/rcomp/tmp/6ls2e1386603951.tab") > > try(system("convert tmp/1d1ak1386603950.ps tmp/1d1ak1386603950.png",intern=TRUE)) character(0) > try(system("convert tmp/2upx91386603950.ps tmp/2upx91386603950.png",intern=TRUE)) character(0) > try(system("convert tmp/3bze51386603950.ps tmp/3bze51386603950.png",intern=TRUE)) character(0) > try(system("convert tmp/440uq1386603950.ps tmp/440uq1386603950.png",intern=TRUE)) character(0) > try(system("convert tmp/5o48c1386603950.ps tmp/5o48c1386603950.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 7.550 1.335 8.846